<div dir="ltr"><div dir="ltr">Hi Ross,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 24 Apr 2024 at 19:26, Ross Finlayson <<a href="mailto:finlayson@live555.com">finlayson@live555.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> On Apr 24, 2024, at 1:46 PM, Flavio Alves <<a href="mailto:flavio.alves@vitalintelligencedata.com" target="_blank">flavio.alves@vitalintelligencedata.com</a>> wrote:<br>
> <br>
> My first implementation uses the approach you mentioned. I implemented it using x264 and it worked fine.<br>
> <br>
> But my requirement is to use the Nvidia Jetson Nano hardware encoder. Nvidia provides an API to handle the encoder. This API uses threads for the encoder and select() for V4L communication. On my implementation, when I executed everything, the Live555 worked fine and the Encoder thread got stuck, because the use of the select() is also blocking.<br>
<br>
I’m not sure I see the problem here. Suppose you have two threads - one for your encoder (that uses your Nvidia API), and another for the server (that uses the LIVE555 API). Both threads are event-driven (using “select()”). Set up your encoder thread to call “select()” (and thus block) on your input socket (for your encoder), to call a handler function whenever there’s new data (presumably, an encoded NAL unit) available to read on this socket. This handler function would call “triggerEvent()” (the only LIVE555 function that can be called by a non-LIVE555 thread), to signal the LIVE555 thread of the availability of new data.<br></blockquote><div><br></div><div>Probably it was something I have done wrong.</div><div><br></div><div>I rebuilt here, using the approach you describe previously and now I have everything working as it should. I'm using the 2+ threads approach that you have described above.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
In other words, both threads are blocking, but only until an event occurs - which the thread should then handle.<br>
<br>
The other possibility is to use just a single (LIVE555) thread, and do all event handling using LIVE555. You could handle events on your encoder socket by calling (the LIVE555 function) “setBackgroundHandling()” (you can see several examples of this in the “liveMedia” directory. In this case, you would not call “select()” at all (because the LIVE555 event loop already does that for you).<br>
<br>
But I don’t know anything about your "Nvidia Jetson multimedia API”. so I might be completely wrong here…<br></blockquote><div><br></div><div>It is not mine ... it is Nvidia's: <a href="https://docs.nvidia.com/jetson/l4t-multimedia/index.html">https://docs.nvidia.com/jetson/l4t-multimedia/index.html</a> :-)</div><div><br></div><div>Thank you very much.</div><div><br></div><div>Best regards,</div><div><br></div><div>Flavio</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
Ross Finlayson<br>
Live Networks, Inc.<br>
<a href="http://www.live555.com/" rel="noreferrer" target="_blank">http://www.live555.com/</a><br>
<br>
<br>
_______________________________________________<br>
live-devel mailing list<br>
<a href="mailto:live-devel@lists.live555.com" target="_blank">live-devel@lists.live555.com</a><br>
<a href="http://lists.live555.com/mailman/listinfo/live-devel" rel="noreferrer" target="_blank">http://lists.live555.com/mailman/listinfo/live-devel</a><br>
</blockquote></div></div>