GNOME Bugzilla – Bug 488201
gst_segment_set_newsegment does not accumulate correctly
Last modified: 2007-11-09 11:57:10 UTC
When receiving a sequence of segments like this : update 0 rate -1.0 start 0 stop Y last_stop Y (typical reverse playback) and then update 1 rate -1.0 start X stop Y last_stop X (closing reverse playback segment, no flush) update 0 rate 1.0 start X stop Z (duration) last_stop X (starting forward playback again) The segment accumulated duration is wrong. Indeed the closing/update of the reverse playback segment is accumulating X when it should not accumulate anything until the non update segment arrives and then accumulate Y - X which is the duration we have played in reverse playback.
Created attachment 97638 [details] [review] Proposed patch to not accumulate when updating that's probably not correct for all cases either but that makes reverse segment accumulation work fine.
Created attachment 98809 [details] [review] patch to accumulate correctly patch and unit tests to fix the problem.
Looks ok to me, even though it isn't technically a regression
* gst/gstsegment.c: (gst_segment_set_newsegment_full), (gst_segment_to_stream_time), (gst_segment_to_running_time): Also accumulate time correctly when doing reverse playback. Fixes #488201, When converting to running and stream time, use default values for start/stop/time/accum when comparing different formats. Fixes #494245. * libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times): Do running/stream time in TIME format. * tests/check/gst/gstsegment.c: (GST_START_TEST), (gst_segment_suite): 2 new unit tests for segment accumulation.