简体   繁体   中英

Stop Live555 from re-using session

I'm using Live555 to pull in data from a IP webcam on a remote connection. From time to time, there are brief interruptions to the stream (which might be a network QOS issues), however, live555 dies every time this happens instead of successfully restarting the connection. The debug output looks like this:

Closing session, because we stopped receiving packets.itrate=N/A speed=1.37x
Created new TCP socket 3 for connection
Connecting to 10.8.1.14, port 10111 on socket 3...
...remote connection opened
Sending request: PLAY rtsp://mycamera.test/live/ch0/ RTSP/1.0
CSeq: 6
User-Agent: /bin/openRTSP (LIVE555 Streaming Media v2017.07.18)
Session: 1487641045855494467
Range: npt=0.000-

Received 199 new bytes of response data.
Received a complete PLAY response:
RTSP/1.0 500 Internal Server Error
Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )
Cseq: 6
Session: 1487641045855494467
Connection: Close

Failed to start playing session: 500 Internal Server Error
Created new TCP socket 3 for connection
Connecting to 10.8.1.14, port 10111 on socket 3...
...remote connection opened
Sending request: TEARDOWN rtsp://mycamera.test/live/ch0/ RTSP/1.0
CSeq: 7
User-Agent: /bin/openRTSP (LIVE555 Streaming Media v2017.07.18)
Session: 1487641045855494467

Received 180 new bytes of response data.
Received a complete TEARDOWN response:
RTSP/1.0 200 OK
Server: DSS/6.0.3 (Build/526.3; Platform/Linux; Release/Darwin Streaming Server; State/Development; )
Cseq: 7
Session: 1487641045855494467
Connection: Close

It would seem that the reason live555 bails out is because the camera throws a 500 error when attempting to restart the stream for an existing session. Since starting a new session works, is there any way to tell live555 to discard the existing session and start again rather than just giving up? I do have a cron job which detects when live555 has stopped and restarts it, but there are knock on issues when I do this so it would be much cleaner if I could persuade live555 to compensate for the bug in the camera firmware.

I'm happy to patch the live555 code and rebuild if necessary!

If you look to the code of playCommon.cpp , you could see

void sessionAfterPlaying(void* /*clientData*/) {
  if (!playContinuously) {
    shutdown(0);
  } else {
    // We've been asked to play the stream(s) over again.
    // First, reset state from the current session:
    if (env != NULL) {
      env->taskScheduler().unscheduleDelayedTask(periodicFileOutputTask);
      env->taskScheduler().unscheduleDelayedTask(sessionTimerTask);
      env->taskScheduler().unscheduleDelayedTask(arrivalCheckTimerTask);
      env->taskScheduler().unscheduleDelayedTask(interPacketGapCheckTimerTask);
      env->taskScheduler().unscheduleDelayedTask(qosMeasurementTimerTask);
    }
    totNumPacketsReceived = ~0;

    startPlayingSession(session, initialSeekTime, endTime, scale, continueAfterPLAY);
  }
}

As you see in your log, it send a PLAY and doesnot reinitiate the Session. In order to change this behaviour, you need to modify the code of openRTSP.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM