summaryrefslogtreecommitdiff
path: root/libavformat/matroskaenc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2019-11-01 11:49:47 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-04-21 07:31:10 +0200
commit86de864741fdc046f353a82da526445db44c4287 (patch)
treeb623eb80ded8eee53341edd1d52914c2eb659f5e /libavformat/matroskaenc.c
parent945b92873061c66b82df892887cd9baf8146857b (diff)
avformat/matroskaenc: Add check for using explicit TrackNumber
When creating DASH streams, the TrackNumber is externally prescribed and not derived from the number of streams in the AVFormatContext, so if the number of tracks for a file using an explicit TrackNumber was more than one, the resulting file would be broken (it would be impossible to tell to which track a Block belongs if different tracks share the same TrackNumber). So disallow this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r--libavformat/matroskaenc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index a65221e143..2cd5933da8 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2650,6 +2650,9 @@ static int mkv_init(struct AVFormatContext *s)
track->track_num_size = ebml_num_size(track->track_num);
}
+ if (mkv->is_dash && nb_tracks != 1)
+ return AVERROR(EINVAL);
+
return 0;
}