[FFmpeg-devel] avformat/movenc: Fix muxing EAC3 with delay_moov

Submitted by Nikolas Bowe on Feb. 6, 2019, 12:33 a.m.

Details

Message ID CANCrOAmEn+e8VrggrxkDRQ2L5e9evSnhpqm_M8NsgOBDcXBBEg@mail.gmail.com
State New
Headers show

Commit Message

Nikolas Bowe Feb. 6, 2019, 12:33 a.m.
Hi Carl.
You are of course correct.
Attached replacement patch.


On Mon, Feb 4, 2019 at 6:24 PM Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:

> 2019-02-05 3:11 GMT+01:00, Nikolas Bowe <nbowe-at-google.com@ffmpeg.org>:
>
> > +        if (mov->tracks[i].eac3_priv)
> > +            av_freep(&mov->tracks[i].eac3_priv);
>
> I would have expected that the if() is unneeded, no?
>
> Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Patch hide | download patch | download mbox

From ebb9c55a6f11d70e16dca4dd3d05ae36fb5737b6 Mon Sep 17 00:00:00 2001
From: Nikolas Bowe <nbowe@google.com>
Date: Mon, 4 Feb 2019 17:31:08 -0800
Subject: [PATCH] avformat/movenc: Fix muxing EAC3 with delay_moov

You are of course correct

When using delay_moov mov_write_moov_tag gets called multiple times. Therefore we need to keep eac3_priv around for subsequent calls.

Signed-off-by: Nikolas Bowe <nbowe@google.com>
---
 libavformat/movenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 65be2968a1..00ad318943 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -579,7 +579,6 @@  static int mov_write_eac3_tag(AVIOContext *pb, MOVTrack *track)
 
 end:
     av_packet_unref(&info->pkt);
-    av_freep(&track->eac3_priv);
 
     return size;
 }
@@ -5956,6 +5955,7 @@  static void mov_free(AVFormatContext *s)
             av_freep(&mov->tracks[i].vos_data);
 
         ff_mov_cenc_free(&mov->tracks[i].cenc);
+        av_freep(&mov->tracks[i].eac3_priv);
     }
 
     av_freep(&mov->tracks);
-- 
2.20.1.611.gfbb209baf1-goog