Right now Live555 loop run in separate thread. The clean up function can be called from the another thread
No! You cannot safely do this! Read the FAQ (that you were asked to do before posting to this mailing list)! Apart from "triggerEvent()" (see below), all calls to LIVE555 code *must* be done within the LIVE555 thread - e.g., from a LIVE555 event handler. For an illustration of how to shutdown (and reclaim) a "RTSPClient" object - and all of the objects that it uses - see the function "shutdownStream()" in "testProgs/testRTSPClient.cpp". Now, you may wish to signal this shutdown/reclaim mechanism from an external thread - i.e., from a thread other than one that's running the LIVE555 event loop, for example, a GUI. To do this, use the "event trigger" mechanism (see the FAQ and "UsageEnvironment/include/UsageEnvironment.hh"). Note that the "triggerEvent()" function is the *only* LIVE555 function that can be called from an external thread. This is a mistake I first made, even after reading the FAQ. I somehow didn't think about that I was calling shutdown and issue PLAY-commands (seek) from my own thread (since it usually works fine). Looking at the example code I however thought it was safe to schedule tasks. After reading your response above I'd like to verify that what I do is correct. My question is... I'm not calling triggerEvent() directly, but instead scheduling tasks using the taskScheduler. The code example below is called from an external thread. Is that ok, and the proper way to do it? void StopStream(OurRTSPClient *rtspClient) { if (rtspClient) { UsageEnvironment& env = rtspClient->envir(); env.taskScheduler().scheduleDelayedTask(TASK_FUNCTION_CALL_DELAY_MS, (TaskFunc*)StopStreamTask, rtspClient); } } /Claes
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ live-devel mailing list live-devel@lists.live555.com http://lists.live555.com/mailman/listinfo/live-devel