[FFmpeg-devel] [PATCH 2/2] avformat/udp: Replace use of pthread_cancel.

Hendrik Leppkes h.leppkes at gmail.com
Sat Dec 3 14:40:28 EET 2016

On Sat, Dec 3, 2016 at 1:33 PM, Matt Oliver <protogonoi at gmail.com> wrote:
> I havent fully tested Hendriks idea as the msdn docs dont recommend calling
> multiple winsock functions at the same time from different threads so i
> wasnt sure about how well received a patch that relies on closesocket to
> unblock the recv function would be received (although i have seen it
> extensively used without issuers). If Hendrik has tested this though with
> his local patch without issues then I would accept that as a solution to
> fixing my issue. ping Hendrik!

I don't really use UDP streaming on a regular basis, but I did test
this approach when I build it, and it works just fine.
What I did was basically just define pthread_cancel/setcancelstate to
empty in udp.c (and define HAVE_PTHREAD_CANCEL in that file to enable
the code) and re-shuffle the udp_close code to close the socket to
unblock the thread before waiting for it to exit.

I don't have a clean and finished patch to go, because I had no real
interest in it working on other platforms, so its rather ugly. But the
approach is rather simple.

- Hendrik

More information about the ffmpeg-devel mailing list