diff mbox series

[FFmpeg-devel,1/2] avformat/aviobuf: check if read_packet() exist before read_packet_wrapper()

Message ID 1638507433-5005-1-git-send-email-lance.lmwang@gmail.com
State Accepted
Commit 3c74ffb01ac3aa567d166362237117a6ca7c0775
Headers show
Series [FFmpeg-devel,1/2] avformat/aviobuf: check if read_packet() exist before read_packet_wrapper() | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Lance Wang Dec. 3, 2021, 4:57 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

without it, read_packet_wrapper() will return AVERROR(EINVAL) and avio_read
will be failed.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
It'll fix the issue reported by Michael in below patch:
https://patchwork.ffmpeg.org/project/ffmpeg/patch/1638441459-21819-1-git-send-email-lance.lmwang@gmail.com/

 libavformat/aviobuf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 5da4dea..14688a2 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -646,7 +646,7 @@  int avio_read(AVIOContext *s, unsigned char *buf, int size)
     while (size > 0) {
         len = FFMIN(s->buf_end - s->buf_ptr, size);
         if (len == 0 || s->write_flag) {
-            if((s->direct || size > s->buffer_size) && !s->update_checksum) {
+            if((s->direct || size > s->buffer_size) && !s->update_checksum && s->read_packet) {
                 // bypass the buffer and read data directly into buf
                 len = read_packet_wrapper(s, buf, size);
                 if (len == AVERROR_EOF) {