diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-10-11 17:36:41 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2021-10-28 10:30:18 +0200 |
commit | e84c83ef982042b4441b517a8f23d8427f2b5494 (patch) | |
tree | 6f48cce691215437044ad25258b657dca68e8265 /libavcodec/binkaudio.c | |
parent | f8790ad002886a210d6cd33b96c3502b64f317e8 (diff) | |
download | ffmpeg-e84c83ef982042b4441b517a8f23d8427f2b5494.tar.gz |
avcodec/binkaudio: Properly flush the decoder
The packets delivered to this decoder are often decoded to more than
one frame and if the internal buffer packet is not unreferenced,
the decoder will still output frames derived from the old packet (from
before the flush).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/binkaudio.c')
-rw-r--r-- | libavcodec/binkaudio.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index 5915ba6ffb..59ecab25c6 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -337,6 +337,14 @@ fail: return ret; } +static void decode_flush(AVCodecContext *avctx) +{ + BinkAudioContext *const s = avctx->priv_data; + + av_packet_unref(s->pkt); + s->first = 1; +} + const AVCodec ff_binkaudio_rdft_decoder = { .name = "binkaudio_rdft", .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (RDFT)"), @@ -344,6 +352,7 @@ const AVCodec ff_binkaudio_rdft_decoder = { .id = AV_CODEC_ID_BINKAUDIO_RDFT, .priv_data_size = sizeof(BinkAudioContext), .init = decode_init, + .flush = decode_flush, .close = decode_end, .receive_frame = binkaudio_receive_frame, .capabilities = AV_CODEC_CAP_DR1, @@ -357,6 +366,7 @@ const AVCodec ff_binkaudio_dct_decoder = { .id = AV_CODEC_ID_BINKAUDIO_DCT, .priv_data_size = sizeof(BinkAudioContext), .init = decode_init, + .flush = decode_flush, .close = decode_end, .receive_frame = binkaudio_receive_frame, .capabilities = AV_CODEC_CAP_DR1, |