[03/10] movenc: Require samples before trying to write edts

Message ID 1415365019-26521-3-git-send-email-martin@martin.st
State Committed
Commit 9a5ac36b69ede4563e9ecd734141b12ea3280fbc
Headers show

Commit Message

Martin Storsjö Nov. 7, 2014, 12:56 p.m.
This avoids a potential crash if writing a fragmented psp mp4
(which probably is only a hypothetical scenario).
---
 libavformat/movenc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Luca Barbato Nov. 7, 2014, 1:55 p.m. | #1
On 07/11/14 13:56, Martin Storsjö wrote:
> This avoids a potential crash if writing a fragmented psp mp4
> (which probably is only a hypothetical scenario).
> ---
>   libavformat/movenc.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>


Ok

Patch

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index bb1dc8a..fa5fdad 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1771,9 +1771,9 @@  static int mov_write_trak_tag(AVIOContext *pb, MOVMuxContext *mov,
     avio_wb32(pb, 0); /* size */
     ffio_wfourcc(pb, "trak");
     mov_write_tkhd_tag(pb, mov, track, st);
-    if (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS ||
-        (track->entry && track->cluster[0].dts) ||
-        is_clcp_track(track)) {
+    if (track->entry &&
+        (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS ||
+        track->cluster[0].dts || is_clcp_track(track))) {
         if (mov->use_editlist)
             mov_write_edts_tag(pb, mov, track);  // PSP Movies require edts box
         else if ((track->entry && track->cluster[0].dts) || track->mode == MODE_PSP || is_clcp_track(track))