On Wed, Oct 21, 2009 at 10:10 AM, Tao Wu <span dir="ltr"><<a href="mailto:lanlantao@gmail.com">lanlantao@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>I have an architecture question of livemedia. Livemedia is a single thread program, it uses "event" to serve multiple video streams.<br>If in one video stream, I called some blocking functions, will it hurt other video streams?<br>
For example, assume the server wants to server two video streams, A and B. Both stream A and B's sources are from the hardware encoder, not a file on hard drive. <br>So if stream A VideoStreamer::ContinueReadProcessing reads data from the video sources, it may not get the data immediately when using blocking function calls to the hardware encoder. In the worst case, it can stop for ever because of hardware failure. <br>
If that happens, can stream B still function properly when stream A blocked? <br></blockquote><div><br>Short answer: no, you cannot block Live555 in any way and expect good results.<br><br>Long answer: instead of blocking, consider having your code simply check and see if any data is available. If no data is available, use Live555's event mechanism to schedule another check for data in however long is appropriate. For example, I have a hardware h264 encoder. On my Live555 thread, I merely check and see if there's any available data. If there is, I process it. If there isn't, I use Live555's scheduling to drop back in another 20 milliseconds (or whatever is appropriate).<br>
<br>It's polling, yes, but it works just fine. <br></div></div>