va: Handle input caps change.

Update output caps if it's notified by baseclass

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3328

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3480>
This commit is contained in:
Victor Manuel Jaquez Leal 2022-11-28 20:42:29 +01:00 committed by Víctor Manuel Jáquez Leal
parent 19b83bc156
commit 4cbdf43e7d
9 changed files with 29 additions and 8 deletions

View file

@ -955,7 +955,7 @@ gst_va_av1_dec_output_picture (GstAV1Decoder * decoder,
frame->output_buffer = gst_buffer_ref (pic->gstbuffer);
}
ret = gst_va_base_dec_process_output (base, frame, 0);
ret = gst_va_base_dec_process_output (base, frame, picture->discont_state, 0);
gst_av1_picture_unref (picture);
if (ret)

View file

@ -1061,10 +1061,27 @@ fail:
gboolean
gst_va_base_dec_process_output (GstVaBaseDec * base, GstVideoCodecFrame * frame,
GstVideoBufferFlags buffer_flags)
GstVideoCodecState * input_state, GstVideoBufferFlags buffer_flags)
{
GstVideoDecoder *vdec = GST_VIDEO_DECODER (base);
if (input_state) {
g_assert (GST_VIDEO_INFO_WIDTH (&input_state->info) ==
GST_VIDEO_INFO_WIDTH (&base->input_state->info)
&& GST_VIDEO_INFO_HEIGHT (&input_state->info) ==
GST_VIDEO_INFO_HEIGHT (&input_state->info));
g_clear_pointer (&base->input_state, gst_video_codec_state_unref);
base->input_state = gst_video_codec_state_ref (input_state);
base->need_negotiation = TRUE;
if (!gst_video_decoder_negotiate (vdec)) {
GST_ERROR_OBJECT (base, "Could not re-negotiate with updated state");
return GST_FLOW_ERROR;
}
}
if (base->copy_frames)
gst_va_base_dec_copy_output_buffer (base, frame);

View file

@ -137,6 +137,7 @@ gboolean gst_va_base_dec_copy_output_buffer (GstVaBaseDec * base,
GstVideoCodecFrame * codec_frame);
gboolean gst_va_base_dec_process_output (GstVaBaseDec * base,
GstVideoCodecFrame * frame,
GstVideoCodecState * input_state,
GstVideoBufferFlags buffer_flags);
GstFlowReturn gst_va_base_dec_prepare_output_frame (GstVaBaseDec * base,
GstVideoCodecFrame * frame);

View file

@ -123,7 +123,8 @@ gst_va_h264_dec_output_picture (GstH264Decoder * decoder,
GST_LOG_OBJECT (self,
"Outputting picture %p (poc %d)", picture, picture->pic_order_cnt);
ret = gst_va_base_dec_process_output (base, frame, picture->buffer_flags);
ret = gst_va_base_dec_process_output (base, frame, picture->discont_state,
picture->buffer_flags);
gst_h264_picture_unref (picture);
if (ret)

View file

@ -240,7 +240,8 @@ gst_va_h265_dec_output_picture (GstH265Decoder * decoder,
gst_buffer_replace (&frame->output_buffer, va_pic->gstbuffer);
ret = gst_va_base_dec_process_output (base, frame, picture->buffer_flags);
ret = gst_va_base_dec_process_output (base, frame, picture->discont_state,
picture->buffer_flags);
gst_h265_picture_unref (picture);
if (ret)

View file

@ -322,7 +322,7 @@ gst_va_jpeg_dec_output_picture (GstJpegDecoder * decoder,
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
GstVideoDecoder *vdec = GST_VIDEO_DECODER (decoder);
if (gst_va_base_dec_process_output (base, frame, 0))
if (gst_va_base_dec_process_output (base, frame, NULL, 0))
return gst_video_decoder_finish_frame (vdec, frame);
return GST_FLOW_ERROR;
}

View file

@ -518,7 +518,8 @@ gst_va_mpeg2_dec_output_picture (GstMpeg2Decoder * decoder,
GST_LOG_OBJECT (self,
"Outputting picture %p (poc %d)", picture, picture->pic_order_cnt);
ret = gst_va_base_dec_process_output (base, frame, picture->buffer_flags);
ret = gst_va_base_dec_process_output (base, frame, picture->discont_state,
picture->buffer_flags);
gst_mpeg2_picture_unref (picture);
if (ret)

View file

@ -398,7 +398,7 @@ gst_va_vp8_dec_output_picture (GstVp8Decoder * decoder,
"Outputting picture %p (system_frame_number %d)",
picture, picture->system_frame_number);
ret = gst_va_base_dec_process_output (base, frame, 0);
ret = gst_va_base_dec_process_output (base, frame, picture->discont_state, 0);
gst_vp8_picture_unref (picture);
if (ret)

View file

@ -506,7 +506,7 @@ gst_va_vp9_dec_output_picture (GstVp9Decoder * decoder,
GST_LOG_OBJECT (self, "Outputting picture %p", picture);
ret = gst_va_base_dec_process_output (base, frame, 0);
ret = gst_va_base_dec_process_output (base, frame, picture->discont_state, 0);
gst_vp9_picture_unref (picture);
if (ret)