[vlc-commits] avcodec: keep the vctx_out of the video acceleration

Steve Lhomme git at videolan.org
Fri Nov 13 16:52:29 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Nov  6 10:26:04 2020 +0100| [2a7aec4d8674a252a10109d4de773f00506f2fa2] | committer: Steve Lhomme

avcodec: keep the vctx_out of the video acceleration

We need it to call decoder_UpdateVideoOutput if the format slightly changes.

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

 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 dd2b69ebef..ecde33199b 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;



More information about the vlc-commits mailing list