diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2017-03-21 20:27:10 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2017-03-21 20:38:09 +0200 |
commit | 7778e8293a9ebb28404c935e8b6cdd9dc6cc0fd4 (patch) | |
tree | f7e7ffd9fc33225c61fb3d21d86aacf2608faf58 | |
parent | bcbf1f67f098b3e4133d83f6ea28b9d3afba1042 (diff) | |
download | gstreamer-plugins-bad-7778e8293a9ebb28404c935e8b6cdd9dc6cc0fd4.tar.gz |
dashdemux: Only snap seeks forwards if the seek position does not happen to be the exact segment position
-rw-r--r-- | ext/dash/gstmpdparser.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c index c479f8dbd..5bb5b9d87 100644 --- a/ext/dash/gstmpdparser.c +++ b/ext/dash/gstmpdparser.c @@ -4791,9 +4791,13 @@ gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream, in_segment = ts <= end_time; if (in_segment) { + GstClockTime chunk_time; + selectedChunk = segment; repeat_index = (ts - segment->start) / segment->duration; + chunk_time = segment->start + segment->duration * repeat_index; + /* At the end of a segment in reverse mode, start from the previous fragment */ if (!forward && repeat_index > 0 && ((ts - segment->start) % segment->duration == 0)) @@ -4801,8 +4805,9 @@ gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream, if ((flags & GST_SEEK_FLAG_SNAP_NEAREST) == GST_SEEK_FLAG_SNAP_NEAREST) { /* FIXME implement this */ - } else if ((forward && flags & GST_SEEK_FLAG_SNAP_AFTER) || - (!forward && flags & GST_SEEK_FLAG_SNAP_BEFORE)) { + } else if (((forward && flags & GST_SEEK_FLAG_SNAP_AFTER) || + (!forward && flags & GST_SEEK_FLAG_SNAP_BEFORE)) && + ts != chunk_time) { if (repeat_index + 1 < segment->repeat) { repeat_index++; @@ -4833,6 +4838,7 @@ gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream, gst_mpd_client_get_segment_duration (client, stream, NULL); GstStreamPeriod *stream_period = gst_mpdparser_get_stream_period (client); guint segments_count = gst_mpd_client_get_segments_counts (client, stream); + GstClockTime index_time; g_return_val_if_fail (stream->cur_seg_template-> MultSegBaseType->SegmentTimeline == NULL, FALSE); @@ -4846,11 +4852,13 @@ gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream, ts = 0; index = ts / duration; + index_time = index * duration; if ((flags & GST_SEEK_FLAG_SNAP_NEAREST) == GST_SEEK_FLAG_SNAP_NEAREST) { /* FIXME implement this */ - } else if ((forward && flags & GST_SEEK_FLAG_SNAP_AFTER) || - (!forward && flags & GST_SEEK_FLAG_SNAP_BEFORE)) { + } else if (((forward && flags & GST_SEEK_FLAG_SNAP_AFTER) || + (!forward && flags & GST_SEEK_FLAG_SNAP_BEFORE)) + && ts != index_time) { index++; } |