vlc | branch: master | Steve Lhomme <[email protected]> | Wed Nov 13 16:32:14 2019 +0100| [3299d341817a46abb54988cc9e1e29ab69151f4f] | committer: Steve Lhomme
vaapi: set the video context in the picture context > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3299d341817a46abb54988cc9e1e29ab69151f4f --- modules/codec/avcodec/vaapi.c | 3 ++- modules/hw/vaapi/vlc_vaapi.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c index 5a5c86cff9..afe77d97c3 100644 --- a/modules/codec/avcodec/vaapi.c +++ b/modules/codec/avcodec/vaapi.c @@ -145,6 +145,7 @@ static picture_context_t *vaapi_dec_pic_context_copy(picture_context_t *src) if (unlikely(pic_ctx == NULL)) return NULL; *pic_ctx = *src_ctx; + vlc_video_context_Hold(pic_ctx->ctx.s.vctx); va_surface_AddRef(pic_ctx->va_surface); return &pic_ctx->ctx.s; } @@ -163,7 +164,7 @@ static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data) } vaapi_ctx->ctx.s = (picture_context_t) { vaapi_dec_pic_context_destroy, vaapi_dec_pic_context_copy, - NULL /*TODO*/ + sys->vctx, }; vaapi_ctx->ctx.surface = sys->render_targets[va_surface_GetIndex(va_surface)]; vaapi_ctx->ctx.va_dpy = sys->hw_ctx.display; diff --git a/modules/hw/vaapi/vlc_vaapi.c b/modules/hw/vaapi/vlc_vaapi.c index 6270271b57..c2d63baacd 100644 --- a/modules/hw/vaapi/vlc_vaapi.c +++ b/modules/hw/vaapi/vlc_vaapi.c @@ -454,6 +454,7 @@ pic_ctx_copy_cb(struct picture_context_t *opaque) return NULL; *dst_ctx = *src_ctx; + vlc_video_context_Hold(dst_ctx->ctx.s.vctx); dst_ctx->ctx.s.destroy = pic_ctx_destroy_cb; picture_Hold(dst_ctx->picref); return &dst_ctx->ctx.s; @@ -508,7 +509,7 @@ vlc_vaapi_PoolNew(vlc_object_t *o, vlc_video_context *vctx, p_sys->instance = instance; p_sys->ctx.ctx.s = (picture_context_t) { pic_sys_ctx_destroy_cb, pic_ctx_copy_cb, - NULL /*TODO*/ + vctx, // it will be held during PicSetContext }; p_sys->ctx.ctx.surface = instance->render_targets[i]; p_sys->ctx.ctx.va_dpy = dpy; @@ -569,6 +570,7 @@ vlc_vaapi_PicSetContext(picture_t *pic, struct vaapi_pic_context *vaapi_ctx) assert(pic->context == NULL); pic->context = &vaapi_ctx->s; + vlc_video_context_Hold(vaapi_ctx->s.vctx); } void _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
