From f1a9728b307a094651a596f72a605e2be2888ff1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Wed, 23 Nov 2022 18:29:58 +0100 Subject: [PATCH] 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: --- subprojects/gst-plugins-bad/sys/va/gstvaav1dec.c | 28 ++++++++--------------- subprojects/gst-plugins-bad/sys/va/gstvah264dec.c | 17 ++++---------- subprojects/gst-plugins-bad/sys/va/gstvah265dec.c | 19 ++++----------- subprojects/gst-plugins-bad/sys/va/gstvavp8dec.c | 17 ++++---------- 4 files changed, 24 insertions(+), 57 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/va/gstvaav1dec.c b/subprojects/gst-plugins-bad/sys/va/gstvaav1dec.c index fafddba..32b466a 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvaav1dec.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvaav1dec.c @@ -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; diff --git a/subprojects/gst-plugins-bad/sys/va/gstvah264dec.c b/subprojects/gst-plugins-bad/sys/va/gstvah264dec.c index 756e673..206be24 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvah264dec.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvah264dec.c @@ -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; } } diff --git a/subprojects/gst-plugins-bad/sys/va/gstvah265dec.c b/subprojects/gst-plugins-bad/sys/va/gstvah265dec.c index 51da017..0273c12 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvah265dec.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvah265dec.c @@ -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; } } diff --git a/subprojects/gst-plugins-bad/sys/va/gstvavp8dec.c b/subprojects/gst-plugins-bad/sys/va/gstvavp8dec.c index 2197000..346b3dd 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvavp8dec.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvavp8dec.c @@ -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); -- 2.7.4