[FFmpeg-devel] [PATCH 2/3] retry_transfer_wrapper: check url_interrupt_cb at the end.

Ronald S. Bultje rsbultje
Sat Mar 5 04:32:59 CET 2011


Hi,

On Fri, Mar 4, 2011 at 5:43 PM, Luca Barbato <lu_zero at gentoo.org> wrote:
> From: Nicolas George <nicolas.george at normalesup.org>
>
> Checking it too early causes ffmpeg to fail to write the trailer of its
> output files if it was interrupted with the 'q' keystroke.
>
> Note that when a protocol is interrupted by url_interrupt_cb, some data may
> be silently discarded: the protocol context is not suitable for anything
> anymore.
>
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
> ?libavformat/avio.c | ? ?2 ++
> ?1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/libavformat/avio.c b/libavformat/avio.c
> index cf07c6d..48f591b 100644
> --- a/libavformat/avio.c
> +++ b/libavformat/avio.c
> @@ -230,6 +230,8 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
> ? ? ? ? if (ret)
> ? ? ? ? ? ?fast_retries = FFMAX(fast_retries, 2);
> ? ? ? ? len += ret;
> + ? ? ? ?if (url_interrupt_cb())
> + ? ? ? ? ? ?return AVERROR(EINTR);
> ? ? }
> ? ? return len;
> ?}
> --
> 1.7.4.1

This (and the previous one) is probably OK, I'd even merge them
because you're temporarily breaking TCP support by only applying #1.

Ronald



More information about the ffmpeg-devel mailing list