[Live-devel] Two possible problems in RTSPServer class

Bruno Abreu bruno.abreu at livingdata.pt
Thu May 17 09:45:18 PDT 2012


On Thu, 17 May 2012 07:13:08 -0700, Ross Finlayson wrote
> > 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.

OK, I get it now.


> 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.

And is working perfectly. Thank you so much Ross.

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