movenc: Avoid writing separate flags for the first sample if not necessary
authorMartin Storsjö <martin@martin.st>
Fri, 6 Mar 2015 09:26:40 +0000 (11:26 +0200)
committerMartin Storsjö <martin@martin.st>
Mon, 9 Mar 2015 08:36:12 +0000 (10:36 +0200)
Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/movenc.c

index 122bc2d..67c7214 100644 (file)
@@ -2490,7 +2490,8 @@ static int mov_write_trun_tag(AVIOContext *pb, MOVMuxContext *mov,
         if (i > 0 && get_sample_flags(track, &track->cluster[i]) != track->default_sample_flags)
             flags |= MOV_TRUN_SAMPLE_FLAGS;
     }
-    if (!(flags & MOV_TRUN_SAMPLE_FLAGS))
+    if (!(flags & MOV_TRUN_SAMPLE_FLAGS) && track->entry > 0 &&
+         get_sample_flags(track, &track->cluster[0]) != track->default_sample_flags)
         flags |= MOV_TRUN_FIRST_SAMPLE_FLAGS;
     if (track->flags & MOV_TRACK_CTTS)
         flags |= MOV_TRUN_SAMPLE_CTS;