diff options
author | Rafaël Carré <funman@videolan.org> | 2013-06-23 23:00:33 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-06-24 08:03:26 +0200 |
commit | c3e58f8fb75d8467161a65b85eb88281547ebab1 (patch) | |
tree | a14296ed0a6f2dc3bafdf23e8c9dc9a69494238f /libavformat/matroskaenc.c | |
parent | 95d52464542f532061290192518d5fe1c1930e8d (diff) | |
download | ffmpeg-c3e58f8fb75d8467161a65b85eb88281547ebab1.tar.gz |
matroskaenc: restore compatibility with non referenced AVPacket
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r-- | libavformat/matroskaenc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 9f7b5f9b52..67d2350afa 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; |