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

Submitted by Nikolas Bowe on Feb. 5, 2019, 2:11 a.m.

Details

Message ID 20190205021135.221078-1-nbowe@google.com
State New
Headers show

Commit Message

Nikolas Bowe Feb. 5, 2019, 2:11 a.m.
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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Carl Eugen Hoyos Feb. 5, 2019, 2:24 a.m.
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

Patch hide | download patch | download mbox

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 65be2968a1..ba811ddbc3 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,9 @@  static void mov_free(AVFormatContext *s)
             av_freep(&mov->tracks[i].vos_data);
 
         ff_mov_cenc_free(&mov->tracks[i].cenc);
+
+        if (mov->tracks[i].eac3_priv)
+            av_freep(&mov->tracks[i].eac3_priv);
     }
 
     av_freep(&mov->tracks);