summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGyan Doshi <[email protected]>2025-05-26 18:12:58 +0530
committerGyan Doshi <[email protected]>2025-05-26 22:44:17 +0530
commitc79bce92b8407199b6e70205393411650e4342ca (patch)
tree99855e316cee6717c0397a94a0b45f452895692c
parenteda0ac7e5f09e179bcdc946ddef543e8c44a4792 (diff)
avformat/movenc: disallow buggy flags combination
Use of hybrid_fragmented and faststart together can result in files with loss of sync and bitstream parsing errors upon playback.
-rw-r--r--libavformat/movenc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 4bc8bd1b2a..9392ba5370 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -7731,6 +7731,12 @@ static int mov_init(AVFormatContext *s)
FF_MOV_FLAG_FRAG_EVERY_FRAME))
mov->flags |= FF_MOV_FLAG_FRAGMENT;
+ if (mov->flags & FF_MOV_FLAG_HYBRID_FRAGMENTED &&
+ mov->flags & FF_MOV_FLAG_FASTSTART) {
+ av_log(s, AV_LOG_ERROR, "Setting both hybrid_fragmented and faststart is not supported.\n");
+ return AVERROR(EINVAL);
+ }
+
/* Set other implicit flags immediately */
if (mov->flags & FF_MOV_FLAG_HYBRID_FRAGMENTED)
mov->flags |= FF_MOV_FLAG_FRAGMENT;