From 721f05939779e1c532901874926f134e0cd7f115 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Wed, 16 Nov 2022 03:15:44 +0900 Subject: [PATCH] codectimestamper: Remove duplicated GstSegment struct Use the one in priv struct. And use gst_segment_is_equal() to compare GstSegment Part-of: --- .../gst/codectimestamper/gstcodectimestamper.c | 9 +++++---- .../gst/codectimestamper/gstcodectimestamper.h | 2 -- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst/codectimestamper/gstcodectimestamper.c b/subprojects/gst-plugins-bad/gst/codectimestamper/gstcodectimestamper.c index 9e59e9a656..99e3edf3b3 100644 --- a/subprojects/gst-plugins-bad/gst/codectimestamper/gstcodectimestamper.c +++ b/subprojects/gst-plugins-bad/gst/codectimestamper/gstcodectimestamper.c @@ -189,6 +189,7 @@ gst_codec_timestamper_init (GstCodecTimestamper * self, g_array_sized_new (FALSE, FALSE, sizeof (GstClockTime), 16); g_rec_mutex_init (&priv->lock); + gst_segment_init (&priv->in_segment, GST_FORMAT_TIME); } static void @@ -338,10 +339,10 @@ gst_codec_timestamper_sink_event (GstPad * pad, GstObject * parent, } /* Drain on segment update */ - if (memcmp (&self->in_segment, &segment, sizeof (GstSegment))) + if (!gst_segment_is_equal (&priv->in_segment, &segment)) gst_codec_timestamper_drain (self); - self->in_segment = segment; + priv->in_segment = segment; break; } case GST_EVENT_EOS: @@ -517,9 +518,9 @@ gst_codec_timestamper_chain (GstPad * pad, GstObject * parent, GstClockTime start_time = GST_CLOCK_TIME_NONE; if (GST_CLOCK_TIME_IS_VALID (pts)) - start_time = MAX (pts, self->in_segment.start); + start_time = MAX (pts, priv->in_segment.start); else if (GST_CLOCK_TIME_IS_VALID (dts)) - start_time = MAX (dts, self->in_segment.start); + start_time = MAX (dts, priv->in_segment.start); else start_time = priv->in_segment.start; diff --git a/subprojects/gst-plugins-bad/gst/codectimestamper/gstcodectimestamper.h b/subprojects/gst-plugins-bad/gst/codectimestamper/gstcodectimestamper.h index 0abb8bd52b..ac9d50bb37 100644 --- a/subprojects/gst-plugins-bad/gst/codectimestamper/gstcodectimestamper.h +++ b/subprojects/gst-plugins-bad/gst/codectimestamper/gstcodectimestamper.h @@ -40,8 +40,6 @@ struct _GstCodecTimestamper GstPad *sinkpad; GstPad *srcpad; - GstSegment in_segment; - GstCodecTimestamperPrivate *priv; };