Message ID | 20220919052239.2080-1-gsun@roblox.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel] lavf/async: Fix wrapped_url_read return value | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
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@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.
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; } static int ring_write(RingBuffer *ring, URLContext *h, size_t size)
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@roblox.com> --- libavformat/async.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)