Commit fe6a36e7 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'e55e8b2c'

* commit 'e55e8b2c':
  lavc: do not leak frames in avcodec_decode_audio4

Conflicts:
	libavcodec/utils.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 9818bbde e55e8b2c
...@@ -2085,13 +2085,6 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, ...@@ -2085,13 +2085,6 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
av_frame_set_channels(frame, avctx->channels); av_frame_set_channels(frame, avctx->channels);
if (!frame->sample_rate) if (!frame->sample_rate)
frame->sample_rate = avctx->sample_rate; frame->sample_rate = avctx->sample_rate;
if (!avctx->refcounted_frames) {
avci->to_free = *frame;
avci->to_free.extended_data = avci->to_free.data;
memset(frame->buf, 0, sizeof(frame->buf));
frame->extended_buf = NULL;
frame->nb_extended_buf = 0;
}
} }
side= av_packet_get_side_data(avctx->pkt, AV_PKT_DATA_SKIP_SAMPLES, &side_size); side= av_packet_get_side_data(avctx->pkt, AV_PKT_DATA_SKIP_SAMPLES, &side_size);
...@@ -2104,8 +2097,6 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, ...@@ -2104,8 +2097,6 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
if(frame->nb_samples <= avctx->internal->skip_samples){ if(frame->nb_samples <= avctx->internal->skip_samples){
*got_frame_ptr = 0; *got_frame_ptr = 0;
avctx->internal->skip_samples -= frame->nb_samples; avctx->internal->skip_samples -= frame->nb_samples;
if (avctx->refcounted_frames)
av_frame_unref(frame);
av_log(avctx, AV_LOG_DEBUG, "skip whole frame, skip left: %d\n", av_log(avctx, AV_LOG_DEBUG, "skip whole frame, skip left: %d\n",
avctx->internal->skip_samples); avctx->internal->skip_samples);
} else { } else {
...@@ -2138,7 +2129,15 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, ...@@ -2138,7 +2129,15 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
ret = avpkt->size; ret = avpkt->size;
} }
if (ret < 0 && frame->data[0]) if (ret >= 0 && *got_frame_ptr) {
if (!avctx->refcounted_frames) {
avci->to_free = *frame;
avci->to_free.extended_data = avci->to_free.data;
memset(frame->buf, 0, sizeof(frame->buf));
frame->extended_buf = NULL;
frame->nb_extended_buf = 0;
}
} else if (frame->data[0])
av_frame_unref(frame); av_frame_unref(frame);
} }
......
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