From fc75e38496303231daffe01f1d99a48ae3376127 Mon Sep 17 00:00:00 2001 From: He Junyan Date: Mon, 23 May 2022 15:03:03 +0800 Subject: [PATCH] va: baseenc: No need to check the frame pointer in handle_frame(). No need to check the NULL pointer of "frame" in error handling, it is assured non-NULL by base class and we already use it everywhere in this function. Part-of: --- subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c b/subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c index f09a1fd74b..09a949c524 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c @@ -564,20 +564,16 @@ error_new_frame: { GST_ELEMENT_ERROR (venc, STREAM, ENCODE, ("Failed to create the input frame."), (NULL)); - if (frame) { - gst_clear_buffer (&frame->output_buffer); - gst_video_encoder_finish_frame (venc, frame); - } + gst_clear_buffer (&frame->output_buffer); + gst_video_encoder_finish_frame (venc, frame); return GST_FLOW_ERROR; } error_reorder: { GST_ELEMENT_ERROR (venc, STREAM, ENCODE, ("Failed to reorder the input frame."), (NULL)); - if (frame) { - gst_clear_buffer (&frame->output_buffer); - gst_video_encoder_finish_frame (venc, frame); - } + gst_clear_buffer (&frame->output_buffer); + gst_video_encoder_finish_frame (venc, frame); return GST_FLOW_ERROR; } error_encode: