d3d11decoder: Handle input caps change

Update output caps if it's notified by baseclass

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3328>
This commit is contained in:
Seungha Yang 2022-11-05 02:47:54 +09:00 committed by GStreamer Marge Bot
parent 2ede4011bf
commit 349f8de13e
8 changed files with 26 additions and 9 deletions

View file

@ -1225,8 +1225,9 @@ gst_d3d11_av1_dec_output_picture (GstAV1Decoder * decoder,
}
if (!gst_d3d11_decoder_process_output (inner->d3d11_decoder, vdec,
picture->frame_hdr.render_width, picture->frame_hdr.render_height,
view_buffer, &frame->output_buffer)) {
picture->discont_state, picture->frame_hdr.render_width,
picture->frame_hdr.render_height, view_buffer,
&frame->output_buffer)) {
GST_ERROR_OBJECT (self, "Failed to copy buffer");
goto error;
}

View file

@ -1592,7 +1592,8 @@ gst_d3d11_decoder_crop_and_copy_buffer (GstD3D11Decoder * self,
gboolean
gst_d3d11_decoder_process_output (GstD3D11Decoder * decoder,
GstVideoDecoder * videodec, gint display_width, gint display_height,
GstVideoDecoder * videodec, GstVideoCodecState * input_state,
gint display_width, gint display_height,
GstBuffer * decoder_buffer, GstBuffer ** output)
{
g_return_val_if_fail (GST_IS_D3D11_DECODER (decoder), FALSE);
@ -1600,6 +1601,11 @@ gst_d3d11_decoder_process_output (GstD3D11Decoder * decoder,
g_return_val_if_fail (GST_IS_BUFFER (decoder_buffer), FALSE);
g_return_val_if_fail (output != NULL, FALSE);
if (input_state) {
g_clear_pointer (&decoder->input_state, gst_video_codec_state_unref);
decoder->input_state = gst_video_codec_state_ref (input_state);
}
if (display_width != GST_VIDEO_INFO_WIDTH (&decoder->output_info) ||
display_height != GST_VIDEO_INFO_HEIGHT (&decoder->output_info)) {
GST_INFO_OBJECT (videodec, "Frame size changed, do renegotiate");
@ -1613,6 +1619,11 @@ gst_d3d11_decoder_process_output (GstD3D11Decoder * decoder,
GST_ERROR_OBJECT (videodec, "Failed to re-negotiate with new frame size");
return FALSE;
}
} else if (input_state) {
if (!gst_video_decoder_negotiate (videodec)) {
GST_ERROR_OBJECT (videodec, "Could not re-negotiate with updated state");
return FALSE;
}
}
if (gst_d3d11_decoder_can_direct_render (decoder, videodec, decoder_buffer,

View file

@ -97,6 +97,7 @@ ID3D11VideoDecoderOutputView * gst_d3d11_decoder_get_output_view_from_buffer (Gs
gboolean gst_d3d11_decoder_process_output (GstD3D11Decoder * decoder,
GstVideoDecoder * videodec,
GstVideoCodecState * in_state,
gint display_width,
gint display_height,
GstBuffer * decoder_buffer,

View file

@ -885,7 +885,8 @@ gst_d3d11_h264_dec_output_picture (GstH264Decoder * decoder,
}
if (!gst_d3d11_decoder_process_output (inner->d3d11_decoder, vdec,
inner->width, inner->height, view_buffer, &frame->output_buffer)) {
picture->discont_state, inner->width, inner->height, view_buffer,
&frame->output_buffer)) {
GST_ERROR_OBJECT (self, "Failed to copy buffer");
goto error;
}

View file

@ -933,7 +933,8 @@ gst_d3d11_h265_dec_output_picture (GstH265Decoder * decoder,
}
if (!gst_d3d11_decoder_process_output (inner->d3d11_decoder, vdec,
inner->width, inner->height, view_buffer, &frame->output_buffer)) {
picture->discont_state, inner->width, inner->height, view_buffer,
&frame->output_buffer)) {
GST_ERROR_OBJECT (self, "Failed to copy buffer");
goto error;
}

View file

@ -747,7 +747,8 @@ gst_d3d11_mpeg2_dec_output_picture (GstMpeg2Decoder * decoder,
}
if (!gst_d3d11_decoder_process_output (inner->d3d11_decoder, vdec,
inner->width, inner->height, view_buffer, &frame->output_buffer)) {
picture->discont_state, inner->width, inner->height, view_buffer,
&frame->output_buffer)) {
GST_ERROR_OBJECT (self, "Failed to copy buffer");
goto error;
}

View file

@ -645,7 +645,8 @@ gst_d3d11_vp8_dec_output_picture (GstVp8Decoder * decoder,
}
if (!gst_d3d11_decoder_process_output (inner->d3d11_decoder, vdec,
inner->width, inner->height, view_buffer, &frame->output_buffer)) {
picture->discont_state, inner->width, inner->height, view_buffer,
&frame->output_buffer)) {
GST_ERROR_OBJECT (self, "Failed to copy buffer");
goto error;
}

View file

@ -781,8 +781,8 @@ gst_d3d11_vp9_dec_output_picture (GstVp9Decoder * decoder,
}
if (!gst_d3d11_decoder_process_output (inner->d3d11_decoder, vdec,
picture->frame_hdr.width, picture->frame_hdr.height, view_buffer,
&frame->output_buffer)) {
picture->discont_state, picture->frame_hdr.width,
picture->frame_hdr.height, view_buffer, &frame->output_buffer)) {
GST_ERROR_OBJECT (self, "Failed to copy buffer");
goto error;
}