[vlc-devel] [PATCH] avcodec: allocate one additional hardware surface for MPEG-2

Felix Abecassis felix.abecassis at gmail.com
Wed Mar 5 16:53:19 CET 2014


Required to avoid visual glitches when running out of free surfaces
with avcodec and vaapi/dxva2 backends.
---
 modules/codec/avcodec/dxva2.c | 4 ++++
 modules/codec/avcodec/vaapi.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index f3a1524..85d6f4a 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -865,6 +865,10 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va,
     case AV_CODEC_ID_H264:
         surface_count = 16 + va->thread_count + 2;
         break;
+    case AV_CODEC_ID_MPEG1VIDEO:
+    case AV_CODEC_ID_MPEG2VIDEO:
+        surface_count = 2 + 2;
+        break;
     default:
         surface_count = 2 + 1;
         break;
diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index 14fc83d..88023f3 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -113,7 +113,7 @@ static int Open( vlc_va_t *va, int i_codec_id, int i_thread_count )
     case AV_CODEC_ID_MPEG1VIDEO:
     case AV_CODEC_ID_MPEG2VIDEO:
         i_profile = VAProfileMPEG2Main;
-        i_surface_count = 2+1;
+        i_surface_count = 2 + 2;
         break;
     case AV_CODEC_ID_MPEG4:
         i_profile = VAProfileMPEG4AdvancedSimple;
-- 
1.8.3.2




More information about the vlc-devel mailing list