mpdparser: Don't consider period start times in periods with segment lists either
https://bugzilla.gnome.org/show_bug.cgi?id=754222
This commit is contained in:
parent
d9c45e918f
commit
c9f60db2d4
@ -3204,7 +3204,7 @@ gst_mpd_client_setup_representation (GstMpdClient * client,
|
|||||||
GST_DEBUG ("No useful SegmentList node for the current Representation");
|
GST_DEBUG ("No useful SegmentList node for the current Representation");
|
||||||
/* here we should have a single segment for each representation, whose URL is encoded in the baseURL element */
|
/* here we should have a single segment for each representation, whose URL is encoded in the baseURL element */
|
||||||
if (!gst_mpd_client_add_media_segment (stream, NULL, 1, 0, 0,
|
if (!gst_mpd_client_add_media_segment (stream, NULL, 1, 0, 0,
|
||||||
PeriodEnd - PeriodStart, PeriodStart, PeriodEnd - PeriodStart)) {
|
PeriodEnd - PeriodStart, 0, PeriodEnd - PeriodStart)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -3219,7 +3219,7 @@ gst_mpd_client_setup_representation (GstMpdClient * client,
|
|||||||
/* build segment list */
|
/* build segment list */
|
||||||
i = stream->cur_segment_list->MultSegBaseType->startNumber;
|
i = stream->cur_segment_list->MultSegBaseType->startNumber;
|
||||||
start = 0;
|
start = 0;
|
||||||
start_time = PeriodStart;
|
start_time = 0;
|
||||||
|
|
||||||
GST_LOG ("Building media segment list using a SegmentList node");
|
GST_LOG ("Building media segment list using a SegmentList node");
|
||||||
if (stream->cur_segment_list->MultSegBaseType->SegmentTimeline) {
|
if (stream->cur_segment_list->MultSegBaseType->SegmentTimeline) {
|
||||||
@ -3242,7 +3242,6 @@ gst_mpd_client_setup_representation (GstMpdClient * client,
|
|||||||
if (S->t > 0) {
|
if (S->t > 0) {
|
||||||
start = S->t;
|
start = S->t;
|
||||||
start_time = gst_util_uint64_scale (S->t, GST_SECOND, timescale);
|
start_time = gst_util_uint64_scale (S->t, GST_SECOND, timescale);
|
||||||
start_time += PeriodStart;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_mpd_client_add_media_segment (stream, SegmentURL->data, i,
|
if (!gst_mpd_client_add_media_segment (stream, SegmentURL->data, i,
|
||||||
@ -3289,7 +3288,7 @@ gst_mpd_client_setup_representation (GstMpdClient * client,
|
|||||||
gst_mpdparser_init_active_stream_segments (stream);
|
gst_mpdparser_init_active_stream_segments (stream);
|
||||||
/* here we should have a single segment for each representation, whose URL is encoded in the baseURL element */
|
/* here we should have a single segment for each representation, whose URL is encoded in the baseURL element */
|
||||||
if (!gst_mpd_client_add_media_segment (stream, NULL, 1, 0, 0,
|
if (!gst_mpd_client_add_media_segment (stream, NULL, 1, 0, 0,
|
||||||
PeriodEnd - PeriodStart, PeriodStart, PeriodEnd - PeriodStart)) {
|
PeriodEnd - PeriodStart, 0, PeriodEnd - PeriodStart)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -3298,7 +3297,7 @@ gst_mpd_client_setup_representation (GstMpdClient * client,
|
|||||||
/* build segment list */
|
/* build segment list */
|
||||||
i = mult_seg->startNumber;
|
i = mult_seg->startNumber;
|
||||||
start = 0;
|
start = 0;
|
||||||
start_time = PeriodStart;
|
start_time = 0;
|
||||||
|
|
||||||
GST_LOG ("Building media segment list using this template: %s",
|
GST_LOG ("Building media segment list using this template: %s",
|
||||||
stream->cur_seg_template->media);
|
stream->cur_seg_template->media);
|
||||||
@ -3329,7 +3328,6 @@ gst_mpd_client_setup_representation (GstMpdClient * client,
|
|||||||
if (S->t > 0) {
|
if (S->t > 0) {
|
||||||
start = S->t;
|
start = S->t;
|
||||||
start_time = gst_util_uint64_scale (S->t, GST_SECOND, timescale);
|
start_time = gst_util_uint64_scale (S->t, GST_SECOND, timescale);
|
||||||
start_time += PeriodStart;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_mpd_client_add_media_segment (stream, NULL, i, S->r, start,
|
if (!gst_mpd_client_add_media_segment (stream, NULL, i, S->r, start,
|
||||||
@ -3353,7 +3351,8 @@ gst_mpd_client_setup_representation (GstMpdClient * client,
|
|||||||
|
|
||||||
if (last_media_segment && GST_CLOCK_TIME_IS_VALID (PeriodEnd)) {
|
if (last_media_segment && GST_CLOCK_TIME_IS_VALID (PeriodEnd)) {
|
||||||
if (last_media_segment->start + last_media_segment->duration > PeriodEnd) {
|
if (last_media_segment->start + last_media_segment->duration > PeriodEnd) {
|
||||||
last_media_segment->duration = PeriodEnd - last_media_segment->start;
|
last_media_segment->duration =
|
||||||
|
PeriodEnd - PeriodStart - last_media_segment->start;
|
||||||
GST_LOG ("Fixed duration of last segment: %" GST_TIME_FORMAT,
|
GST_LOG ("Fixed duration of last segment: %" GST_TIME_FORMAT,
|
||||||
GST_TIME_ARGS (last_media_segment->duration));
|
GST_TIME_ARGS (last_media_segment->duration));
|
||||||
}
|
}
|
||||||
|
@ -3715,6 +3715,7 @@ GST_START_TEST (dash_mpdparser_fragments)
|
|||||||
GstClockTime nextFragmentDuration;
|
GstClockTime nextFragmentDuration;
|
||||||
GstClockTime nextFragmentTimestamp;
|
GstClockTime nextFragmentTimestamp;
|
||||||
GstClockTime nextFragmentTimestampEnd;
|
GstClockTime nextFragmentTimestampEnd;
|
||||||
|
GstClockTime periodStartTime;
|
||||||
GstClockTime expectedDuration;
|
GstClockTime expectedDuration;
|
||||||
GstClockTime expectedTimestamp;
|
GstClockTime expectedTimestamp;
|
||||||
GstClockTime expectedTimestampEnd;
|
GstClockTime expectedTimestampEnd;
|
||||||
@ -3754,8 +3755,8 @@ GST_START_TEST (dash_mpdparser_fragments)
|
|||||||
|
|
||||||
/* expected duration of the next fragment */
|
/* expected duration of the next fragment */
|
||||||
expectedDuration = duration_to_ms (0, 0, 0, 3, 3, 20, 0);
|
expectedDuration = duration_to_ms (0, 0, 0, 3, 3, 20, 0);
|
||||||
expectedTimestamp = duration_to_ms (0, 0, 0, 0, 0, 10, 0);
|
expectedTimestamp = duration_to_ms (0, 0, 0, 0, 0, 0, 0);
|
||||||
expectedTimestampEnd = duration_to_ms (0, 0, 0, 3, 3, 30, 0);
|
expectedTimestampEnd = duration_to_ms (0, 0, 0, 3, 3, 20, 0);
|
||||||
|
|
||||||
ret = gst_mpd_client_get_next_fragment (mpdclient, 0, &fragment);
|
ret = gst_mpd_client_get_next_fragment (mpdclient, 0, &fragment);
|
||||||
assert_equals_int (ret, TRUE);
|
assert_equals_int (ret, TRUE);
|
||||||
@ -3766,6 +3767,9 @@ GST_START_TEST (dash_mpdparser_fragments)
|
|||||||
assert_equals_uint64 (fragment.timestamp, expectedTimestamp * GST_MSECOND);
|
assert_equals_uint64 (fragment.timestamp, expectedTimestamp * GST_MSECOND);
|
||||||
gst_media_fragment_info_clear (&fragment);
|
gst_media_fragment_info_clear (&fragment);
|
||||||
|
|
||||||
|
periodStartTime = gst_mpd_parser_get_period_start_time (mpdclient);
|
||||||
|
assert_equals_uint64 (periodStartTime, 10 * GST_SECOND);
|
||||||
|
|
||||||
nextFragmentDuration =
|
nextFragmentDuration =
|
||||||
gst_mpd_client_get_next_fragment_duration (mpdclient, activeStream);
|
gst_mpd_client_get_next_fragment_duration (mpdclient, activeStream);
|
||||||
assert_equals_uint64 (nextFragmentDuration, expectedDuration * GST_MSECOND);
|
assert_equals_uint64 (nextFragmentDuration, expectedDuration * GST_MSECOND);
|
||||||
@ -3902,7 +3906,7 @@ GST_START_TEST (dash_mpdparser_inherited_segmentURL)
|
|||||||
* We expect duration to be 110
|
* We expect duration to be 110
|
||||||
*/
|
*/
|
||||||
expectedDuration = duration_to_ms (0, 0, 0, 0, 0, 110, 0);
|
expectedDuration = duration_to_ms (0, 0, 0, 0, 0, 110, 0);
|
||||||
expectedTimestamp = duration_to_ms (0, 0, 0, 0, 0, 10, 0);
|
expectedTimestamp = duration_to_ms (0, 0, 0, 0, 0, 0, 0);
|
||||||
|
|
||||||
/* the representation contains 2 segments
|
/* the representation contains 2 segments
|
||||||
* - one inherited from AdaptationSet (duration 100)
|
* - one inherited from AdaptationSet (duration 100)
|
||||||
@ -4007,7 +4011,7 @@ GST_START_TEST (dash_mpdparser_segment_list)
|
|||||||
* We expect it to be limited to period duration.
|
* We expect it to be limited to period duration.
|
||||||
*/
|
*/
|
||||||
expectedDuration = duration_to_ms (0, 0, 0, 3, 3, 20, 0);
|
expectedDuration = duration_to_ms (0, 0, 0, 3, 3, 20, 0);
|
||||||
expectedTimestamp = duration_to_ms (0, 0, 0, 0, 0, 10, 0);
|
expectedTimestamp = duration_to_ms (0, 0, 0, 0, 0, 0, 0);
|
||||||
|
|
||||||
ret = gst_mpd_client_get_next_fragment (mpdclient, 0, &fragment);
|
ret = gst_mpd_client_get_next_fragment (mpdclient, 0, &fragment);
|
||||||
assert_equals_int (ret, TRUE);
|
assert_equals_int (ret, TRUE);
|
||||||
@ -4039,6 +4043,7 @@ GST_START_TEST (dash_mpdparser_segment_template)
|
|||||||
GstMediaFragmentInfo fragment;
|
GstMediaFragmentInfo fragment;
|
||||||
GstClockTime expectedDuration;
|
GstClockTime expectedDuration;
|
||||||
GstClockTime expectedTimestamp;
|
GstClockTime expectedTimestamp;
|
||||||
|
GstClockTime periodStartTime;
|
||||||
const gchar *xml =
|
const gchar *xml =
|
||||||
"<?xml version=\"1.0\"?>"
|
"<?xml version=\"1.0\"?>"
|
||||||
"<MPD xmlns=\"urn:mpeg:dash:schema:mpd:2011\""
|
"<MPD xmlns=\"urn:mpeg:dash:schema:mpd:2011\""
|
||||||
@ -4103,6 +4108,9 @@ GST_START_TEST (dash_mpdparser_segment_template)
|
|||||||
assert_equals_uint64 (fragment.duration, expectedDuration * GST_MSECOND);
|
assert_equals_uint64 (fragment.duration, expectedDuration * GST_MSECOND);
|
||||||
assert_equals_uint64 (fragment.timestamp, expectedTimestamp * GST_MSECOND);
|
assert_equals_uint64 (fragment.timestamp, expectedTimestamp * GST_MSECOND);
|
||||||
|
|
||||||
|
periodStartTime = gst_mpd_parser_get_period_start_time (mpdclient);
|
||||||
|
assert_equals_uint64 (periodStartTime, 10 * GST_SECOND);
|
||||||
|
|
||||||
gst_media_fragment_info_clear (&fragment);
|
gst_media_fragment_info_clear (&fragment);
|
||||||
|
|
||||||
gst_mpd_client_free (mpdclient);
|
gst_mpd_client_free (mpdclient);
|
||||||
@ -4177,7 +4185,7 @@ GST_START_TEST (dash_mpdparser_segment_timeline)
|
|||||||
|
|
||||||
/* expected duration of the next fragment */
|
/* expected duration of the next fragment */
|
||||||
expectedDuration = duration_to_ms (0, 0, 0, 0, 0, 2, 0);
|
expectedDuration = duration_to_ms (0, 0, 0, 0, 0, 2, 0);
|
||||||
expectedTimestamp = duration_to_ms (0, 0, 0, 0, 0, 13, 0);
|
expectedTimestamp = duration_to_ms (0, 0, 0, 0, 0, 3, 0);
|
||||||
|
|
||||||
ret = gst_mpd_client_get_next_fragment (mpdclient, 0, &fragment);
|
ret = gst_mpd_client_get_next_fragment (mpdclient, 0, &fragment);
|
||||||
assert_equals_int (ret, TRUE);
|
assert_equals_int (ret, TRUE);
|
||||||
@ -4209,11 +4217,9 @@ GST_START_TEST (dash_mpdparser_segment_timeline)
|
|||||||
flow = gst_mpd_client_advance_segment (mpdclient, activeStream, TRUE);
|
flow = gst_mpd_client_advance_segment (mpdclient, activeStream, TRUE);
|
||||||
assert_equals_int (flow, GST_FLOW_OK);
|
assert_equals_int (flow, GST_FLOW_OK);
|
||||||
|
|
||||||
/* third segment has a small gap after the second ends (t=10)
|
/* third segment has a small gap after the second ends (t=10) */
|
||||||
* We also need to take into consideration period's start (10)
|
|
||||||
*/
|
|
||||||
expectedDuration = duration_to_ms (0, 0, 0, 0, 0, 3, 0);
|
expectedDuration = duration_to_ms (0, 0, 0, 0, 0, 3, 0);
|
||||||
expectedTimestamp = duration_to_ms (0, 0, 0, 0, 0, 20, 0);
|
expectedTimestamp = duration_to_ms (0, 0, 0, 0, 0, 10, 0);
|
||||||
|
|
||||||
/* check third segment */
|
/* check third segment */
|
||||||
ret = gst_mpd_client_get_next_fragment (mpdclient, 0, &fragment);
|
ret = gst_mpd_client_get_next_fragment (mpdclient, 0, &fragment);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user