[vlc-commits] Disabled frame threaded decoding when ffmpeg-hw is enabled and might be used .

Laurent Aimar git at videolan.org
Sun Jun 5 16:26:06 CEST 2011


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Jun  4 22:59:49 2011 +0200| [0cc5c150ca43de1840eb14ca228a100931107b9a] | committer: Laurent Aimar

Disabled frame threaded decoding when ffmpeg-hw is enabled and might be used.

It allows to use hw decoding (whereas it was always disabled).
It workaround a bug in ffmpeg/libav.

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

 modules/codec/avcodec/video.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 38e7964..5b13a5a 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -343,13 +343,18 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
 
 #ifdef HAVE_AVCODEC_VA
     const bool b_use_hw = var_CreateGetBool( p_dec, "ffmpeg-hw" );
-    if( b_use_hw )
+    if( b_use_hw &&
+        (i_codec_id == CODEC_ID_MPEG1VIDEO || i_codec_id == CODEC_ID_MPEG2VIDEO ||
+         i_codec_id == CODEC_ID_MPEG4 ||
+         i_codec_id == CODEC_ID_H264 ||
+         i_codec_id == CODEC_ID_VC1 || i_codec_id == CODEC_ID_WMV3) )
     {
-#ifdef HAVE_AVCODEC_MT
-        msg_Err( p_dec, "ffmpeg-hw is not compatible with ffmpeg-mt" );
-#else
+        if( p_sys->p_context->thread_type & FF_THREAD_FRAME )
+        {
+            msg_Warn( p_dec, "threaded frame decoding is not compatible with ffmpeg-hw, disabled" );
+            p_sys->p_context->thread_type &= ~FF_THREAD_FRAME;
+        }
         p_sys->p_context->get_format = ffmpeg_GetFormat;
-#endif
     }
 #endif
 



More information about the vlc-commits mailing list