[FFmpeg-devel] [PATCH] lavf/async: Fix wrapped_url_read return value

Anton Khirnov anton at khirnov.net
Wed Sep 28 17:08:42 EEST 2022


Quoting Guangyu Sun (2022-09-19 07:22:39)
> This fixes a regression from commit 36117968ad.
> 
> wrapped_url_read() used to be able to return positive number from
> ffurl_read(). It relies on the result to check if EOF is reached in
> async_buffer_task().
> 
> Test case:
>   ffmpeg -f lavfi -i testsrc -t 1 test.mp4
>   ffmpeg -i async:test.mp4
> 
> Signed-off-by: Guangyu Sun <gsun at roblox.com>
> ---
>  libavformat/async.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/async.c b/libavformat/async.c
> index 547417aa1e..a929f4d16e 100644
> --- a/libavformat/async.c
> +++ b/libavformat/async.c
> @@ -139,7 +139,7 @@ static int wrapped_url_read(void *src, void *dst, size_t *size)
>      *size             = ret > 0 ? ret : 0;
>      c->inner_io_error = ret < 0 ? ret : 0;
>  
> -    return c->inner_io_error;
> +    return ret;

This is wrong, FIFO callbacks must return 0 on success. This should be
handled in ring_write() instead.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list