msdkdec: delete use_video_memory

Since msdkdec uses video pool as the output buffer pool at all time. The
use_video_memory variable is not useful anymore. Now delete it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4088>
This commit is contained in:
Tong Wu 2022-11-24 11:12:14 +08:00 committed by GStreamer Marge Bot
parent 8105d2044d
commit ebc9780c5f
2 changed files with 16 additions and 32 deletions

View file

@ -276,7 +276,6 @@ gst_msdkdec_close_decoder (GstMsdkDec * thiz, gboolean reset_param)
GST_DEBUG_OBJECT (thiz, "Closing decoder with context %" GST_PTR_FORMAT, GST_DEBUG_OBJECT (thiz, "Closing decoder with context %" GST_PTR_FORMAT,
thiz->context); thiz->context);
if (thiz->use_video_memory)
gst_msdk_frame_free (thiz->context, &thiz->alloc_resp); gst_msdk_frame_free (thiz->context, &thiz->alloc_resp);
status = MFXVideoDECODE_Close (gst_msdk_context_get_session (thiz->context)); status = MFXVideoDECODE_Close (gst_msdk_context_get_session (thiz->context));
@ -336,6 +335,7 @@ gst_msdkdec_init_decoder (GstMsdkDec * thiz)
mfxSession session; mfxSession session;
mfxStatus status; mfxStatus status;
mfxFrameAllocRequest request; mfxFrameAllocRequest request;
gint shared_async_depth;
#if (MFX_VERSION >= 1022) #if (MFX_VERSION >= 1022)
mfxExtDecVideoProcessing ext_dec_video_proc; mfxExtDecVideoProcessing ext_dec_video_proc;
#endif #endif
@ -360,15 +360,8 @@ gst_msdkdec_init_decoder (GstMsdkDec * thiz)
GST_OBJECT_LOCK (thiz); GST_OBJECT_LOCK (thiz);
if (thiz->use_video_memory) {
gst_msdk_set_frame_allocator (thiz->context); gst_msdk_set_frame_allocator (thiz->context);
thiz->param.IOPattern = MFX_IOPATTERN_OUT_VIDEO_MEMORY; thiz->param.IOPattern = MFX_IOPATTERN_OUT_VIDEO_MEMORY;
} else {
thiz->param.IOPattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
}
GST_INFO_OBJECT (thiz, "This MSDK decoder uses %s memory",
thiz->use_video_memory ? "video" : "system");
thiz->param.AsyncDepth = thiz->async_depth; thiz->param.AsyncDepth = thiz->async_depth;
@ -468,11 +461,7 @@ gst_msdkdec_init_decoder (GstMsdkDec * thiz)
"Allocating resources without considering the downstream requirement" "Allocating resources without considering the downstream requirement"
"or extra scratch surface count"); "or extra scratch surface count");
if (thiz->use_video_memory) { shared_async_depth = gst_msdk_context_get_shared_async_depth (thiz->context);
gint shared_async_depth;
shared_async_depth =
gst_msdk_context_get_shared_async_depth (thiz->context);
request.NumFrameSuggested += shared_async_depth; request.NumFrameSuggested += shared_async_depth;
request.Type |= MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET; request.Type |= MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET;
@ -487,7 +476,6 @@ gst_msdkdec_init_decoder (GstMsdkDec * thiz)
gst_msdk_frame_alloc (thiz->context, &request, &thiz->alloc_resp); gst_msdk_frame_alloc (thiz->context, &request, &thiz->alloc_resp);
thiz->alloc_pool = gst_msdk_context_get_alloc_pool (thiz->context); thiz->alloc_pool = gst_msdk_context_get_alloc_pool (thiz->context);
}
/* update the prealloc_buffer count, which will be used later /* update the prealloc_buffer count, which will be used later
* as GstBufferPool min_buffers */ * as GstBufferPool min_buffers */
@ -1024,8 +1012,6 @@ gst_msdkdec_context_prepare (GstMsdkDec * thiz)
return TRUE; return TRUE;
} }
thiz->use_video_memory = TRUE;
GST_INFO_OBJECT (thiz, "Found context %" GST_PTR_FORMAT " from neighbour", GST_INFO_OBJECT (thiz, "Found context %" GST_PTR_FORMAT " from neighbour",
thiz->context); thiz->context);
@ -1754,7 +1740,7 @@ gst_msdkdec_create_buffer_pool (GstMsdkDec * thiz, GstVideoInfo * info,
gst_msdk_set_video_alignment (&vinfo, 0, 0, &align); gst_msdk_set_video_alignment (&vinfo, 0, 0, &align);
gst_video_info_align (&vinfo, &align); gst_video_info_align (&vinfo, &align);
if (thiz->do_copy || !thiz->use_video_memory) if (thiz->do_copy)
pool = gst_video_buffer_pool_new (); pool = gst_video_buffer_pool_new ();
else { else {
#ifndef _WIN32 #ifndef _WIN32
@ -2301,5 +2287,4 @@ gst_msdkdec_init (GstMsdkDec * thiz)
thiz->input_state = NULL; thiz->input_state = NULL;
thiz->pool = NULL; thiz->pool = NULL;
thiz->context = NULL; thiz->context = NULL;
thiz->use_video_memory = TRUE;
} }

View file

@ -74,7 +74,6 @@ struct _GstMsdkDec
/* downstream pool info based on allocation query */ /* downstream pool info based on allocation query */
GstVideoInfo non_msdk_pool_info; GstVideoInfo non_msdk_pool_info;
mfxFrameAllocResponse alloc_resp; mfxFrameAllocResponse alloc_resp;
gboolean use_video_memory;
gboolean use_dmabuf; gboolean use_dmabuf;
gboolean do_copy; gboolean do_copy;
gboolean initialized; gboolean initialized;