mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Fix side-data memleak also for audio.
This uses the same code as in decode_video also in decode_audio. Should fix valgrind FATE failures for nellymoser encode test. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
This commit is contained in:
parent
cb93946820
commit
069cf86d32
@ -3856,7 +3856,7 @@ attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *s
|
|||||||
* AVPacket is returned.
|
* AVPacket is returned.
|
||||||
*/
|
*/
|
||||||
int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
|
int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
|
||||||
int *got_frame_ptr, AVPacket *avpkt);
|
int *got_frame_ptr, const AVPacket *avpkt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decode the video frame of size avpkt->size from avpkt->data into picture.
|
* Decode the video frame of size avpkt->size from avpkt->data into picture.
|
||||||
|
@ -1508,7 +1508,7 @@ int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *sa
|
|||||||
int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
|
int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
|
||||||
AVFrame *frame,
|
AVFrame *frame,
|
||||||
int *got_frame_ptr,
|
int *got_frame_ptr,
|
||||||
AVPacket *avpkt)
|
const AVPacket *avpkt)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
@ -1524,17 +1524,23 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size) {
|
if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size) {
|
||||||
av_packet_split_side_data(avpkt);
|
// copy to ensure we do not change avpkt
|
||||||
apply_param_change(avctx, avpkt);
|
AVPacket tmp = *avpkt;
|
||||||
|
int did_split = av_packet_split_side_data(&tmp);
|
||||||
|
apply_param_change(avctx, &tmp);
|
||||||
|
|
||||||
avctx->pkt = avpkt;
|
avctx->pkt = &tmp;
|
||||||
ret = avctx->codec->decode(avctx, frame, got_frame_ptr, avpkt);
|
ret = avctx->codec->decode(avctx, frame, got_frame_ptr, &tmp);
|
||||||
if (ret >= 0 && *got_frame_ptr) {
|
if (ret >= 0 && *got_frame_ptr) {
|
||||||
avctx->frame_number++;
|
avctx->frame_number++;
|
||||||
frame->pkt_dts = avpkt->dts;
|
frame->pkt_dts = avpkt->dts;
|
||||||
if (frame->format == AV_SAMPLE_FMT_NONE)
|
if (frame->format == AV_SAMPLE_FMT_NONE)
|
||||||
frame->format = avctx->sample_fmt;
|
frame->format = avctx->sample_fmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
avctx->pkt = NULL;
|
||||||
|
if (did_split)
|
||||||
|
ff_packet_free_side_data(&tmp);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user