dashdemux2: Remove bogus limitation checks for duration fields
authorEdward Hervey <edward@centricular.com>
Tue, 30 Aug 2022 09:45:05 +0000 (11:45 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Wed, 7 Sep 2022 12:48:28 +0000 (12:48 +0000)
Just like for the seconds field, there are no limitations on the hours and
minutes fields. The specification for xml schema duration fields doesn't forbid
specifying durations with only (huge) minutes or hours values.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2951>

subprojects/gst-plugins-good/ext/adaptivedemux2/dash/gstxmlhelper.c
subprojects/gst-plugins-good/tests/check/elements/dash_mpd.c

index fac3dae..084be27 100644 (file)
@@ -198,10 +198,6 @@ _mpd_helper_parse_duration (const char *str, guint64 * value)
             goto error;
           }
           hours = read;
-          if (hours >= 24) {
-            GST_WARNING ("Hour out of range");
-            goto error;
-          }
           break;
         case 'M':
           if (minutes != -1 || seconds != -1) {
@@ -209,10 +205,6 @@ _mpd_helper_parse_duration (const char *str, guint64 * value)
             goto error;
           }
           minutes = read;
-          if (minutes >= 60) {
-            GST_WARNING ("Minute out of range");
-            goto error;
-          }
           break;
         case 'S':
           if (have_ms) {
index 22b9c55..23342dd 100644 (file)
@@ -5732,11 +5732,10 @@ GST_START_TEST (dash_mpdparser_duration)
   fail_unless (_mpd_helper_parse_duration ("P35D", &v) == FALSE);
   fail_unless (_mpd_helper_parse_duration ("P-1Y", &v) == FALSE);
   fail_unless (_mpd_helper_parse_duration ("PT-1H", &v) == FALSE);
-  fail_unless (_mpd_helper_parse_duration ("PT25H", &v) == FALSE);
+  fail_unless (_mpd_helper_parse_duration ("PT25H", &v) == TRUE);
   fail_unless (_mpd_helper_parse_duration ("PT-1M", &v) == FALSE);
-  fail_unless (_mpd_helper_parse_duration ("PT65M", &v) == FALSE);
+  fail_unless (_mpd_helper_parse_duration ("PT65M", &v) == TRUE);
   fail_unless (_mpd_helper_parse_duration ("PT-1S", &v) == FALSE);
-  /* seconds are allowed to be larger than 60 */
   fail_unless (_mpd_helper_parse_duration ("PT65S", &v) == TRUE);
 
   fail_unless (_mpd_helper_parse_duration ("PT1.1H", &v) == FALSE);