From d353d229b14d18f9345891b8711db533912a34c4 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Fri, 20 Dec 2013 19:39:16 -0300 Subject: [PATCH] dash: detect EOS when segments are generated by template Use the Period duration do know when to end the stream --- ext/dash/gstmpdparser.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c index aa71008..14a8d5c 100644 --- a/ext/dash/gstmpdparser.c +++ b/ext/dash/gstmpdparser.c @@ -2923,6 +2923,8 @@ gst_mpdparser_get_chunk_by_index (GstMpdClient * client, guint indexStream, segment->duration = list_segment->duration; } else { GstClockTime duration; + GstStreamPeriod *stream_period; + g_return_val_if_fail (stream->cur_seg_template-> MultSegBaseType->SegmentTimeline == NULL, FALSE); /* segment template generator */ @@ -2930,13 +2932,17 @@ gst_mpdparser_get_chunk_by_index (GstMpdClient * client, guint indexStream, if (!GST_CLOCK_TIME_IS_VALID (duration)) return FALSE; - /* TODO check PeriodEnd for segment beyond end of period */ + stream_period = gst_mpdparser_get_stream_period (client); segment->number = indexChunk + stream->cur_seg_template->MultSegBaseType->startNumber; segment->start_time = duration * indexChunk; segment->duration = duration; segment->SegmentURL = NULL; + + if (segment->start_time > stream_period->start + stream_period->duration) { + return FALSE; + } } return TRUE; } -- 2.7.4