Commit d02f9d30 authored by Florin Apostol's avatar Florin Apostol Committed by Sebastian Dröge
Browse files

tests: dashdemux: corrected return type for duration_to_ms function

The duration_to_ms function converts a time specified by year, month, day,
hour, minute, second, millisecond to a millisecond value. Because all the
arguments are positive numbers, the result must also be positive.

This patch changes the returned value from a gint64 to a guint64 type.
parent 4b40c410
......@@ -32,15 +32,15 @@ GST_DEBUG_CATEGORY (gst_dash_demux_debug);
* This function must use the same conversion algorithm implemented in
* gst_mpdparser_get_xml_prop_duration from gstmpdparser.c file.
*/
static gint64
static guint64
duration_to_ms (guint year, guint month, guint day, guint hour, guint minute,
guint second, guint millisecond)
{
gint64 days = (gint64) year * 365 + month * 30 + day;
gint64 hours = days * 24 + hour;
gint64 minutes = hours * 60 + minute;
gint64 seconds = minutes * 60 + second;
gint64 ms = seconds * 1000 + millisecond;
guint64 days = (guint64) year * 365 + (guint64) month * 30 + day;
guint64 hours = days * 24 + hour;
guint64 minutes = hours * 60 + minute;
guint64 seconds = minutes * 60 + second;
guint64 ms = seconds * 1000 + millisecond;
return ms;
}
......@@ -130,25 +130,25 @@ GST_START_TEST (dash_mpdparser_mpd)
assert_equals_int (gst_date_time_get_second (availabilityEndTime), 50);
assert_equals_int64 (mpdclient->mpd_node->mediaPresentationDuration,
duration_to_ms (0, 1, 2, 12, 10, 20, 500));
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
assert_equals_int64 (mpdclient->mpd_node->minimumUpdatePeriod,
duration_to_ms (0, 1, 2, 12, 10, 20, 500));
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
assert_equals_int64 (mpdclient->mpd_node->minBufferTime,
duration_to_ms (0, 1, 2, 12, 10, 20, 500));
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
assert_equals_int64 (mpdclient->mpd_node->timeShiftBufferDepth,
duration_to_ms (0, 1, 2, 12, 10, 20, 500));
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
assert_equals_int64 (mpdclient->mpd_node->suggestedPresentationDelay,
duration_to_ms (0, 1, 2, 12, 10, 20, 500));
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
assert_equals_int64 (mpdclient->mpd_node->maxSegmentDuration,
duration_to_ms (0, 1, 2, 12, 10, 20, 500));
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
assert_equals_int64 (mpdclient->mpd_node->maxSubsegmentDuration,
duration_to_ms (0, 1, 2, 12, 10, 20, 500));
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
gst_mpd_client_free (mpdclient);
}
......@@ -299,9 +299,9 @@ GST_START_TEST (dash_mpdparser_metrics_range)
assert_equals_pointer (metricsNode->metrics, NULL);
metricsRangeNode = (GstMetricsRangeNode *) metricsNode->MetricsRanges->data;
assert_equals_int64 (metricsRangeNode->starttime,
duration_to_ms (0, 1, 2, 12, 10, 20, 500));
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
assert_equals_int64 (metricsRangeNode->duration,
duration_to_ms (0, 1, 2, 12, 10, 20, 123));
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 123));
gst_mpd_client_free (mpdclient);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment