Title: [235848] trunk/Source/WebCore
Revision
235848
Author
[email protected]
Date
2018-09-10 07:04:32 -0700 (Mon, 10 Sep 2018)

Log Message

[GStreamer] Fix overflow in buffered ranges
https://bugs.webkit.org/show_bug.cgi?id=189419

Reviewed by Philippe Normand.

Scale operations on big numbers (like media timestamps or durations)
should be made with GStreamer utility functions to avoid overflows.

This fixes an assertion when a 24 hour long fragmented MP4 file is
played.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::buffered const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (235847 => 235848)


--- trunk/Source/WebCore/ChangeLog	2018-09-10 12:00:59 UTC (rev 235847)
+++ trunk/Source/WebCore/ChangeLog	2018-09-10 14:04:32 UTC (rev 235848)
@@ -1,3 +1,19 @@
+2018-09-10  Alicia Boya GarcĂ­a  <[email protected]>
+
+        [GStreamer] Fix overflow in buffered ranges
+        https://bugs.webkit.org/show_bug.cgi?id=189419
+
+        Reviewed by Philippe Normand.
+
+        Scale operations on big numbers (like media timestamps or durations)
+        should be made with GStreamer utility functions to avoid overflows.
+
+        This fixes an assertion when a 24 hour long fragmented MP4 file is
+        played.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::buffered const):
+
 2018-09-07  Frederic Wang  <[email protected]>
 
         Refactor filter list checking code

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (235847 => 235848)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2018-09-10 12:00:59 UTC (rev 235847)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2018-09-10 14:04:32 UTC (rev 235848)
@@ -1125,8 +1125,9 @@
     for (guint index = 0; index < numBufferingRanges; index++) {
         gint64 rangeStart = 0, rangeStop = 0;
         if (gst_query_parse_nth_buffering_range(query, index, &rangeStart, &rangeStop)) {
-            timeRanges->add(MediaTime(rangeStart * toGstUnsigned64Time(mediaDuration) / GST_FORMAT_PERCENT_MAX, GST_SECOND),
-                MediaTime(rangeStop * toGstUnsigned64Time(mediaDuration) / GST_FORMAT_PERCENT_MAX, GST_SECOND));
+            uint64_t startTime = gst_util_uint64_scale_int_round(toGstUnsigned64Time(mediaDuration), rangeStart, GST_FORMAT_PERCENT_MAX);
+            uint64_t stopTime = gst_util_uint64_scale_int_round(toGstUnsigned64Time(mediaDuration), rangeStop, GST_FORMAT_PERCENT_MAX);
+            timeRanges->add(MediaTime(startTime, GST_SECOND), MediaTime(stopTime, GST_SECOND));
         }
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to