Live555 OpenRTSP Client : How to delete current rt

2019-05-29 00:37发布

问题:

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