summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/dash/gstmpdparser.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c
index 5bb5b9d87..a1d4cdace 100644
--- a/ext/dash/gstmpdparser.c
+++ b/ext/dash/gstmpdparser.c
@@ -4804,7 +4804,19 @@ gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream,
repeat_index--;
if ((flags & GST_SEEK_FLAG_SNAP_NEAREST) == GST_SEEK_FLAG_SNAP_NEAREST) {
- /* FIXME implement this */
+ if (repeat_index + 1 < segment->repeat) {
+ if (ts - chunk_time > chunk_time + segment->duration - ts)
+ repeat_index++;
+ } else if (index + 1 < stream->segments->len) {
+ GstMediaSegment *next_segment =
+ g_ptr_array_index (stream->segments, index + 1);
+
+ if (ts - chunk_time > next_segment->start - ts) {
+ repeat_index = 0;
+ selectedChunk = next_segment;
+ index++;
+ }
+ }
} else if (((forward && flags & GST_SEEK_FLAG_SNAP_AFTER) ||
(!forward && flags & GST_SEEK_FLAG_SNAP_BEFORE)) &&
ts != chunk_time) {
@@ -4855,7 +4867,8 @@ gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream,
index_time = index * duration;
if ((flags & GST_SEEK_FLAG_SNAP_NEAREST) == GST_SEEK_FLAG_SNAP_NEAREST) {
- /* FIXME implement this */
+ if (ts - index_time > index_time + duration - ts)
+ index++;
} else if (((forward && flags & GST_SEEK_FLAG_SNAP_AFTER) ||
(!forward && flags & GST_SEEK_FLAG_SNAP_BEFORE))
&& ts != index_time) {