On 7/4/06, <b class="gmail_sendername">Ross Finlayson</b> &lt;<a href="mailto:finlayson@live555.com">finlayson@live555.com</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>I don't see how this can happen, because<br>&quot;OnDemandServerMediaSubsession::deleteStream() &quot; is the only place<br>where the reference count is *decremented*.&nbsp;&nbsp;I assume, therefore,<br>that you are instead referring to the reference count being *set*
<br>(not decremented) to 0 in &quot;StreamState::reclaim()&quot; (which is called<br>by &quot;afterPlayingStreamState()&quot;)?</blockquote><div><br>That's right.&nbsp; deleteStream is getting called while streamState-&gt;referenceCount() is already 0, so it doesn't enter the if statement that deletes streamState and sets streamToken to NULL.&nbsp; This causes fLastStreamToken to not get set to NULL, so the next time getStreamParameters() gets called, it takes the &quot;else&quot; path instead of taking the &quot;first source&quot; path.&nbsp; 
<br>&nbsp;</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I *think* this will work, although I'm a bit worried about the<br>&quot;StreamState&quot; object getting deleted twice (once when the reference
<br>count was 1, and again when the reference count was 0).&nbsp;&nbsp;However,<br>because the &quot;streamToken&quot; reference parameter will get set to NULL<br>the first time the object gets deleted, I don't think that situation
<br>will occur.</blockquote><div><br>The count seems to be set to 0 in StreamState::afterPlayingStreamState() (which calls streamState-&gt;reclaim()) first, then deleteStream() is called.&nbsp; So it seems to still only be getting deleted once: in deleteStream().
<br>&nbsp;</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">So, I'll go ahead and make this change in the next release of the<br>software.&nbsp;&nbsp;In the meantime, please let me know if it causes any
<br>problems for you.</blockquote><div><br>Thanks,<br>Scott<br></div></div><br>