mpdparser: make durations unsigned where appropriate
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Thu, 29 Oct 2015 11:38:35 +0000 (11:38 +0000)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Fri, 30 Oct 2015 16:29:46 +0000 (16:29 +0000)
The standard does not seem to make any particular explicit not
implicit reference to the signedness of durations, and the code
does not rely on such, nor on the negativity of the -1 value
that's used as a placeholder when a duration property is not
present in the XML.

https://bugzilla.gnome.org/show_bug.cgi?id=750847

ext/dash/gstmpdparser.c
ext/dash/gstmpdparser.h
tests/check/elements/dash_mpd.c

index 27bf1df..27846f0 100644 (file)
@@ -72,7 +72,8 @@ static gboolean gst_mpdparser_get_xml_prop_cond_uint (xmlNode * a_node,
 static gboolean gst_mpdparser_get_xml_prop_dateTime (xmlNode * a_node,
     const gchar * property_name, GstDateTime ** property_value);
 static gboolean gst_mpdparser_get_xml_prop_duration (xmlNode * a_node,
-    const gchar * property_name, gint64 default_value, gint64 * property_value);
+    const gchar * property_name, guint64 default_value,
+    guint64 * property_value);
 static gboolean gst_mpdparser_get_xml_node_content (xmlNode * a_node,
     gchar ** content);
 static gchar *gst_mpdparser_get_xml_node_namespace (xmlNode * a_node,
@@ -127,7 +128,7 @@ static void gst_mpdparser_parse_utctiming_node (GList ** list,
     xmlNode * a_node);
 
 /* Helper functions */
-static gint convert_to_millisecs (gint decimals, gint pos);
+static guint convert_to_millisecs (guint decimals, gint pos);
 static int strncmp_ext (const char *s1, const char *s2);
 static GstStreamPeriod *gst_mpdparser_get_stream_period (GstMpdClient * client);
 static GstSNode *gst_mpdparser_clone_s_node (GstSNode * pointer);
@@ -146,11 +147,12 @@ static const gchar *gst_mpdparser_get_initializationURL (GstActiveStream *
 static gchar *gst_mpdparser_build_URL_from_template (const gchar * url_template,
     const gchar * id, guint number, guint bandwidth, guint64 time);
 static gboolean gst_mpd_client_add_media_segment (GstActiveStream * stream,
-    GstSegmentURLNode * url_node, guint number, gint repeat, gint64 scale_start,
-    gint64 scale_duration, GstClockTime start, GstClockTime duration);
+    GstSegmentURLNode * url_node, guint number, gint repeat,
+    guint64 scale_start, guint64 scale_duration, GstClockTime start,
+    GstClockTime duration);
 static const gchar *gst_mpdparser_mimetype_to_caps (const gchar * mimeType);
 static GstClockTime gst_mpd_client_get_segment_duration (GstMpdClient * client,
-    GstActiveStream * stream, gint64 * scale_duration);
+    GstActiveStream * stream, guint64 * scale_duration);
 static GstDateTime *gst_mpd_client_get_availability_start_time (GstMpdClient *
     client);
 
@@ -919,10 +921,11 @@ error:
 */
 
 /* this function computes decimals * 10 ^ (3 - pos) */
