[Live-devel] Problem in changing the RTSP URI
Ross Finlayson
finlayson at live.com
Sun Mar 13 21:32:05 PST 2005
>My doubt is that, when the streaming is happening, and if
>shutdown is siganlled by another thread (other than the one
>which is actually waiting on select call), will this cause
>any problem?
It depends what you mean by "shutdown is signalled by another
thread". Remember that code that uses the "LIVE.COM Streaming Media"
libraries must be run as a single-threaded event loop (see
<http://www.live.com/liveMedia/faq.html#threads>). Therefore, only the
(single) thread that calls "doEventLoop()" can actually do the 'shutdown'
(i.e., by calling "Medium::close()" on objects, etc.).
The best way to do this is using the "watchVariable" parameter to
"doEventLoop()" (see
<http://www.live.com/liveMedia/faq.html#exiting-event-loop>). E.g.,
char watchVariable;
while (1) {
<do some initialization>
watchVariable = 0;
scheduler->doEventLoop(&watchVariable);
<clean up>
}
and then, in a second thread, you can signal the event loop to do the clean
up by
watchVariable = 1;
If you're doing this, but you're still seeing a crash, then you may be
reclaiming objects in the wrong order. (In general, you should reclaim
objects in the reverse order from the order in which they were created -
i.e., LIFO.)
Ross Finlayson
LIVE.COM
<http://www.live.com/>
More information about the live-devel
mailing list