summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStian Selnes <stian@pexip.com>2016-09-14 14:23:56 +0200
committerSebastian Dröge <sebastian@centricular.com>2016-10-20 14:14:20 +0300
commitd03bd547809f849405a3f706920091d9b03147b0 (patch)
tree87972ea03f15a5b0c0ed78acf130fb70dd6beea6
parent556c540ecdd9adf516e6d6d78e434ed20fdcb895 (diff)
queue: Fix race when calculating cur_level.time
On the first buffer, it's possible that sink_segment is set but src_segment has not been set yet. If this is the case, we should not calculate cur_level.time since sink_segment.position may be large and src_segment.position default is 0, with the resulting diff being larger than max-size-time, causing the queue to start leaking (if leaky=downstream). One potential consequence of this is that the segment event may be stored on the srcpad before the caps event is pushed downstream, causing a g_warning ("Sticky event misordering, got 'segment' before 'caps'"). https://bugzilla.gnome.org/show_bug.cgi?id=773096
-rw-r--r--plugins/elements/gstqueue.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c
index e8f7f89767..97aa0c09eb 100644
--- a/plugins/elements/gstqueue.c
+++ b/plugins/elements/gstqueue.c
@@ -546,7 +546,7 @@ update_time_level (GstQueue * queue)
GST_LOG_OBJECT (queue, "sink %" GST_STIME_FORMAT ", src %" GST_STIME_FORMAT,
GST_STIME_ARGS (sink_time), GST_STIME_ARGS (src_time));
- if (sink_time >= src_time)
+ if (sink_time >= src_time && queue->newseg_applied_to_src)
queue->cur_level.time = sink_time - src_time;
else
queue->cur_level.time = 0;