Live555 OpenRTSP Client : How to delete current rtsp client properly and start new One

亡梦爱人 提交于 2019-12-07 23:48:00

问题


Well,

  • When my OpenRtsp Client lost connection with server, I dispose the old client and other parameters then re-create new client.

  • The Client send Options,Describe request successfully but failed after that... I can not able create Session and Subsesions so I got Access Violations errors..

How to reset old OpenRtspClient properly so that get new "brand" RTSPClient?

My Current Way to Reset Old Client:

I just modify the "shutdown" method in playCommon class. I did not send Teardown...

...

  void ResetOurClient(){

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

      closeMediaSinks();
      Medium::close(session);
      delete ourAuthenticator;
      Medium::close(ourClient);
}

And My ReStartCode:

void StartOurClient()
{

      TaskScheduler* scheduler = BasicTaskScheduler::createNew();
      env = BasicUsageEnvironment::createNew(*scheduler);


      char* streamURL =  "XXXXXXXXX";


      // Create our client object:
      ourClient = createClient(*env, streamURL, verbosityLevel, progName);
      if (ourClient == NULL) {
        *env << "Failed to create " << clientProtocolName
            << " client: " << env->getResultMsg() << "\n";
        shutdown();
      }

      if (sendOptionsRequest) {
        // Begin by sending an "OPTIONS" command:
        getOptions(continueAfterOPTIONS);
      } else {
        continueAfterOPTIONS(NULL, 0, NULL);
      }

      // All subsequent activity takes place within the event loop:
      env->taskScheduler().doEventLoop(&continuesStream); // does not return
}

回答1:


(Answered by the OP in a question edit. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )

The OP wrote:

Well there was a static variable setUpIter...[MediaSubsessionIterator* setupIter = NULL;] in setupstreams method...so make it global non-static variable and make it NULL at ReStart



来源:https://stackoverflow.com/questions/8226021/live555-openrtsp-client-how-to-delete-current-rtsp-client-properly-and-start-n

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!