[Live-devel] OnDemandServerMediaSubsession bug
Ross Finlayson
finlayson at live555.com
Tue Jul 4 02:46:18 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.
I don't see how this can happen, because
"OnDemandServerMediaSubsession::deleteStream() " is the only place
where the reference count is *decremented*. I assume, therefore,
that you are instead referring to the reference count being *set*
(not decremented) to 0 in "StreamState::reclaim()" (which is called
by "afterPlayingStreamState()")?
> 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 *think* this will work, although I'm a bit worried about the
"StreamState" object getting deleted twice (once when the reference
count was 1, and again when the reference count was 0). However,
because the "streamToken" reference parameter will get set to NULL
the first time the object gets deleted, I don't think that situation
will occur.
So, I'll go ahead and make this change in the next release of the
software. In the meantime, please let me know if it causes any
problems for you.
Ross Finlayson
Live Networks, Inc. (LIVE555.COM)
<http://www.live555.com/>
More information about the live-devel
mailing list