[FFmpeg-devel] [PATCH 1/2] libavformat/mxfenc.c: Fix segfault when writing an audio packet when there has not been a video one.

Alexis Ballier aballier at gentoo.org
Fri Oct 16 10:42:32 CEST 2015


This happens when writing the trailer of a file containing audio but that has not muxed any video packet.
Fixes ticket #4817.

----

This ticket also highlights the fact that mpeg2 video encoder produces no output when it has received less frames than its delay.
---
 libavformat/mxfenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 84ce979..f9b9516 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -2451,7 +2451,7 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt)
             mxf->body_offset += KAG_SIZE; // size of system element
         }
         mxf->edit_units_count++;
-    } else if (!mxf->edit_unit_byte_count && st->index == 1) {
+    } else if (!mxf->edit_unit_byte_count && mxf->edit_units_count && st->index == 1) {
         mxf->index_entries[mxf->edit_units_count-1].slice_offset =
             mxf->body_offset - mxf->index_entries[mxf->edit_units_count-1].offset;
     }
-- 
2.6.1



More information about the ffmpeg-devel mailing list