nvdecoder: 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 21:06:39 +09:00 committed by GStreamer Marge Bot
parent b4c19a96b7
commit 0e4c520cf3
7 changed files with 20 additions and 11 deletions

View file

@ -863,8 +863,8 @@ gst_nv_av1_dec_output_picture (GstAV1Decoder * decoder,
goto error; goto error;
} }
if (!gst_nv_decoder_finish_frame (self->decoder, vdec, decoder_frame, if (!gst_nv_decoder_finish_frame (self->decoder, vdec, picture->discont_state,
&frame->output_buffer)) { decoder_frame, &frame->output_buffer)) {
GST_ERROR_OBJECT (self, "Failed to handle output picture"); GST_ERROR_OBJECT (self, "Failed to handle output picture");
goto error; goto error;
} }

View file

@ -819,7 +819,8 @@ done:
gboolean gboolean
gst_nv_decoder_finish_frame (GstNvDecoder * decoder, GstVideoDecoder * videodec, gst_nv_decoder_finish_frame (GstNvDecoder * decoder, GstVideoDecoder * videodec,
GstNvDecoderFrame * frame, GstBuffer ** buffer) GstVideoCodecState * input_state, GstNvDecoderFrame * frame,
GstBuffer ** buffer)
{ {
GstBuffer *outbuf = NULL; GstBuffer *outbuf = NULL;
gboolean ret = FALSE; gboolean ret = FALSE;
@ -829,6 +830,13 @@ gst_nv_decoder_finish_frame (GstNvDecoder * decoder, GstVideoDecoder * videodec,
g_return_val_if_fail (frame != NULL, GST_FLOW_ERROR); g_return_val_if_fail (frame != NULL, GST_FLOW_ERROR);
g_return_val_if_fail (buffer != NULL, GST_FLOW_ERROR); g_return_val_if_fail (buffer != NULL, GST_FLOW_ERROR);
if (input_state) {
if (!gst_nv_decoder_negotiate (decoder, videodec, input_state)) {
GST_ERROR_OBJECT (videodec, "Couldn't re-negotiate with updated state");
return FALSE;
}
}
outbuf = gst_video_decoder_allocate_output_buffer (videodec); outbuf = gst_video_decoder_allocate_output_buffer (videodec);
if (!outbuf) { if (!outbuf) {
GST_ERROR_OBJECT (videodec, "Couldn't allocate output buffer"); GST_ERROR_OBJECT (videodec, "Couldn't allocate output buffer");

View file

@ -80,6 +80,7 @@ gboolean gst_nv_decoder_decode_picture (GstNvDecoder * decoder,
gboolean gst_nv_decoder_finish_frame (GstNvDecoder * decoder, gboolean gst_nv_decoder_finish_frame (GstNvDecoder * decoder,
GstVideoDecoder * videodec, GstVideoDecoder * videodec,
GstVideoCodecState * input_state,
GstNvDecoderFrame *frame, GstNvDecoderFrame *frame,
GstBuffer ** buffer); GstBuffer ** buffer);

View file

@ -578,8 +578,8 @@ gst_nv_h264_dec_output_picture (GstH264Decoder * decoder,
goto error; goto error;
} }
if (!gst_nv_decoder_finish_frame (self->decoder, vdec, decoder_frame, if (!gst_nv_decoder_finish_frame (self->decoder, vdec, picture->discont_state,
&frame->output_buffer)) { decoder_frame, &frame->output_buffer)) {
GST_ERROR_OBJECT (self, "Failed to handle output picture"); GST_ERROR_OBJECT (self, "Failed to handle output picture");
goto error; goto error;
} }

View file

@ -508,8 +508,8 @@ gst_nv_h265_dec_output_picture (GstH265Decoder * decoder,
goto error; goto error;
} }
if (!gst_nv_decoder_finish_frame (self->decoder, vdec, decoder_frame, if (!gst_nv_decoder_finish_frame (self->decoder, vdec, picture->discont_state,
&frame->output_buffer)) { decoder_frame, &frame->output_buffer)) {
GST_ERROR_OBJECT (self, "Failed to handle output picture"); GST_ERROR_OBJECT (self, "Failed to handle output picture");
goto error; goto error;
} }

View file

@ -478,8 +478,8 @@ gst_nv_vp8_dec_output_picture (GstVp8Decoder * decoder,
goto error; goto error;
} }
if (!gst_nv_decoder_finish_frame (self->decoder, vdec, decoder_frame, if (!gst_nv_decoder_finish_frame (self->decoder, vdec, picture->discont_state,
&frame->output_buffer)) { decoder_frame, &frame->output_buffer)) {
GST_ERROR_OBJECT (self, "Failed to handle output picture"); GST_ERROR_OBJECT (self, "Failed to handle output picture");
goto error; goto error;
} }

View file

@ -573,8 +573,8 @@ gst_nv_vp9_dec_output_picture (GstVp9Decoder * decoder,
goto error; goto error;
} }
if (!gst_nv_decoder_finish_frame (self->decoder, vdec, decoder_frame, if (!gst_nv_decoder_finish_frame (self->decoder, vdec, picture->discont_state,
&frame->output_buffer)) { decoder_frame, &frame->output_buffer)) {
GST_ERROR_OBJECT (self, "Failed to handle output picture"); GST_ERROR_OBJECT (self, "Failed to handle output picture");
goto error; goto error;
} }