adaptivedemux: fix segment update on seeks

Fixes typo on reverse rate check and also only update the
position when the start/stop was actually changed.
This commit is contained in:
Thiago Santos 2016-01-06 16:51:08 -03:00
parent b6696122a0
commit eaace4922c

View file

@ -1298,9 +1298,9 @@ gst_adaptive_demux_src_event (GstPad * pad, GstObject * parent,
offset = offset =
gst_adaptive_demux_stream_get_presentation_offset (demux, stream); gst_adaptive_demux_stream_get_presentation_offset (demux, stream);
stream->segment.start += offset - period_start; stream->segment.start += offset - period_start;
if (demux->segment.rate > 1) if (demux->segment.rate > 0 && start_type != GST_SEEK_TYPE_NONE)
stream->segment.position = stream->segment.start; stream->segment.position = stream->segment.start;
else else if (demux->segment.rate < 0 && stop_type != GST_SEEK_TYPE_NONE)
stream->segment.position = stream->segment.stop; stream->segment.position = stream->segment.stop;
seg_evt = gst_event_new_segment (&stream->segment); seg_evt = gst_event_new_segment (&stream->segment);
gst_event_set_seqnum (seg_evt, demux->priv->segment_seqnum); gst_event_set_seqnum (seg_evt, demux->priv->segment_seqnum);
@ -3084,7 +3084,7 @@ gst_adaptive_demux_stream_advance_fragment_unlocked (GstAdaptiveDemux * demux,
stream->download_total_time * GST_USECOND, NULL))); stream->download_total_time * GST_USECOND, NULL)));
/* Don't update to the end of the segment if in reverse playback */ /* Don't update to the end of the segment if in reverse playback */
if (GST_CLOCK_TIME_IS_VALID (duration) && demux->segment.rate > 1) { if (GST_CLOCK_TIME_IS_VALID (duration) && demux->segment.rate > 0) {
GstClockTime offset = GstClockTime offset =
gst_adaptive_demux_stream_get_presentation_offset (demux, stream); gst_adaptive_demux_stream_get_presentation_offset (demux, stream);
GstClockTime period_start = GstClockTime period_start =