<div dir="ltr"><div>Hi Brad, <br><br></div>Very interesting comments. I am worrying more about the speed hit of putting it in a wrapper. We're in a real-time audio processing situation. Your experience is most appreciated.<br>

<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 15, 2013 at 11:43 AM, Brad O'Hearne <span dir="ltr"><<a href="mailto:brado@bighillsoftware.com" target="_blank">brado@bighillsoftware.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On May 15, 2013, at 8:19 AM, Joe Flowers <<a href="mailto:joe.flowers@nofreewill.com">joe.flowers@nofreewill.com</a>> wrote:<br>


<br>
> Does anyone know how to make (enable) the libav* APIs to be thread-safe?<br>
<br>
</div>This may sound a little ridiculous, but in general with any third-party library, make a thread-safe wrapper around it. I would guess that your dilemma centers on wanting to reuse resources like codecs / contexts, output formats / contexts, to keep the memory footprint low. But for whatever its worth, in throwing my FFmpeg processing on Instruments (Xcode profiling tool) that footprint is likely going to be a blip on the radar compared to the resources used when processing each frame (not because these consume a lot of memory, but because this processing will be executed many times a second).<br>


<br>
So if the motivation for multithreading is to reuse resources, I wouldn't worry about that. If you truly need more than one object accessing the same processing resources, then put a wrapper around it that makes multiple threads play nice. Without knowing exactly what you are trying to do, can't say what is the best route, but that's my best guess.<br>


<span class="HOEnZb"><font color="#888888"><br>
Brad<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
</div></div></blockquote></div><br></div>