summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-09-20 15:12:22 -0400
committerSebastian Dröge <sebastian@centricular.com>2016-09-30 13:40:46 +0300
commit4bc31e1b56febad506e1500ff10f147c882692cd (patch)
tree6f2257e35aed7c49582a7b9a6200e5f19817ecf8
parente9f3b88723fb4851c0c72b8c88c6ecf9d40a0b04 (diff)
downloadgstreamer-plugins-base-4bc31e1b56febad506e1500ff10f147c882692cd.tar.gz
streamsynchronizer: Correctly calculate group start times in reverse playback mode
We have to calculate from the segment.stop, not the segment.start, as playback goes from stop to start. This fix works around another race condition in streamsynchronizer in my testcase. See https://bugzilla.gnome.org/show_bug.cgi?id=771479
-rw-r--r--gst/playback/gststreamsynchronizer.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/gst/playback/gststreamsynchronizer.c b/gst/playback/gststreamsynchronizer.c
index 091e5764f..8f0394e48 100644
--- a/gst/playback/gststreamsynchronizer.c
+++ b/gst/playback/gststreamsynchronizer.c
@@ -373,18 +373,31 @@ gst_stream_synchronizer_sink_event (GstPad * pad, GstObject * parent,
ostream->wait = FALSE;
if (ostream->segment.format == GST_FORMAT_TIME) {
- stop_running_time =
- gst_segment_to_running_time (&ostream->segment,
- GST_FORMAT_TIME, ostream->segment.stop);
+ if (ostream->segment.rate > 0)
+ stop_running_time =
+ gst_segment_to_running_time (&ostream->segment,
+ GST_FORMAT_TIME, ostream->segment.stop);
+ else
+ stop_running_time =
+ gst_segment_to_running_time (&ostream->segment,
+ GST_FORMAT_TIME, ostream->segment.start);
+
position_running_time =
gst_segment_to_running_time (&ostream->segment,
GST_FORMAT_TIME, ostream->segment.position);
position_running_time =
MAX (position_running_time, stop_running_time);
- position_running_time -=
- gst_segment_to_running_time (&ostream->segment,
- GST_FORMAT_TIME, ostream->segment.start);
+
+ if (ostream->segment.rate > 0)
+ position_running_time -=
+ gst_segment_to_running_time (&ostream->segment,
+ GST_FORMAT_TIME, ostream->segment.start);
+ else
+ position_running_time -=
+ gst_segment_to_running_time (&ostream->segment,
+ GST_FORMAT_TIME, ostream->segment.stop);
+
position_running_time = MAX (0, position_running_time);
position = MAX (position, position_running_time);
@@ -497,9 +510,14 @@ gst_stream_synchronizer_sink_event (GstPad * pad, GstObject * parent,
continue;
if (ostream->segment.format == GST_FORMAT_TIME) {
- start_running_time =
- gst_segment_to_running_time (&ostream->segment,
- GST_FORMAT_TIME, ostream->segment.start);
+ if (ostream->segment.rate > 0)
+ start_running_time =
+ gst_segment_to_running_time (&ostream->segment,
+ GST_FORMAT_TIME, ostream->segment.start);
+ else
+ start_running_time =
+ gst_segment_to_running_time (&ostream->segment,
+ GST_FORMAT_TIME, ostream->segment.stop);
new_group_start_time = MAX (new_group_start_time, start_running_time);
}