diff --git a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12decoder.cpp b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12decoder.cpp index c283b39bd8..4cb30c4daa 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12decoder.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12decoder.cpp @@ -915,6 +915,34 @@ gst_d3d12_decoder_new_picture (GstD3D12Decoder * decoder, return GST_FLOW_OK; } +GstFlowReturn +gst_d3d12_decoder_new_picture_with_size (GstD3D12Decoder * decoder, + GstVideoDecoder * videodec, GstCodecPicture * picture, guint width, + guint height) +{ + g_return_val_if_fail (GST_IS_D3D12_DECODER (decoder), GST_FLOW_ERROR); + g_return_val_if_fail (GST_IS_VIDEO_DECODER (videodec), GST_FLOW_ERROR); + g_return_val_if_fail (picture != nullptr, GST_FLOW_ERROR); + + auto priv = decoder->priv; + if (!priv->session) { + GST_ERROR_OBJECT (decoder, "No session configured"); + return GST_FLOW_ERROR; + } + + if (priv->session->coded_width >= width && + priv->session->coded_height >= height) { + return gst_d3d12_decoder_new_picture (decoder, videodec, picture); + } + + /* FIXME: D3D12_VIDEO_DECODE_CONFIGURATION_FLAG_ALLOW_RESOLUTION_CHANGE_ON_NON_KEY_FRAME + * supported GPU can decode stream with mixed decoder heap */ + GST_ERROR_OBJECT (decoder, + "Non-keyframe resolution change with larger size is not supported"); + + return GST_FLOW_ERROR; +} + static inline GstD3D12DecoderPicture * get_decoder_picture (GstCodecPicture * picture) { diff --git a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12decoder.h b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12decoder.h index 09f975f655..f9788a5301 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12decoder.h +++ b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12decoder.h @@ -130,6 +130,12 @@ GstFlowReturn gst_d3d12_decoder_new_picture (GstD3D12Decoder * decoder, GstVideoDecoder * videodec, GstCodecPicture * picture); +GstFlowReturn gst_d3d12_decoder_new_picture_with_size (GstD3D12Decoder * decoder, + GstVideoDecoder * videodec, + GstCodecPicture * picture, + guint width, + guint height); + GstFlowReturn gst_d3d12_decoder_duplicate_picture (GstD3D12Decoder * decoder, GstCodecPicture * src, GstCodecPicture * dst); diff --git a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12vp9dec.cpp b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12vp9dec.cpp index fb1d7d866d..86e57258ca 100644 --- a/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12vp9dec.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d12/gstd3d12vp9dec.cpp @@ -266,9 +266,11 @@ gst_d3d12_vp9_dec_new_picture (GstDxvaVp9Decoder * decoder, GstCodecPicture * picture) { auto self = GST_D3D12_VP9_DEC (decoder); + auto vp9pic = GST_VP9_PICTURE (picture); - return gst_d3d12_decoder_new_picture (self->decoder, - GST_VIDEO_DECODER (decoder), picture); + return gst_d3d12_decoder_new_picture_with_size (self->decoder, + GST_VIDEO_DECODER (decoder), picture, vp9pic->frame_hdr.width, + vp9pic->frame_hdr.height); } static GstFlowReturn