mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
msdkdec: Decoder should use its own pool when downstream allocator is not recognizable
Msdkdec should use it own pool when the allocation from downstream query is not any msdk_allocator (i.e. msdk_video_allocator, msdk_dmabuf_allocator and msdk_system_allocator). Otherwise, when using pipeline "msdkh264dec ! vah264enc !" to transcode a not 16-bit-aligned stream (i.e. 1920x1080), the transcoding will fail due to the size mismatch issue between decoder pool and encoder pool. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2451>
This commit is contained in:
parent
e37c462f87
commit
1fe5655c2a
2 changed files with 20 additions and 6 deletions
|
@ -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;
|
||||
|
|
|
@ -76,6 +76,7 @@ struct _GstMsdkDec
|
|||
gboolean use_dmabuf;
|
||||
gboolean initialized;
|
||||
gboolean sfc;
|
||||
gboolean ds_has_no_msdk_allocator;
|
||||
|
||||
/* for packetization */
|
||||
GstAdapter *adapter;
|
||||
|
|
Loading…
Reference in a new issue