[libav-devel] [PATCH] avio: Do not flush the buffer if a constant packet size is requested

Luca Barbato lu_zero at gentoo.org
Thu Jan 31 12:30:38 CET 2019


---
 libavformat/aviobuf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 98e35f776c..3c882d6bdb 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -244,7 +244,8 @@ void avio_write(AVIOContext *s, const unsigned char *buf, int size)
 
 void avio_flush(AVIOContext *s)
 {
-    flush_buffer(s);
+    if (!s->max_packet_size || s->buf_ptr - s->buffer >= s->max_packet_size)
+        flush_buffer(s);
     s->must_flush = 0;
 }
 
-- 
2.12.2



More information about the libav-devel mailing list