From: Seungha Yang Date: Fri, 4 Nov 2022 17:47:54 +0000 (+0900) Subject: d3d11decoder: Handle input caps change X-Git-Tag: 1.22.0~399 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=349f8de13ed4c7436d0fa55995b67c6ee12b59d1;p=platform%2Fupstream%2Fgstreamer.git d3d11decoder: Handle input caps change Update output caps if it's notified by baseclass Part-of: --- diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11av1dec.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11av1dec.cpp index 7c3be5e..b178361 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11av1dec.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11av1dec.cpp @@ -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; } diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11decoder.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11decoder.cpp index 765172b..c919072 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11decoder.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11decoder.cpp @@ -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, diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11decoder.h b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11decoder.h index 8b2ceb6..d1e52b7 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11decoder.h +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11decoder.h @@ -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, diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h264dec.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h264dec.cpp index 100ead5..43499ad 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h264dec.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h264dec.cpp @@ -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; } diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h265dec.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h265dec.cpp index 563fc66..67c6897 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h265dec.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h265dec.cpp @@ -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; } diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11mpeg2dec.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11mpeg2dec.cpp index 5549853..54406f7 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11mpeg2dec.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11mpeg2dec.cpp @@ -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; } diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp8dec.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp8dec.cpp index 5e1ddb4..d933b49 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp8dec.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp8dec.cpp @@ -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; } diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp9dec.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp9dec.cpp index 52efa02..444307a 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp9dec.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11vp9dec.cpp @@ -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; }