[vlc-commits] avcodec: disable frame multithreading with dxva2

Felix Abecassis git at videolan.org
Tue Aug 26 00:24:43 CEST 2014


vlc/vlc-2.2 | branch: master | Felix Abecassis <felix.abecassis at gmail.com> | Mon Aug 25 12:07:22 2014 +0200| [f97a4cf8d639fe97bb82edb992f02b21179487b0] | committer: Jean-Baptiste Kempf

avcodec: disable frame multithreading with dxva2

Fix #11930, #11693

(cherry picked from commit bf9b995528941436fbdfad6e60ce7af76f20ea2e)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=f97a4cf8d639fe97bb82edb992f02b21179487b0
---

 modules/codec/avcodec/video.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 2e119d0..9169bef 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -351,6 +351,21 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
 # endif
     }
 
+    /* Workaround: frame multithreading is not compatible with
+     * DXVA2. When a frame is being copied to host memory, the frame
+     * is locked and cannot be used as a reference frame
+     * simultaneously and thus decoding fails for some frames. This
+     * causes major image corruption. */
+# if defined(_WIN32)
+    char *avcodec_hw = var_InheritString( p_dec, "avcodec-hw" );
+    if( avcodec_hw == NULL || strcasecmp( avcodec_hw, "none" ) )
+    {
+        msg_Warn( p_dec, "threaded frame decoding is not compatible with DXVA2, disabled" );
+        p_sys->p_context->thread_type &= ~FF_THREAD_FRAME;
+    }
+    free( avcodec_hw );
+# endif
+
     if( p_sys->p_context->thread_type & FF_THREAD_FRAME )
         p_dec->i_extra_picture_buffers = 2 * p_sys->p_context->thread_count;
 #endif



More information about the vlc-commits mailing list