aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorJames Cowgill <jcowgill@debian.org>2017-11-09 12:21:23 +0000
committerMarton Balint <cus@passwd.hu>2017-12-09 21:28:24 +0100
commit02ba4b91b5616ecbebee5c9565e1be7af2a6b980 (patch)
tree685b47b03fda3c035a1a78949613e87432bfc89d /libavcodec
parent36de24d5b7d67ab323ed41c7dc06fa0345404227 (diff)
downloadffmpeg-02ba4b91b5616ecbebee5c9565e1be7af2a6b980.tar.gz
avcodec/decode: reset codec on receiving packet after EOF in compat_decode
In commit 061a0c14bb57 ("decode: restructure the core decoding code"), the deprecated avcodec_decode_* APIs were reworked so that they called into the new avcodec_send_packet / avcodec_receive_frame API. This had the side effect of prohibiting sending new packets containing data after a drain packet, but in previous versions of FFmpeg this "worked" and some applications relied on it. To restore some compatibility, reset the codec if we receive a new non-drain packet using the old API after draining has completed. While this does not give the same behaviour as the old API did, in the majority of cases it works and it does not require changes to any other part of the decoding code. Fixes ticket #6775 Signed-off-by: James Cowgill <jcowgill@debian.org> Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/decode.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 3f5b086f7e..f67b214759 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -749,6 +749,11 @@ static int compat_decode(AVCodecContext *avctx, AVFrame *frame,
av_assert0(avci->compat_decode_consumed == 0);
+ if (avci->draining_done && pkt && pkt->size != 0) {
+ av_log(avctx, AV_LOG_WARNING, "Got unexpected packet after EOF\n");
+ avcodec_flush_buffers(avctx);
+ }
+
*got_frame = 0;
avci->compat_decode = 1;