[SCM] ffmpeg/master: Add patch to workaround incorrect use of drain packets in compat decode api

jcowgill at users.alioth.debian.org jcowgill at users.alioth.debian.org
Thu Nov 9 16:35:35 UTC 2017


The following commit has been merged in the master branch:
commit 540a91862f4cb3aa4eeca2ffed8df49e4b4b5328
Author: James Cowgill <jcowgill at debian.org>
Date:   Thu Nov 9 16:10:46 2017 +0000

    Add patch to workaround incorrect use of drain packets in compat decode api
    
    Posted upstream:
    https://ffmpeg.org/pipermail/ffmpeg-devel/2017-November/219480.html
    
    Closes: #879673

diff --git a/debian/patches/0003-lavc-reset-codec-on-receiving-packet-after-EOF-in-co.patch b/debian/patches/0003-lavc-reset-codec-on-receiving-packet-after-EOF-in-co.patch
new file mode 100644
index 0000000..0ea4452
--- /dev/null
+++ b/debian/patches/0003-lavc-reset-codec-on-receiving-packet-after-EOF-in-co.patch
@@ -0,0 +1,44 @@
+From 3b888315248e53021995e6db46096616eb36a597 Mon Sep 17 00:00:00 2001
+From: James Cowgill <jcowgill at debian.org>
+Date: Thu, 9 Nov 2017 09:07:50 +0000
+Subject: [PATCH] lavc: 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 at debian.org>
+---
+ libavcodec/decode.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/libavcodec/decode.c b/libavcodec/decode.c
+index 86fe5aef52..2f1932fa85 100644
+--- a/libavcodec/decode.c
++++ b/libavcodec/decode.c
+@@ -726,6 +726,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;
+ 
+-- 
+2.15.0
+
diff --git a/debian/patches/series b/debian/patches/series
index bb700bb..7ecd120 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 0001-arm-thumb2-blx.patch
 0002-arm-Check-for-have_vfp_vm-instead-of-have_vfpv3.patch
+0003-lavc-reset-codec-on-receiving-packet-after-EOF-in-co.patch

-- 
ffmpeg packaging



More information about the pkg-multimedia-commits mailing list