diff --git a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkdec.c b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkdec.c index 8700d6e08f..e116da6bfc 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkdec.c +++ b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkdec.c @@ -1674,6 +1674,7 @@ gst_msdkdec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query) GstStructure *pool_config = NULL; GstCaps *pool_caps /*, *negotiated_caps */ ; guint size, min_buffers, max_buffers; + GstAllocator *allocator = NULL; if (!thiz->param.mfx.FrameInfo.Width || !thiz->param.mfx.FrameInfo.Height) return FALSE; @@ -1734,15 +1735,26 @@ gst_msdkdec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query) } } - if (gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL) - && gst_buffer_pool_has_option (pool, - GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT)) { + + if (gst_query_get_n_allocation_params (query) > 0) { + gst_query_parse_nth_allocation_param (query, 0, &allocator, NULL); + if (!(GST_IS_MSDK_VIDEO_ALLOCATOR (allocator) || + GST_IS_MSDK_DMABUF_ALLOCATOR (allocator) || + GST_IS_MSDK_SYSTEM_ALLOCATOR (allocator))) + thiz->ds_has_no_msdk_allocator = TRUE; + } + + /* If downstream supports video meta and video alignment, + * or downstream doesn't have msdk_allocator, we can replace + * with our own msdk bufferpool and use it. + */ + if ((gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL) + && gst_buffer_pool_has_option + (pool, GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT)) + || thiz->ds_has_no_msdk_allocator) { GstStructure *config; GstAllocator *allocator; - /* If downstream supports video meta and video alignment, - * we can replace with our own msdk bufferpool and use it - */ /* Remove downstream's pool */ gst_structure_free (pool_config); gst_object_unref (pool); @@ -2139,6 +2151,7 @@ gst_msdkdec_init (GstMsdkDec * thiz) thiz->force_reset_on_res_change = TRUE; thiz->report_error = FALSE; thiz->sfc = FALSE; + thiz->ds_has_no_msdk_allocator = FALSE; thiz->adapter = gst_adapter_new (); thiz->input_state = NULL; thiz->pool = NULL; diff --git a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkdec.h b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkdec.h index ce07a088e8..39f877fe7b 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkdec.h +++ b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkdec.h @@ -76,6 +76,7 @@ struct _GstMsdkDec gboolean use_dmabuf; gboolean initialized; gboolean sfc; + gboolean ds_has_no_msdk_allocator; /* for packetization */ GstAdapter *adapter;