-static gint
-convert_to_millisecs (gint decimals, gint pos)
+static guint
+convert_to_millisecs (guint decimals, gint pos)
 {
-  gint num = 1, den = 1, i = 3 - pos;
+  guint num = 1, den = 1;
+  gint i = 3 - pos;
 
   while (i < 0) {
     den *= 10;
@@ -937,16 +940,15 @@ convert_to_millisecs (gint decimals, gint pos)
 }
 
 static gboolean
-gst_mpdparser_get_xml_prop_duration_inner (xmlNode * a_node,
-    const gchar * property_name, gint64 default_value, gint64 * property_value,
-    gboolean allow_negative)
+gst_mpdparser_get_xml_prop_duration (xmlNode * a_node,
+    const gchar * property_name, guint64 default_value,
+    guint64 * property_value)
 {
   xmlChar *prop_string;
   gchar *str;
-  gint ret, read, len, pos, posT;
-  gint years = 0, months = 0, days = 0, hours = 0, minutes = 0, seconds =
-      0, decimals = 0;
-  gint sign = 1;
+  gint ret, len, pos, posT;
+  guint years = 0, months = 0, days = 0, hours = 0, minutes = 0, seconds =
+      0, decimals = 0, read;
   gboolean have_ms = FALSE;
   gboolean exists = FALSE;
 
@@ -956,26 +958,9 @@ gst_mpdparser_get_xml_prop_duration_inner (xmlNode * a_node,
     len = xmlStrlen (prop_string);
     str = (gchar *) prop_string;
     GST_TRACE ("duration: %s, len %d", str, len);
-    /* read "-" for sign, if present */
-    pos = strcspn (str, "-");
-    if (pos < len) {            /* found "-" */
-      if (pos != 0) {
-        GST_WARNING ("sign \"-\" non at the beginning of the string");
-        goto error;
-      }
-      GST_TRACE ("found - sign at the beginning");
-      if (!allow_negative) {
-        GST_WARNING ("sign \"-\" not allowed for property '%s'", property_name);
-        goto error;
-      }
-      sign = -1;
-      str++;
-      len--;
-      /* look for another "-" sign */
-      if (strcspn (str, "-") != len) {
-        GST_WARNING ("found a second \"-\" sign");
-        goto error;
-      }
+    if (strchr (str, '-') != NULL) {
+      GST_WARNING ("'-' sign found while parsing unsigned duration");
+      goto error;
     }
     /* read "P" for period */
     pos = strcspn (str, "P");
@@ -994,7 +979,7 @@ gst_mpdparser_get_xml_prop_duration_inner (xmlNode * a_node,
       do {
         GST_TRACE ("parsing substring %s", str);
         pos = strcspn (str, "YMD");
-        ret = sscanf (str, "%d", &read);
+        ret = sscanf (str, "%u", &read);
         if (ret != 1) {
           GST_WARNING ("can not read integer value from string %s!", str);
           goto error;
@@ -1014,12 +999,12 @@ gst_mpdparser_get_xml_prop_duration_inner (xmlNode * a_node,
             goto error;
             break;
         }
-        GST_TRACE ("read number %d type %c", read, str[pos]);
+        GST_TRACE ("read number %u type %c", read, str[pos]);
         str += (pos + 1);
         posT -= (pos + 1);
       } while (posT > 0);
 
-      GST_TRACE ("Y:M:D=%d:%d:%d", years, months, days);
+      GST_TRACE ("Y:M:D=%u:%u:%u", years, months, days);
     }
     /* read "T" for time (if present) */
     /* here T is at pos == 0 */
@@ -1032,7 +1017,7 @@ gst_mpdparser_get_xml_prop_duration_inner (xmlNode * a_node,
       do {
         GST_TRACE ("parsing substring %s", str);
         pos = strcspn (str, "HMS,.");
-        ret = sscanf (str, "%d", &read);
+        ret = sscanf (str, "%u", &read);
         if (ret != 1) {
           GST_WARNING ("can not read integer value from string %s!", str);
           goto error;
@@ -1048,7 +1033,7 @@ gst_mpdparser_get_xml_prop_duration_inner (xmlNode * a_node,
             if (have_ms) {
               /* we have read the decimal part of the seconds */
               decimals = convert_to_millisecs (read, pos);
-              GST_TRACE ("decimal number %d (%d digits) -> %d ms", read, pos,
+              GST_TRACE ("decimal number %u (%d digits) -> %d ms", read, pos,
                   decimals);
             } else {
               /* no decimals */
@@ -1066,20 +1051,20 @@ gst_mpdparser_get_xml_prop_duration_inner (xmlNode * a_node,
             goto error;
             break;
         }
-        GST_TRACE ("read number %d type %c", read, str[pos]);
+        GST_TRACE ("read number %u type %c", read, str[pos]);
         str += pos + 1;
         len -= (pos + 1);
       } while (len > 0);
 
-      GST_TRACE ("H:M:S.MS=%d:%d:%d.%03d", hours, minutes, seconds, decimals);
+      GST_TRACE ("H:M:S.MS=%u:%u:%u.%03u", hours, minutes, seconds, decimals);
     }
 
     xmlFree (prop_string);
     exists = TRUE;
     *property_value =
-        sign * ((((((gint64) years * 365 + months * 30 + days) * 24 +
-                    hours) * 60 + minutes) * 60 + seconds) * 1000 + decimals);
-    GST_LOG (" - %s: %" G_GINT64_FORMAT, property_name, *property_value);
+        (((((guint64) years * 365 + months * 30 + days) * 24 +
+                hours) * 60 + minutes) * 60 + seconds) * 1000 + decimals;
+    GST_LOG (" - %s: %" G_GUINT64_FORMAT, property_name, *property_value);
   }
 
   return exists;
@@ -1090,22 +1075,6 @@ error:
 }
 
 static gboolean
-gst_mpdparser_get_xml_prop_duration (xmlNode * a_node,
-    const gchar * property_name, gint64 default_value, gint64 * property_value)
-{
-  return gst_mpdparser_get_xml_prop_duration_inner (a_node, property_name,
-      default_value, property_value, TRUE);
-}
-
-static gboolean
-gst_mpdparser_get_xml_prop_duration_unsigned (xmlNode * a_node,
-    const gchar * property_name, gint64 default_value, gint64 * property_value)
-{
-  return gst_mpdparser_get_xml_prop_duration_inner (a_node, property_name,
-      default_value, property_value, FALSE);
-}
-
-static gboolean
 gst_mpdparser_get_xml_node_content (xmlNode * a_node, gchar ** content)
 {
   xmlChar *node_content = NULL;
@@ -1972,11 +1941,12 @@ gst_mpdparser_parse_period_node (GList ** list, xmlNode * a_node)
   }
 
   gst_mpdparser_get_xml_prop_string (a_node, "id", &new_period->id);
-  gst_mpdparser_get_xml_prop_duration (a_node, "start", -1, &new_period->start);
-  gst_mpdparser_get_xml_prop_duration (a_node, "duration", -1,
-      &new_period->duration);
-  gst_mpdparser_get_xml_prop_boolean (a_node, "bitstreamSwitching",
-      FALSE, &new_period->bitstreamSwitching);
+  gst_mpdparser_get_xml_prop_duration (a_node, "start", GST_MPD_DURATION_NONE,
+      &new_period->start);
+  gst_mpdparser_get_xml_prop_duration (a_node, "duration",
+      GST_MPD_DURATION_NONE, &new_period->duration);
+  gst_mpdparser_get_xml_prop_boolean (a_node, "bitstreamSwitching", FALSE,
+      &new_period->bitstreamSwitching);
 
   /* explore children nodes */
   for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
@@ -2061,10 +2031,10 @@ gst_mpdparser_parse_metrics_range_node (GList ** list, xmlNode * a_node)
   *list = g_list_append (*list, new_metrics_range);
 
   GST_LOG ("attributes of Metrics Range node:");
-  gst_mpdparser_get_xml_prop_duration (a_node, "starttime", -1,
-      &new_metrics_range->starttime);
-  gst_mpdparser_get_xml_prop_duration (a_node, "duration", -1,
-      &new_metrics_range->duration);
+  gst_mpdparser_get_xml_prop_duration (a_node, "starttime",
+      GST_MPD_DURATION_NONE, &new_metrics_range->starttime);
+  gst_mpdparser_get_xml_prop_duration (a_node, "duration",
+      GST_MPD_DURATION_NONE, &new_metrics_range->duration);
 }
 
 static void
@@ -2162,20 +2132,20 @@ gst_mpdparser_parse_root_node (GstMPDNode ** pointer, xmlNode * a_node)
       &new_mpd->availabilityStartTime);
   gst_mpdparser_get_xml_prop_dateTime (a_node, "availabilityEndTime",
       &new_mpd->availabilityEndTime);
-  gst_mpdparser_get_xml_prop_duration (a_node, "mediaPresentationDuration", -1,
-      &new_mpd->mediaPresentationDuration);
-  gst_mpdparser_get_xml_prop_duration (a_node, "minimumUpdatePeriod", -1,
-      &new_mpd->minimumUpdatePeriod);
-  gst_mpdparser_get_xml_prop_duration (a_node, "minBufferTime", -1,
-      &new_mpd->minBufferTime);
-  gst_mpdparser_get_xml_prop_duration (a_node, "timeShiftBufferDepth", -1,
-      &new_mpd->timeShiftBufferDepth);
-  gst_mpdparser_get_xml_prop_duration_unsigned (a_node,
-      "suggestedPresentationDelay", -1, &new_mpd->suggestedPresentationDelay);
-  gst_mpdparser_get_xml_prop_duration (a_node, "maxSegmentDuration", -1,
-      &new_mpd->maxSegmentDuration);
-  gst_mpdparser_get_xml_prop_duration (a_node, "maxSubsegmentDuration", -1,
-      &new_mpd->maxSubsegmentDuration);
+  gst_mpdparser_get_xml_prop_duration (a_node, "mediaPresentationDuration",
+      GST_MPD_DURATION_NONE, &new_mpd->mediaPresentationDuration);
+  gst_mpdparser_get_xml_prop_duration (a_node, "minimumUpdatePeriod",
+      GST_MPD_DURATION_NONE, &new_mpd->minimumUpdatePeriod);
+  gst_mpdparser_get_xml_prop_duration (a_node, "minBufferTime",
+      GST_MPD_DURATION_NONE, &new_mpd->minBufferTime);
+  gst_mpdparser_get_xml_prop_duration (a_node, "timeShiftBufferDepth",
+      GST_MPD_DURATION_NONE, &new_mpd->timeShiftBufferDepth);
+  gst_mpdparser_get_xml_prop_duration (a_node, "suggestedPresentationDelay",
+      GST_MPD_DURATION_NONE, &new_mpd->suggestedPresentationDelay);
+  gst_mpdparser_get_xml_prop_duration (a_node, "maxSegmentDuration",
+      GST_MPD_DURATION_NONE, &new_mpd->maxSegmentDuration);
+  gst_mpdparser_get_xml_prop_duration (a_node, "maxSubsegmentDuration",
+      GST_MPD_DURATION_NONE, &new_mpd->maxSubsegmentDuration);
 
   /* explore children Period nodes */
   for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
@@ -3348,7 +3318,7 @@ gst_mpdparser_parse_baseURL (GstMpdClient * client, GstActiveStream * stream,
 
 static GstClockTime
 gst_mpd_client_get_segment_duration (GstMpdClient * client,
-    GstActiveStream * stream, gint64 * scale_dur)
+    GstActiveStream * stream, guint64 * scale_dur)
 {
   GstStreamPeriod *stream_period;
   GstMultSegmentBaseType *base = NULL;
@@ -3760,7 +3730,7 @@ gst_mpdparser_get_chunk_by_index (GstMpdClient * client, guint indexStream,
   } else {
     GstClockTime duration;
     GstStreamPeriod *stream_period;
-    gint64 scale_dur;
+    guint64 scale_dur;
 
     g_return_val_if_fail (stream->cur_seg_template->MultSegBaseType->
         SegmentTimeline == NULL, FALSE);
@@ -3789,7 +3759,7 @@ gst_mpdparser_get_chunk_by_index (GstMpdClient * client, guint indexStream,
 static gboolean
 gst_mpd_client_add_media_segment (GstActiveStream * stream,
     GstSegmentURLNode * url_node, guint number, gint repeat,
-    gint64 scale_start, gint64 scale_duration,
+    guint64 scale_start, guint64 scale_duration,
     GstClockTime start, GstClockTime duration)
 {
   GstMediaSegment *media_segment;
@@ -3932,7 +3902,7 @@ gst_mpd_client_setup_representation (GstMpdClient * client,
           SegmentURL = g_list_next (SegmentURL);
         }
       } else {
-        gint64 scale_dur;
+        guint64 scale_dur;
 
         duration =
             gst_mpd_client_get_segment_duration (client, stream, &scale_dur);
index f76b379..13b9b61 100644 (file)
@@ -67,6 +67,8 @@ typedef struct _GstMultSegmentBaseType    GstMultSegmentBaseType;
 #define GST_MPD_CLIENT_LOCK(c) g_mutex_lock (&c->lock);
 #define GST_MPD_CLIENT_UNLOCK(c) g_mutex_unlock (&c->lock);
 
+#define GST_MPD_DURATION_NONE ((guint64)-1)
+
 typedef enum
 {
   GST_STREAM_UNKNOWN,
@@ -346,8 +348,8 @@ struct _GstSubsetNode
 struct _GstPeriodNode
 {
   gchar *id;
-  gint64 start;                      /* [ms] */
-  gint64 duration;                   /* [ms] */
+  guint64 start;                     /* [ms] */
+  guint64 duration;                  /* [ms] */
   gboolean bitstreamSwitching;
   /* SegmentBase node */
   GstSegmentBaseType *SegmentBase;
@@ -378,8 +380,8 @@ struct _GstProgramInformationNode
 
 struct _GstMetricsRangeNode
 {
-  gint64 starttime;                  /* [ms] */
-  gint64 duration;                   /* [ms] */
+  guint64 starttime;                 /* [ms] */
+  guint64 duration;                  /* [ms] */
 };
 
 struct _GstMetricsNode
@@ -408,13 +410,13 @@ struct _GstMPDNode
   GstMPDFileType type;
   GstDateTime *availabilityStartTime;
   GstDateTime *availabilityEndTime;
-  gint64 mediaPresentationDuration;  /* [ms] */
-  gint64 minimumUpdatePeriod;        /* [ms] */
-  gint64 minBufferTime;              /* [ms] */
-  gint64 timeShiftBufferDepth;       /* [ms] */
-  gint64 suggestedPresentationDelay; /* [ms] */
-  gint64 maxSegmentDuration;         /* [ms] */
-  gint64 maxSubsegmentDuration;      /* [ms] */
+  guint64 mediaPresentationDuration;  /* [ms] */
+  guint64 minimumUpdatePeriod;        /* [ms] */
+  guint64 minBufferTime;              /* [ms] */
+  guint64 timeShiftBufferDepth;       /* [ms] */
+  guint64 suggestedPresentationDelay; /* [ms] */
+  guint64 maxSegmentDuration;         /* [ms] */
+  guint64 maxSubsegmentDuration;      /* [ms] */
   /* list of BaseURL nodes */
   GList *BaseURLs;
   /* list of Location nodes */
@@ -452,8 +454,8 @@ struct _GstMediaSegment
   GstSegmentURLNode *SegmentURL;              /* this is NULL when using a SegmentTemplate */
   guint number;                               /* segment number */
   gint repeat;                                /* number of extra repetitions (0 = played only once) */
-  gint64 scale_start;                         /* start time in timescale units */
-  gint64 scale_duration;                      /* duration in timescale units */
+  guint64 scale_start;                        /* start time in timescale units */
+  guint64 scale_duration;                     /* duration in timescale units */
   GstClockTime start;                         /* segment start time */
   GstClockTime duration;                      /* segment duration */
 };
index b6ab30e..613556b 100644 (file)
@@ -128,26 +128,26 @@ GST_START_TEST (dash_mpdparser_mpd)
   assert_equals_int (gst_date_time_get_minute (availabilityEndTime), 10);
   assert_equals_int (gst_date_time_get_second (availabilityEndTime), 50);
 
-  assert_equals_int64 (mpdclient->mpd_node->mediaPresentationDuration,
-      (gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
+  assert_equals_uint64 (mpdclient->mpd_node->mediaPresentationDuration,
+      duration_to_ms (0, 1, 2, 12, 10, 20, 500));
 
-  assert_equals_int64 (mpdclient->mpd_node->minimumUpdatePeriod,
-      (gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
+  assert_equals_uint64 (mpdclient->mpd_node->minimumUpdatePeriod,
+      duration_to_ms (0, 1, 2, 12, 10, 20, 500));
 
-  assert_equals_int64 (mpdclient->mpd_node->minBufferTime,
-      (gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
+  assert_equals_uint64 (mpdclient->mpd_node->minBufferTime,
+      duration_to_ms (0, 1, 2, 12, 10, 20, 500));
 
-  assert_equals_int64 (mpdclient->mpd_node->timeShiftBufferDepth,
-      (gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
+  assert_equals_uint64 (mpdclient->mpd_node->timeShiftBufferDepth,
+      duration_to_ms (0, 1, 2, 12, 10, 20, 500));
 
-  assert_equals_int64 (mpdclient->mpd_node->suggestedPresentationDelay,
-      (gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
+  assert_equals_uint64 (mpdclient->mpd_node->suggestedPresentationDelay,
+      duration_to_ms (0, 1, 2, 12, 10, 20, 500));
 
-  assert_equals_int64 (mpdclient->mpd_node->maxSegmentDuration,
-      (gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
+  assert_equals_uint64 (mpdclient->mpd_node->maxSegmentDuration,
+      duration_to_ms (0, 1, 2, 12, 10, 20, 500));
 
-  assert_equals_int64 (mpdclient->mpd_node->maxSubsegmentDuration,
-      (gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
+  assert_equals_uint64 (mpdclient->mpd_node->maxSubsegmentDuration,
+      duration_to_ms (0, 1, 2, 12, 10, 20, 500));
 
   gst_mpd_client_free (mpdclient);
 }
@@ -301,10 +301,10 @@ GST_START_TEST (dash_mpdparser_metrics_range)
   metricsNode = (GstMetricsNode *) mpdclient->mpd_node->Metrics->data;
   assert_equals_pointer (metricsNode->metrics, NULL);
   metricsRangeNode = (GstMetricsRangeNode *) metricsNode->MetricsRanges->data;
-  assert_equals_int64 (metricsRangeNode->starttime,
-      (gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
-  assert_equals_int64 (metricsRangeNode->duration,
-      (gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 123));
+  assert_equals_uint64 (metricsRangeNode->starttime,
+      duration_to_ms (0, 1, 2, 12, 10, 20, 500));
+  assert_equals_uint64 (metricsRangeNode->duration,
+      duration_to_ms (0, 1, 2, 12, 10, 20, 123));
 
   gst_mpd_client_free (mpdclient);
 }
@@ -362,10 +362,10 @@ GST_START_TEST (dash_mpdparser_period)
 
   periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data;
   assert_equals_string (periodNode->id, "TestId");
-  assert_equals_int64 (periodNode->start,
-      (gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 123));
-  assert_equals_int64 (periodNode->duration,
-      (gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 765));
+  assert_equals_uint64 (periodNode->start,
+      duration_to_ms (0, 1, 2, 12, 10, 20, 123));
+  assert_equals_uint64 (periodNode->duration,
+      duration_to_ms (0, 1, 2, 12, 10, 20, 765));
   assert_equals_int (periodNode->bitstreamSwitching, 1);
 
   gst_mpd_client_free (mpdclient);
@@ -2728,50 +2728,50 @@ GST_START_TEST (dash_mpdparser_various_duration_formats)
   periodNode =
       (GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 0);
   assert_equals_string (periodNode->id, "Period0");
-  assert_equals_int64 (periodNode->start,
-      (gint64) duration_to_ms (0, 0, 0, 0, 0, 1, 0));
+  assert_equals_uint64 (periodNode->start,
+      duration_to_ms (0, 0, 0, 0, 0, 1, 0));
 
   periodNode =
       (GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 1);
   assert_equals_string (periodNode->id, "Period1");
-  assert_equals_int64 (periodNode->start,
-      (gint64) duration_to_ms (0, 0, 0, 0, 0, 1, 500));
+  assert_equals_uint64 (periodNode->start,
+      duration_to_ms (0, 0, 0, 0, 0, 1, 500));
 
   periodNode =
       (GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 2);
   assert_equals_string (periodNode->id, "Period2");
-  assert_equals_int64 (periodNode->start,
-      (gint64) duration_to_ms (0, 0, 0, 0, 0, 1, 700));
+  assert_equals_uint64 (periodNode->start,
+      duration_to_ms (0, 0, 0, 0, 0, 1, 700));
 
   periodNode =
       (GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 3);
   assert_equals_string (periodNode->id, "Period3");
-  assert_equals_int64 (periodNode->start,
-      (gint64) duration_to_ms (0, 0, 0, 0, 1, 0, 0));
+  assert_equals_uint64 (periodNode->start,
+      duration_to_ms (0, 0, 0, 0, 1, 0, 0));
 
   periodNode =
       (GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 4);
   assert_equals_string (periodNode->id, "Period4");
-  assert_equals_int64 (periodNode->start,
-      (gint64) duration_to_ms (0, 0, 0, 1, 0, 0, 0));
+  assert_equals_uint64 (periodNode->start,
+      duration_to_ms (0, 0, 0, 1, 0, 0, 0));
 
   periodNode =
       (GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 5);
   assert_equals_string (periodNode->id, "Period5");
-  assert_equals_int64 (periodNode->start,
-      (gint64) duration_to_ms (0, 0, 1, 0, 0, 0, 0));
+  assert_equals_uint64 (periodNode->start,
+      duration_to_ms (0, 0, 1, 0, 0, 0, 0));
 
   periodNode =
       (GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 6);
   assert_equals_string (periodNode->id, "Period6");
-  assert_equals_int64 (periodNode->start,
-      (gint64) duration_to_ms (0, 1, 0, 0, 0, 0, 0));
+  assert_equals_uint64 (periodNode->start,
+      duration_to_ms (0, 1, 0, 0, 0, 0, 0));
 
   periodNode =
       (GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 7);
   assert_equals_string (periodNode->id, "Period7");
-  assert_equals_int64 (periodNode->start,
-      (gint64) duration_to_ms (1, 0, 0, 0, 0, 0, 0));
+  assert_equals_uint64 (periodNode->start,
+      duration_to_ms (1, 0, 0, 0, 0, 0, 0));
 
   gst_mpd_client_free (mpdclient);
 }