c++rtsplive555

Live555MediaServer restarts the stream at every new connection. Why setting "reuseSource" to true is not working as expected?


Live555MediaServer can be used to stream video files as rtsp streams. I have 2 clients (vlc) that connect to the server, A and B. I want to see the exact video stream in both the clients. Here is the problem: I connect A and after 10 seconds I connect B. When B is connected the video that I see starts over from the beginning, while A keeps streaming as it was.

I would like the 2 concurrent streams to be synchronized.

The live555 doc says that setting reuseFirstSource to True should work. So I tried to set reuseSource to true at DynamicRTSSPServer:121 but it didn't work. When I connect to the server using client B the video restarts from the beginning.

Boolean const reuseSource = True;

I expect to see the 2 concurrent streams synchronized even if one starts with a delay with respect to the other one.


Solution

  • I finally found a workaround and why there was this 'bug'.

    Quick answer: set if condition at line 67 to false, i.e.
    if (smsExists && isFirstLookupInSession) {
    becomes
    if (false) {

    Explaination: Every time a new session is starting, the isFirstLookupInSession variable is set to true and the session is removed and recreated.

    I wrote to the support of live555 and Finlayson told me and I quote

    “LIVE555 Media Server” code was always intended to work this way, and was intended to be a ‘stand-alone appliance’ that does not have its code modified (e.g., by changing the value of “reuseFirstSource”).

    Thus the only solution for creating a RTSP server through Live555 is to create your own server starting from the testProgs examples. The workaround proposed here could generate unwanted behaviors, but for a simple rtsp server with multiple streams it's fine.