live555客户端发送TEARDOEN退出

Boolean areAlreadyShuttingDown = False;
int shutdownExitCode;
void shutdown(int exitCode) {
  if (areAlreadyShuttingDown) return; // in case we're called after receiving a RTCP "BYE" while in the middle of a "TEARDOWN".
  areAlreadyShuttingDown = True;

  shutdownExitCode = exitCode;
  if (env != NULL) {
    env->taskScheduler().unscheduleDelayedTask(sessionTimerTask);
    env->taskScheduler().unscheduleDelayedTask(arrivalCheckTimerTask);
    env->taskScheduler().unscheduleDelayedTask(interPacketGapCheckTimerTask);
    env->taskScheduler().unscheduleDelayedTask(qosMeasurementTimerTask);
  }

  if (qosMeasurementIntervalMS > 0) {
    printQOSData(exitCode);
  }

  // Teardown, then shutdown, any outstanding RTP/RTCP subsessions
  if (session != NULL) {
    tearDownSession(session, continueAfterTEARDOWN);
  } else {
    continueAfterTEARDOWN(NULL, 0, NULL);
  }
}

借鉴live555的openrtsp做为客户端接收数据,由于是开子线程创建的live555所以进程不关闭只结束live555线程时调用shutdown发送退出请求,第一次发送没问题,后面发送就一直出问题,原来是shutdown下面的

areAlreadyShuttingDown = True;
这句使我们后面调用shutdown会直接return,所以把这句注释掉就可以了,如果主进程关闭在开可以无视此问题。

你可能感兴趣的:(cc++,cc++)