[FFmpeg-cvslog] matroskaenc: restore compatibility with non referenced AVPacket

Rafaël Carré git at videolan.org
Mon Jun 24 11:32:07 CEST 2013


ffmpeg | branch: master | Rafaël Carré <funman at videolan.org> | Sun Jun 23 23:00:33 2013 +0200| [c3e58f8fb75d8467161a65b85eb88281547ebab1] | committer: Anton Khirnov

matroskaenc: restore compatibility with non referenced AVPacket

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c3e58f8fb75d8467161a65b85eb88281547ebab1
---

 libavformat/matroskaenc.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 9f7b5f9..67d2350 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1298,8 +1298,11 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
     // keyframe's timecode is contained in the same cluster for WebM
     if (codec->codec_type == AVMEDIA_TYPE_AUDIO) {
         mkv->cur_audio_pkt = *pkt;
-        mkv->cur_audio_pkt.buf = av_buffer_ref(pkt->buf);
-        ret = mkv->cur_audio_pkt.buf ? 0 : AVERROR(ENOMEM);
+        if (pkt->buf) {
+            mkv->cur_audio_pkt.buf = av_buffer_ref(pkt->buf);
+            ret = mkv->cur_audio_pkt.buf ? 0 : AVERROR(ENOMEM);
+        } else
+            ret = av_dup_packet(&mkv->cur_audio_pkt);
     } else
         ret = mkv_write_packet_internal(s, pkt);
     return ret;



More information about the ffmpeg-cvslog mailing list