From 5d310062e852ac8d6ed2103fbf66648e1f2c6fe7 Mon Sep 17 00:00:00 2001 From: Michael Tretter Date: Thu, 12 Sep 2024 16:31:50 +0200 Subject: [PATCH] v4l2videoenc: remove unnecessary processing variable and dead code "processing" is only set to FALSE and never set to TRUE. Therefore, the code that depends on processing to be TRUE is never executed. Remove the dead code. Part-of: --- .../sys/v4l2/gstv4l2videoenc.c | 22 ------------------- .../sys/v4l2/gstv4l2videoenc.h | 1 - 2 files changed, 23 deletions(-) diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c index 1edb88e646..d93ffd5b8f 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c @@ -222,7 +222,6 @@ gst_v4l2_video_enc_stop (GstVideoEncoder * encoder) /* Should have been flushed already */ g_assert (g_atomic_int_get (&self->active) == FALSE); - g_assert (g_atomic_int_get (&self->processing) == FALSE); gst_v4l2_object_stop (self->v4l2output); gst_v4l2_object_stop (self->v4l2capture); @@ -317,19 +316,6 @@ gst_v4l2_video_enc_flush (GstVideoEncoder * encoder) GST_DEBUG_OBJECT (self, "Flushing"); - /* Ensure the processing thread has stopped for the reverse playback - * iscount case */ - if (g_atomic_int_get (&self->processing)) { - GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder); - - gst_v4l2_object_unlock_stop (self->v4l2output); - gst_v4l2_object_unlock_stop (self->v4l2capture); - gst_pad_stop_task (encoder->srcpad); - - GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder); - - } - self->output_flow = GST_FLOW_OK; gst_v4l2_object_unlock_stop (self->v4l2output); @@ -744,7 +730,6 @@ beach: gst_buffer_replace (&buffer, NULL); self->output_flow = ret; - g_atomic_int_set (&self->processing, FALSE); gst_v4l2_object_unlock (self->v4l2output); gst_pad_pause_task (encoder->srcpad); } @@ -752,12 +737,6 @@ beach: static void gst_v4l2_video_enc_loop_stopped (GstV4l2VideoEnc * self) { - if (g_atomic_int_get (&self->processing)) { - GST_DEBUG_OBJECT (self, "Early stop of encoding thread"); - self->output_flow = GST_FLOW_FLUSHING; - g_atomic_int_set (&self->processing, FALSE); - } - GST_DEBUG_OBJECT (self, "Encoding task destroyed: %s", gst_flow_get_name (self->output_flow)); @@ -911,7 +890,6 @@ start_task_failed: { GST_ELEMENT_ERROR (self, RESOURCE, FAILED, (_("Failed to start encoding thread.")), (NULL)); - g_atomic_int_set (&self->processing, FALSE); ret = GST_FLOW_ERROR; goto drop; } diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.h b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.h index 3659cb51dd..e06c52880c 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.h +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.h @@ -63,7 +63,6 @@ struct _GstV4l2VideoEnc /* State */ GstVideoCodecState *input_state; gboolean active; - gboolean processing; GstFlowReturn output_flow; };