[Live-devel] OnDemandServerMediaSubsession bug

Scott Hays sdhays.neon.com.tw at gmail.com
Mon Jul 3 23:06:53 PDT 2006


I've encountered the following situation when using reuseFirstSource=True
doing on-demand streaming: if the stream source ends and calls
handleClosure(this), the streamState reference count is decremented to 0
BEFORE OnDemandServerMediaSubsession::deleteStream() is called.  So
deleteStream() doesn't delete the streamState because the reference count is
not > 0 and nothing else deletes it either.  This causes the first time a
client reconnects after a source ends to fail because the server is trying
to use a non-existent source.  The second attempt works fine because the
failed try increments the reference count and then allows deleteStream to
delete the streamState properly.

The fix I've written for this is to change lines 303 and 304 in
OnDemandServerMediaSubsession.cpp to:
  if (streamState != NULL && streamState ->referenceCount() >= 0) {
    if (0 < streamState->referenceCount()) --streamState->referenceCount();

I'm not sure if this is the best way to fix this, but it's working for me.
This situation occurs for me when using a source class that I have
implemented whose media source (an encoder) sometimes needs to restart,
causing the source class to signal end-of-stream using handleClosure(this).
It also occurs in testOnDemandRTSPServer when reuseFirstSource is set to
"True".

Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.live555.com/pipermail/live-devel/attachments/20060703/02bfbee5/attachment.html 


More information about the live-devel mailing list