[vlc-devel] [PATCH 1/2] avcodec: keep the vctx_out of the video acceleration

Steve Lhomme robux4 at ycbcr.xyz
Fri Nov 6 10:33:29 CET 2020


We need it to call decoder_UpdateVideoOutput if the format slightly changes.
---
 modules/codec/avcodec/video.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index dd2b69ebef2..ecde33199bc 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -106,6 +106,7 @@ typedef struct
     enum PixelFormat pix_fmt;
     int profile;
     int level;
+    vlc_video_context *vctx_out;
 
     // decoder output seen by lavc, regardless of texture padding
     unsigned decoder_width;
@@ -1288,7 +1289,11 @@ void EndVideoDec( vlc_object_t *obj )
     avcodec_free_context( &ctx );
 
     if( p_sys->p_va )
+    {
         vlc_va_Delete( p_sys->p_va );
+        vlc_video_context_Release( p_sys->vctx_out );
+        p_sys->vctx_out = NULL;
+    }
 
     free( p_sys );
 }
@@ -1588,6 +1593,8 @@ no_reuse:
         msg_Err(p_dec, "existing hardware acceleration cannot be reused");
         vlc_va_Delete(p_sys->p_va);
         p_sys->p_va = NULL;
+        vlc_video_context_Release( p_sys->vctx_out );
+        p_sys->vctx_out = NULL;
         p_context->hwaccel_context = NULL;
     }
 
@@ -1669,6 +1676,7 @@ no_reuse:
         }
 
         p_sys->p_va = va;
+        p_sys->vctx_out = vlc_video_context_Hold( vctx_out );
         p_sys->pix_fmt = hwfmt;
         vlc_mutex_unlock(&p_sys->lock);
         return hwfmt;
-- 
2.26.2



More information about the vlc-devel mailing list