va: Remove last_ret error handling in decoders.

It was used in the early development of the base classes. Now it
shouldn't be needed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3480>
This commit is contained in:
Víctor Manuel Jáquez Leal 2022-11-23 18:29:58 +01:00
parent de5b76a922
commit f1a9728b30
4 changed files with 24 additions and 57 deletions

View file

@ -71,8 +71,6 @@ struct _GstVaAV1Dec
{
GstVaBaseDec parent;
GstFlowReturn last_ret;
GstAV1SequenceHeaderOBU seq;
gint max_width;
gint max_height;
@ -380,6 +378,7 @@ gst_va_av1_dec_new_picture (GstAV1Decoder * decoder,
GstVaDecodePicture *pic;
GstVideoDecoder *vdec = GST_VIDEO_DECODER (decoder);
GstAV1FrameHeaderOBU *frame_hdr = &picture->frame_hdr;
GstFlowReturn ret;
/* Only output the highest spatial layer. For non output pictures,
we just use internal pool, then no negotiation needed. */
@ -418,21 +417,20 @@ gst_va_av1_dec_new_picture (GstAV1Decoder * decoder,
}
if (picture->spatial_id < decoder->highest_spatial_layer) {
self->last_ret = gst_buffer_pool_acquire_buffer (self->internal_pool,
ret = gst_buffer_pool_acquire_buffer (self->internal_pool,
&frame->output_buffer, NULL);
if (self->last_ret != GST_FLOW_OK) {
if (ret != GST_FLOW_OK) {
GST_WARNING_OBJECT (self,
"Failed to allocated output buffer from internal pool, return %s",
gst_flow_get_name (self->last_ret));
return self->last_ret;
gst_flow_get_name (ret));
return ret;
}
} else {
self->last_ret = gst_video_decoder_allocate_output_frame (vdec, frame);
if (self->last_ret != GST_FLOW_OK) {
GST_WARNING_OBJECT (self,
"Failed to allocated output buffer, return %s",
gst_flow_get_name (self->last_ret));
return self->last_ret;
ret = gst_video_decoder_allocate_output_frame (vdec, frame);
if (ret != GST_FLOW_OK) {
GST_WARNING_OBJECT (self, "Failed to allocated output buffer, return %s",
gst_flow_get_name (ret));
return ret;
}
}
@ -956,12 +954,6 @@ gst_va_av1_dec_output_picture (GstAV1Decoder * decoder,
"Outputting picture %p (system_frame_number %d)",
picture, picture->system_frame_number);
if (self->last_ret != GST_FLOW_OK) {
gst_av1_picture_unref (picture);
gst_video_decoder_drop_frame (vdec, frame);
return self->last_ret;
}
if (picture->frame_hdr.show_existing_frame) {
GstVaDecodePicture *pic;

View file

@ -75,8 +75,6 @@ struct _GstVaH264Dec
{
GstVaBaseDec parent;
GstFlowReturn last_ret;
gint coded_width;
gint coded_height;
gint dpb_size;
@ -127,12 +125,6 @@ gst_va_h264_dec_output_picture (GstH264Decoder * decoder,
GST_LOG_OBJECT (self,
"Outputting picture %p (poc %d)", picture, picture->pic_order_cnt);
if (self->last_ret != GST_FLOW_OK) {
gst_h264_picture_unref (picture);
gst_video_decoder_drop_frame (vdec, frame);
return self->last_ret;
}
ret = gst_va_base_dec_process_output (base, frame, picture->buffer_flags);
gst_h264_picture_unref (picture);
@ -485,6 +477,7 @@ gst_va_h264_dec_new_picture (GstH264Decoder * decoder,
GstVaDecodePicture *pic;
GstVideoDecoder *vdec = GST_VIDEO_DECODER (decoder);
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
GstFlowReturn ret;
if (base->need_negotiation) {
if (!gst_video_decoder_negotiate (vdec)) {
@ -493,8 +486,8 @@ gst_va_h264_dec_new_picture (GstH264Decoder * decoder,
}
}
self->last_ret = gst_video_decoder_allocate_output_frame (vdec, frame);
if (self->last_ret != GST_FLOW_OK)
ret = gst_video_decoder_allocate_output_frame (vdec, frame);
if (ret != GST_FLOW_OK)
goto error;
pic = gst_va_decode_picture_new (base->decoder, frame->output_buffer);
@ -511,8 +504,8 @@ error:
{
GST_WARNING_OBJECT (self,
"Failed to allocated output buffer, return %s",
gst_flow_get_name (self->last_ret));
return self->last_ret;
gst_flow_get_name (ret));
return ret;
}
}

View file

@ -88,8 +88,6 @@ struct _GstVaH265Dec
{
GstVaBaseDec parent;
GstFlowReturn last_ret;
gint coded_width;
gint coded_height;
gint dpb_size;
@ -242,13 +240,6 @@ gst_va_h265_dec_output_picture (GstH265Decoder * decoder,
GST_LOG_OBJECT (self,
"Outputting picture %p (poc %d)", picture, picture->pic_order_cnt);
if (self->last_ret != GST_FLOW_OK) {
gst_h265_picture_unref (picture);
_replace_previous_slice (self, NULL, 0);
gst_video_decoder_drop_frame (vdec, frame);
return self->last_ret;
}
gst_buffer_replace (&frame->output_buffer, va_pic->gstbuffer);
ret = gst_va_base_dec_process_output (base, frame, picture->buffer_flags);
@ -862,6 +853,7 @@ gst_va_h265_dec_new_picture (GstH265Decoder * decoder,
GstVaDecodePicture *pic;
GstBuffer *output_buffer;
GstVideoDecoder *vdec = GST_VIDEO_DECODER (decoder);
GstFlowReturn ret = GST_FLOW_ERROR;
if (base->need_negotiation) {
if (!gst_video_decoder_negotiate (vdec)) {
@ -871,11 +863,8 @@ gst_va_h265_dec_new_picture (GstH265Decoder * decoder,
}
output_buffer = gst_video_decoder_allocate_output_buffer (vdec);
if (!output_buffer) {
self->last_ret = GST_FLOW_ERROR;
if (!output_buffer)
goto error;
}
self->last_ret = GST_FLOW_OK;
pic = gst_va_decode_picture_new (base->decoder, output_buffer);
gst_buffer_unref (output_buffer);
@ -892,8 +881,8 @@ error:
{
GST_WARNING_OBJECT (self,
"Failed to allocated output buffer, return %s",
gst_flow_get_name (self->last_ret));
return self->last_ret;
gst_flow_get_name (ret));
return ret;
}
}

View file

@ -69,8 +69,6 @@ struct _GstVaVp8DecClass
struct _GstVaVp8Dec
{
GstVaBaseDec parent;
GstFlowReturn last_ret;
};
static GstElementClass *parent_class = NULL;
@ -192,6 +190,7 @@ gst_va_vp8_dec_new_picture (GstVp8Decoder * decoder,
GstVaDecodePicture *pic;
GstVideoDecoder *vdec = GST_VIDEO_DECODER (decoder);
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
GstFlowReturn ret;
if (base->need_negotiation) {
if (!gst_video_decoder_negotiate (vdec)) {
@ -200,8 +199,8 @@ gst_va_vp8_dec_new_picture (GstVp8Decoder * decoder,
}
}
self->last_ret = gst_video_decoder_allocate_output_frame (vdec, frame);
if (self->last_ret != GST_FLOW_OK)
ret = gst_video_decoder_allocate_output_frame (vdec, frame);
if (ret != GST_FLOW_OK)
goto error;
pic = gst_va_decode_picture_new (base->decoder, frame->output_buffer);
@ -218,8 +217,8 @@ error:
{
GST_WARNING_OBJECT (self,
"Failed to allocated output buffer, return %s",
gst_flow_get_name (self->last_ret));
return self->last_ret;
gst_flow_get_name (ret));
return ret;
}
}
@ -452,12 +451,6 @@ gst_va_vp8_dec_output_picture (GstVp8Decoder * decoder,
"Outputting picture %p (system_frame_number %d)",
picture, picture->system_frame_number);
if (self->last_ret != GST_FLOW_OK) {
gst_vp8_picture_unref (picture);
gst_video_decoder_drop_frame (vdec, frame);
return self->last_ret;
}
ret = gst_va_base_dec_process_output (base, frame, 0);
gst_vp8_picture_unref (picture);