[Live-devel] Two possible problems in RTSPServer class

Bruno Abreu bruno.abreu at livingdata.pt
Thu May 17 04:02:42 PDT 2012


On 04/22/2012 06:46 AM, Ross Finlayson wrote:
>> 2. Also I have seen possible ServerMediaSession object relations bug
>> in RTSPServer::addServerMediaSession/RTSPServer::removeServerMediaSession
>> methods.
>> Method addServerMediaSession adds a ServerMediaSession object to
>> hashmap fServerMediaSessions and call removeServerMediaSession on
>> ServerMediaSession object previously set in the hashmap (if both
>> objects have same stream name). Method removeServerMediaSession
>> removes from the hashmap new ServerMediaSession object just added by
>> addServerMediaSession.
>
> Yes, this is a bug. It will get fixed in a future release.

I'm sorry, but I fail to see how this was a bug. Seems to me that 
RTSPServer::addServerMediaSession was removing an existing 
ServerMediaSession with the same name as the one being created, if any. 
Which sounded about right.

The current fix, however, as introduced a nasty bug to our application. 
We are running a streaming server in which we use a DynamicRTSPServer, 
similar to the one of the LIVE555 Media Server application, on which it 
is based.

With the current solution, the 
DynamicRTSPServer::lookupServerMediaSession method calls 
RTSPServer::addServerMediaSession (as before) which calls 
RTSPServer::removeServerMediaSession(char const* streamName) which, in 
turn, calls DynamicRTSPServer::lookupServerMediaSession again. This 
happens recursively until our application crashes.

I tested the live555MediaServer app to see if it was a problem with our 
implementation but it exhibits a similar behavior, although, in this 
case, recursion only happens about 1000 times and then stops.

I don't know why recursion stops in one case and not on the other, but I 
don't think it was supposed to happen at all, anyway. I added a log 
message to RTSPServer::addServerMediaSession and LIVE555 Media Server's 
DynamicRTSPServer::lookupServerMediaSession and this was the output:

LIVE555 Media Server
     version 0.74 (LIVE555 Streaming Media library version 2012.05.11).
...
accept()ed connection from 192.168.1.10
DynamicRTSPServer::lookupServerMediaSession: picolo.264
RTSPServer::addServerMediaSession: picolo.264
DynamicRTSPServer::lookupServerMediaSession: picolo.264
RTSPServer::addServerMediaSession: picolo.264
DynamicRTSPServer::lookupServerMediaSession: picolo.264
RTSPServer::addServerMediaSession: picolo.264
...
last 2 messages repeated about 1000 times

So, I have a question: is this a bug or isn't 
DynamicRTSPServer::lookupServerMediaSession supposed to call 
RTSPServer::addServerMediaSession?

If it isn't a bug we'll have to fix our app, and I guess the same will 
have to be done to LIVE555 Media Server, although it still works. 
Otherwise I think the current solution still needs some improvement.

Thank you,
Bruno Abreu

-- 
Living Data - Sistemas de Informação e Apoio à Decisão, Lda.

LxFactory - Rua Rodrigues de Faria, 103,
edifício I - 4º piso                  Phone:  +351 213622163
1300-501 LISBOA                       Fax:    +351 213622165
Portugal                              URL: www.livingdata.pt


More information about the live-devel mailing list