[FFmpeg-devel] [PATCH 3/3] avformat/async: avoid deadlock on close

Michael Niedermayer michael at niedermayer.cc
Tue Jul 21 11:49:42 CEST 2015


On Tue, Jul 21, 2015 at 03:46:04PM +0800, Zhang Rui wrote:
> ---
>  libavformat/async.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/async.c b/libavformat/async.c
> index 1ab28d3..36c86d0 100644
> --- a/libavformat/async.c
> +++ b/libavformat/async.c
> @@ -129,7 +129,8 @@ static void *async_buffer_task(void *arg)
>          if (c->io_eof_reached || fifo_space <= 0) {
>              pthread_mutex_lock(&c->mutex);
>              pthread_cond_signal(&c->cond_wakeup_main);
> -            pthread_cond_wait(&c->cond_wakeup_background, &c->mutex);
> +            if (!async_interrupt_callback(h))
> +                pthread_cond_wait(&c->cond_wakeup_background, &c->mutex);

i dont think this can work
the callback could return 0 here and 1 for the other call

also the "if (!ret)" in async_interrupt_callback() looks odd
should that be a if (ret) ?

also ff_check_interrupt() could be used in async_interrupt_callback()


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

What does censorship reveal? It reveals fear. -- Julian Assange
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150721/0052ae91/attachment.sig>


More information about the ffmpeg-devel mailing list