This should increase the effectiveness of ffio_ensure_seekback.

Note: increasing buffer size to non-streamed or write buffer should also
work, but they both cause fate failures... The reason for that should be
checked.

Signed-off-by: Marton Balint <c...@passwd.hu>
---
 libavformat/aviobuf.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index aa1d6c0830..13cad7f5f0 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -938,6 +938,11 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
     } else {
         buffer_size = IO_BUFFER_SIZE;
     }
+    if (h->flags & AVIO_FLAG_READ && h->is_streamed) {
+        if (buffer_size > INT_MAX/2)
+            return AVERROR(EINVAL);
+        buffer_size *= 2;
+    }
     buffer = av_malloc(buffer_size);
     if (!buffer)
         return AVERROR(ENOMEM);
-- 
2.26.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to