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

2019-02-02 Thread Luca Barbato

On 31/01/2019 12:34, Martin Storsjö wrote:

On Thu, 31 Jan 2019, Luca Barbato wrote:


---
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


You're not providing any explanation to why we should do this. And I'm 
fairly sure that this patch breaks the RTP muxer when sending over plain 
UDP.




I'll check if does, and update the v2 again.

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

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

2019-01-31 Thread Martin Storsjö

On Thu, 31 Jan 2019, Luca Barbato wrote:


---
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


You're not providing any explanation to why we should do this. And I'm 
fairly sure that this patch breaks the RTP muxer when sending over plain 
UDP.


// Martin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

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

2019-01-31 Thread Luca Barbato
---
 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

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel