0
点赞
收藏
分享

微信扫一扫

LIVE555 发送RTCP报告报文的指令分析

unadlib 2022-06-06 阅读 99

  void OnExpire(event e,

                 int    members,

                 int    senders,

                 double rtcp_bw,

                 int    we_sent,

                 double *avg_rtcp_size,

                 int    *initial,

                 time_tp   tc,

                 time_tp   *tp,

                 int    *pmembers)

 

 

设置超时断开的任务

void GenericMediaServer::ClientSession::noteLiveness() {

#ifdef DEBUG

  char const* streamName

    = (fOurServerMediaSession == NULL) ? "???" : fOurServerMediaSession->streamName();

  fprintf(stderr, "Client session (id \"%08X\", stream name \"%s\"): Liveness indication\n",

  fOurSessionId, streamName);

#endif

  if (fOurServerMediaSession != NULL) fOurServerMediaSession->noteLiveness();

 

  if (fOurServer.fReclamationSeconds > 0) {

    envir().taskScheduler().rescheduleDelayedTask(fLivenessCheckTask,

  fOurServer.fReclamationSeconds*1000000,

  (TaskFunc*)livenessTimeoutTask, this);

  }

}

 

超时断开连接的代码

void GenericMediaServer::ClientSession::livenessTimeoutTask(ClientSession* clientSession) {

  // If this gets called, the client session is assumed to have timed out, so delete it:

#ifdef DEBUG

  char const* streamName

    = (clientSession->fOurServerMediaSession == NULL) ? "???" : clientSession->fOurServerMediaSession->streamName();

  fprintf(stderr, "Client session (id \"%08X\", stream name \"%s\") has timed out (due to inactivity)\n",

  clientSession->fOurSessionId, streamName);

#endif

  delete clientSession;

}

RTSPServer::RTSPServer(UsageEnvironment& env,

       int ourSocket, Port ourPort,

       UserAuthenticationDatabase* authDatabase,

       unsigned reclamationSeconds)

  : GenericMediaServer(env, ourSocket, ourPort, reclamationSeconds),

    fHTTPServerSocket(-1), fHTTPServerPort(0),

    fClientConnectionsForHTTPTunneling(NULL), // will get created if needed

    fTCPStreamingDatabase(HashTable::create(ONE_WORD_HASH_KEYS)),

    fPendingRegisterOrDeregisterRequests(HashTable::create(ONE_WORD_HASH_KEYS)),

    fRegisterOrDeregisterRequestCounter(0), fAuthDB(authDatabase), fAllowStreamingRTPOverTCP(True)

 

 

  if (fRTCPInstance == NULL && fRTPSink != NULL) {

    // Create (and start) a 'RTCP instance' for this RTP sink:

    fRTCPInstance = fMaster.createRTCP(fRTCPgs, fTotalBW, (unsigned char*)fMaster.fCNAME, fRTPSink);

        // Note: This starts RTCP running automatically

    fRTCPInstance->setAppHandler(fMaster.fAppHandlerTask, fMaster.fAppHandlerClientData);

  }

 

  if (fOurServer.fReclamationSeconds > 0) {

    envir().taskScheduler().rescheduleDelayedTask(fLivenessCheckTask,

  fOurServer.fReclamationSeconds*1000000,

  (TaskFunc*)livenessTimeoutTask, this);

  }

 

举报

相关推荐

0 条评论