d3d12vp9dec: Disallow resolution change to larger size on non-keyframe

Intel GPU seems to be crashing if the case happens.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6717>
This commit is contained in:
Seungha Yang 2024-04-22 21:52:53 +09:00 committed by Backport Bot
parent b02f41441c
commit e102560883
3 changed files with 38 additions and 2 deletions

View file

@ -898,6 +898,34 @@ gst_d3d12_decoder_new_picture (GstD3D12Decoder * decoder,
return GST_FLOW_OK; 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 * static inline GstD3D12DecoderPicture *
get_decoder_picture (GstCodecPicture * picture) get_decoder_picture (GstCodecPicture * picture)
{ {

View file

@ -130,6 +130,12 @@ GstFlowReturn gst_d3d12_decoder_new_picture (GstD3D12Decoder * decoder,
GstVideoDecoder * videodec, GstVideoDecoder * videodec,
GstCodecPicture * picture); 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, GstFlowReturn gst_d3d12_decoder_duplicate_picture (GstD3D12Decoder * decoder,
GstCodecPicture * src, GstCodecPicture * src,
GstCodecPicture * dst); GstCodecPicture * dst);

View file

@ -266,9 +266,11 @@ gst_d3d12_vp9_dec_new_picture (GstDxvaVp9Decoder * decoder,
GstCodecPicture * picture) GstCodecPicture * picture)
{ {
auto self = GST_D3D12_VP9_DEC (decoder); auto self = GST_D3D12_VP9_DEC (decoder);
auto vp9pic = GST_VP9_PICTURE (picture);
return gst_d3d12_decoder_new_picture (self->decoder, return gst_d3d12_decoder_new_picture_with_size (self->decoder,
GST_VIDEO_DECODER (decoder), picture); GST_VIDEO_DECODER (decoder), picture, vp9pic->frame_hdr.width,
vp9pic->frame_hdr.height);
} }
static GstFlowReturn static GstFlowReturn