[vlc-devel] [PATCH] avcodec: tell the vout not to peek in the decoder pool anymore when closing

Steve Lhomme robux4 at videolabs.io
Wed Dec 20 14:26:57 CET 2017


There's still the vout->p->displayed.current picture that may be owned by the
hardware acceleration that is still not released.

--
replaces https://patches.videolan.org/patch/19207/
- make sure the decoder pool is unlocked when saving the vout for reuse
---
 modules/codec/avcodec/video.c | 5 +++++
 src/input/resource.c          | 1 +
 2 files changed, 6 insertions(+)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index b056c1b86f..44e7e6d00f 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -1245,6 +1245,11 @@ void EndVideoDec( vlc_object_t *obj )
     AVCodecContext *ctx = p_sys->p_context;
     void *hwaccel_context;
 
+    /* Abort pictures in order to unblock all avcodec workers threads waiting
+     * for a picture. This will avoid a deadlock between avcodec_flush_buffers
+     * and workers threads */
+    decoder_AbortPictures( p_dec, true );
+
     post_mt( p_sys );
 
     /* do not flush buffers if codec hasn't been opened (theora/vorbis/VC1) */
diff --git a/src/input/resource.c b/src/input/resource.c
index ac808f6e8a..cb8106ad19 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -275,6 +275,7 @@ static vout_thread_t *RequestVout( input_resource_t *p_resource,
             msg_Dbg( p_resource->p_parent, "saving a free vout" );
             vout_Flush( p_vout, 1 );
             vout_FlushSubpictureChannel( p_vout, -1 );
+            vout_Cancel( p_vout, false );
 
             vout_configuration_t cfg = {
                 .vout       = p_vout,
-- 
2.14.2



More information about the vlc-devel mailing list