On 22/02/2019 13:48, Martin Storsjö wrote:
On Fri, 22 Feb 2019, Luca Barbato wrote:

---

Now with a separate option to be explicit on what is the behaviour
wanted.

libavformat/aviobuf.c | 9 +++++++--
libavformat/udp.c     | 8 ++++++++
libavformat/url.h     | 1 +
3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 98e35f776c..aa9e2fc483 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -244,8 +244,13 @@ void avio_write(AVIOContext *s, const unsigned char *buf, int size)

void avio_flush(AVIOContext *s)
{
-    flush_buffer(s);
-    s->must_flush = 0;
+    AVIOInternal *internal = s->opaque;
+    URLContext *h = internal->h;
+

No, this doesn't work. You can't assume that s->opaque exists and is an AVIOinternal struct. When AVIOContext has been allocated by avio_alloc_context, s->opaque is whatever custom pointer the caller provided.

The only place you can use AVIOInternal is within the callbacks you provide in ffio_fdopen when AVIOInternal is created.

To do this properly, you need to propagate the new value all the way into AVIOContext, just like the existing max_packet_size.

You are right, thank you for spotting this.

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

Reply via email to