[Live-devel] Two possible problems in RTSPServer class
Ross Finlayson
finlayson at live555.com
Thu May 17 07:13:08 PDT 2012
>>> 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.
No, the old code was doing (when implementing "RTSPServer::addServerMediaSession()"):
ServerMediaSession* existingSession
= (ServerMediaSession*)(fServerMediaSessions->Add(sessionName, (void*)serverMediaSession));
removeServerMediaSession(existingSession); // if any
which was a bug, because - if "existingSession" was not NULL, then the call to
removeServerMediaSession(existingSession); // if any
happened to remove - from the hash table - the *new* "serverMediaSession" that had just been added - because of the way that
RTSPServer::removeServerMediaSession(ServerMediaSession* existingSession)
is implemented by calling
Remove(existingSession->streamName());
on the internal hash table.
The new code does:
removeServerMediaSession(sessionName); // in case an existing "ServerMediaSession" with this name already exists
fServerMediaSessions->Add(sessionName, (void*)serverMediaSession);
which is correct, except for the fact that
void RTSPServer::removeServerMediaSession(char const* sessionName)
is implemented by calling
removeServerMediaSession(lookupServerMediaSession(sessionName));
i.e., by calling the "lookupServerMediaSession()" *virtual function*. That's a bug. The code should just be doing a hash table lookup here; not calling the "lookupServerMediaSession()" virtual function.
I've now installed a new version (2012.05.17) of the code that fixes this.
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120517/303db3db/attachment-0001.html>
More information about the live-devel
mailing list