diff mbox series

[FFmpeg-devel] avformat/dv: Set AVFMTCTX_NOHEADER flag

Message ID AM7PR03MB666035C99FF4FBFF079B3BE88FC99@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 2b787ef766941a7565ac143f52d2f5954b9db6e9
Headers show
Series [FFmpeg-devel] avformat/dv: Set AVFMTCTX_NOHEADER flag | 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

Andreas Rheinhardt Aug. 28, 2021, 11:27 a.m. UTC
Audio streams are only added when a packet is read.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
The mov demuxer is different from all the other users of DV:
It does not use its main AVFormatContext for this, but a separate one.
Therefore the new audio streams are not added to the mov context
and so it does not need this flag (and it is not added for it).
But there is a problem with this approach: If there are multiple DV
audio streams included in this DV stream, the packets will all have
the same stream number.

Furthermore I don't see anything that prevents to overwrite and leak
the mov context's dv context in case multiple DV streams are present.
But I also don't have a sample showing a leak.

 libavformat/dv.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/dv.c b/libavformat/dv.c
index d7909683c3..62c20f6a00 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -343,6 +343,9 @@  static int dv_init_demux(AVFormatContext *s, DVDemuxContext *c)
     c->vst->codecpar->bit_rate   = 25000000;
     c->vst->start_time        = 0;
 
+    /* Audio streams are added later as they are encountered. */
+    s->ctx_flags |= AVFMTCTX_NOHEADER;
+
     return 0;
 }