baseparse: Don't push pointless new segment events

In 1.0, there is no concept of segment update, so don't push new
identical segments.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/578>
This commit is contained in:
Olivier Crête 2020-07-24 17:53:00 -04:00 committed by GStreamer Merge Bot
parent bc641acb9f
commit 18f27b1044

View file

@ -2516,43 +2516,6 @@ gst_base_parse_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
/* Push pending events, including SEGMENT events */ /* Push pending events, including SEGMENT events */
gst_base_parse_push_pending_events (parse); gst_base_parse_push_pending_events (parse);
/* segment adjustment magic; only if we are running the whole show */
if (!parse->priv->passthrough && parse->segment.rate > 0.0 &&
(parse->priv->pad_mode == GST_PAD_MODE_PULL ||
parse->priv->upstream_seekable)) {
/* handle gaps */
if (GST_CLOCK_TIME_IS_VALID (parse->segment.position) &&
GST_CLOCK_TIME_IS_VALID (last_start)) {
GstClockTimeDiff diff;
/* only send newsegments with increasing start times,
* otherwise if these go back and forth downstream (sinks) increase
* accumulated time and running_time */
diff = GST_CLOCK_DIFF (parse->segment.position, last_start);
if (G_UNLIKELY (diff > 2 * GST_SECOND
&& last_start > parse->segment.start
&& (!GST_CLOCK_TIME_IS_VALID (parse->segment.stop)
|| last_start < parse->segment.stop))) {
GstEvent *topush;
GST_DEBUG_OBJECT (parse,
"Gap of %" G_GINT64_FORMAT " ns detected in stream " "(%"
GST_TIME_FORMAT " -> %" GST_TIME_FORMAT "). "
"Sending updated SEGMENT events", diff,
GST_TIME_ARGS (parse->segment.position),
GST_TIME_ARGS (last_start));
/* skip gap FIXME */
topush = gst_event_new_segment (&parse->segment);
if (parse->priv->segment_seqnum != GST_SEQNUM_INVALID)
gst_event_set_seqnum (topush, parse->priv->segment_seqnum);
gst_pad_push_event (parse->srcpad, topush);
parse->segment.position = last_start;
}
}
}
/* update bitrates and optionally post corresponding tags /* update bitrates and optionally post corresponding tags
* (following newsegment) */ * (following newsegment) */
gst_base_parse_update_bitrates (parse, frame); gst_base_parse_update_bitrates (parse, frame);