Commit c3e58f8f authored by Rafaël Carré's avatar Rafaël Carré Committed by Anton Khirnov

matroskaenc: restore compatibility with non referenced AVPacket

Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
parent 95d52464
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment