From 34510b71ca7209e322d2cb32ec2ff167bee701d3 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Tue, 18 Sep 2012 01:13:36 +1000 Subject: [PATCH] resindvd: Don't send spurious 'close segment' events. Make a single segment With the new 1.0 segment semantics, there's no need to close the previous segment before sending out a new one, so don't do it. Also, adjust the outgoing segment to just be one contiguous timeline, with a base of 0. Fixes some repeating timestamps when segments change. --- ext/resindvd/gstmpegdemux.c | 51 +------------------------------------ 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/ext/resindvd/gstmpegdemux.c b/ext/resindvd/gstmpegdemux.c index fe934832f4..33b2f97c10 100644 --- a/ext/resindvd/gstmpegdemux.c +++ b/ext/resindvd/gstmpegdemux.c @@ -826,53 +826,6 @@ gst_flups_demux_send_gap_updates (GstFluPSDemux * demux, GstClockTime new_time) } } -static inline void -gst_flups_demux_close_segment (GstFluPSDemux * demux) -{ - gint id; - GstEvent *event = NULL; - GstClockTime stop = demux->src_segment.stop; - - if (demux->src_segment.position != -1 && demux->src_segment.position > stop) - stop = demux->src_segment.position; - - for (id = 0; id < GST_FLUPS_DEMUX_MAX_STREAMS; id++) { - GstFluPSStream *stream = demux->streams[id]; - - if (stream) { - GstClockTime start = demux->src_segment.start; - GstSegment segment; - - if (stream->last_seg_start != GST_CLOCK_TIME_NONE && - stream->last_seg_start > start) - start = stream->last_seg_start; - -#if 0 - g_print ("Segment close to pad %s start %" GST_TIME_FORMAT - " stop %" GST_TIME_FORMAT "\n", - GST_PAD_NAME (stream->pad), GST_TIME_ARGS (start), - GST_TIME_ARGS (stop)); -#endif - if (start > stop) { - GST_WARNING_OBJECT (demux, - "Problem on pad %s with start %" GST_TIME_FORMAT " > stop %" - GST_TIME_FORMAT "\n", - gst_object_get_name (GST_OBJECT (stream->pad)), - GST_TIME_ARGS (start), GST_TIME_ARGS (stop)); - } - gst_segment_init (&segment, GST_FORMAT_TIME); - segment.rate = demux->src_segment.rate; - segment.applied_rate = demux->src_segment.applied_rate; - segment.start = start; - segment.stop = stop; - segment.time = - demux->src_segment.time + (start - demux->src_segment.start); - event = gst_event_new_segment (&segment); - gst_pad_push_event (stream->pad, event); - } - } -} - static gboolean gst_flups_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { @@ -896,9 +849,6 @@ gst_flups_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) gint64 base, dur; GstClockTimeDiff adjust; - /* Close current segment */ - gst_flups_demux_close_segment (demux); - gst_event_parse_segment (event, &segment); if (segment->format != GST_FORMAT_TIME) @@ -924,6 +874,7 @@ gst_flups_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) " base %" G_GINT64_FORMAT, start, stop, time, base); adjust = base - start + SCR_MUNGE; + base = 0; start = base + SCR_MUNGE; if (adjust >= 0)