From d02f9d30af0191835f24a514360bd9045f7feeb8 Mon Sep 17 00:00:00 2001 From: Florin Apostol Date: Mon, 15 Jun 2015 16:59:33 +0100 Subject: 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. --- tests/check/elements/dash_mpd.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/check/elements/dash_mpd.c b/tests/check/elements/dash_mpd.c index ebb4e998b..2b5015898 100644 --- a/tests/check/elements/dash_mpd.c +++ b/tests/check/elements/dash_mpd.c @@ -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); } -- cgit v1.2.1