mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 23:28:16 +00:00
msdkdec: no need to cache allocation_caps
This commit is contained in:
parent
d916cad886
commit
40f7001bef
2 changed files with 19 additions and 15 deletions
|
@ -542,20 +542,16 @@ gst_msdkdec_set_src_caps (GstMsdkDec * thiz, gboolean need_allocation)
|
||||||
G_TYPE_INT, height, "format", G_TYPE_STRING, format_str, NULL);
|
G_TYPE_INT, height, "format", G_TYPE_STRING, format_str, NULL);
|
||||||
GST_INFO_OBJECT (thiz, "new alloc caps = %" GST_PTR_FORMAT,
|
GST_INFO_OBJECT (thiz, "new alloc caps = %" GST_PTR_FORMAT,
|
||||||
allocation_caps);
|
allocation_caps);
|
||||||
gst_caps_replace (&thiz->allocation_caps, allocation_caps);
|
gst_caps_replace (&output_state->allocation_caps, allocation_caps);
|
||||||
|
gst_caps_unref (allocation_caps);
|
||||||
} else {
|
} else {
|
||||||
/* We keep the allocation parameters as it is to avoid pool re-negotiation.
|
/* We keep the allocation parameters as it is to avoid pool re-negotiation.
|
||||||
* For codecs like VP9, dynamic resolution change doesn't require allocation
|
* For codecs like VP9, dynamic resolution change doesn't require allocation
|
||||||
* reset if the new video frame resolution is lower than the
|
* reset if the new video frame resolution is lower than the
|
||||||
* already configured one */
|
* already configured one */
|
||||||
allocation_caps = gst_caps_copy (thiz->allocation_caps);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_caps_replace (&output_state->allocation_caps, allocation_caps);
|
|
||||||
if (allocation_caps)
|
|
||||||
gst_caps_unref (allocation_caps);
|
|
||||||
|
|
||||||
gst_video_codec_state_unref (output_state);
|
gst_video_codec_state_unref (output_state);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -947,14 +943,23 @@ gst_msdkdec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame)
|
||||||
|
|
||||||
if (!thiz->initialized)
|
if (!thiz->initialized)
|
||||||
hard_reset = TRUE;
|
hard_reset = TRUE;
|
||||||
else if (thiz->allocation_caps) {
|
else {
|
||||||
gst_video_info_from_caps (&alloc_info, thiz->allocation_caps);
|
GstVideoCodecState *output_state =
|
||||||
|
gst_video_decoder_get_output_state (GST_VIDEO_DECODER (thiz));
|
||||||
|
|
||||||
/* Check whether we need complete reset for dynamic resolution change */
|
if (output_state) {
|
||||||
if (thiz->param.mfx.FrameInfo.Width > GST_VIDEO_INFO_WIDTH (&alloc_info)
|
if (output_state->allocation_caps) {
|
||||||
|| thiz->param.mfx.FrameInfo.Height >
|
gst_video_info_from_caps (&alloc_info, output_state->allocation_caps);
|
||||||
GST_VIDEO_INFO_HEIGHT (&alloc_info))
|
|
||||||
hard_reset = TRUE;
|
/* Check whether we need complete reset for dynamic resolution change */
|
||||||
|
if (thiz->param.mfx.FrameInfo.Width >
|
||||||
|
GST_VIDEO_INFO_WIDTH (&alloc_info)
|
||||||
|
|| thiz->param.mfx.FrameInfo.Height >
|
||||||
|
GST_VIDEO_INFO_HEIGHT (&alloc_info))
|
||||||
|
hard_reset = TRUE;
|
||||||
|
}
|
||||||
|
gst_video_codec_state_unref (output_state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if subclass requested for the force reset */
|
/* if subclass requested for the force reset */
|
||||||
|
|
|
@ -67,7 +67,6 @@ struct _GstMsdkDec
|
||||||
/* aligned msdk pool info */
|
/* aligned msdk pool info */
|
||||||
GstVideoInfo output_info;
|
GstVideoInfo output_info;
|
||||||
GstBufferPool *pool;
|
GstBufferPool *pool;
|
||||||
GstCaps *allocation_caps;
|
|
||||||
/* 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;
|
||||||
|
|
Loading…
Reference in a new issue