mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-15 03:20:00 +01:00
Merge commit 'e55e8b2c362a60bad66929d83d8c83b0d7f5ffc9'
* commit 'e55e8b2c362a60bad66929d83d8c83b0d7f5ffc9': lavc: do not leak frames in avcodec_decode_audio4 Conflicts: libavcodec/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -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,
|
|||||||
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,
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user