Title: [257994] releases/WebKitGTK/webkit-2.28
Revision
257994
Author
[email protected]
Date
2020-03-06 06:29:02 -0800 (Fri, 06 Mar 2020)

Log Message

Merge r257977 - [GStreamer] Streaming aac/mp3 audio doesn't always work
https://bugs.webkit.org/show_bug.cgi?id=205801

Reviewed by Philippe Normand.

Source/WebCore:

Don't rely on response size to replace Content-Length. This may break streaming videos,
which should always have an Infinite duration.

This patch is based on the fix found by Philippe Normand <[email protected]>

Test: http/tests/media/video-no-content-length-stall.html

* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(CachedResourceStreamingClient::dataReceived):

LayoutTests:

The new test checks that end-of-stream (thus, end of playback) isn't triggered when a live
audio stream is being played. Live streams don't have Content-Length and are loaded as
they are generated (no future data is available immediately). This is simulated by omitting
Content-Length and artificially stalling the stream at a given offset.

* http/tests/media/resources/serve-video.php: Now the file continues to be served after
the stall when stallOffset/stallDuration are used.
* http/tests/media/video-no-content-length-stall-expected.txt: Added.
* http/tests/media/video-no-content-length-stall.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.28/LayoutTests/ChangeLog (257993 => 257994)


--- releases/WebKitGTK/webkit-2.28/LayoutTests/ChangeLog	2020-03-06 14:28:55 UTC (rev 257993)
+++ releases/WebKitGTK/webkit-2.28/LayoutTests/ChangeLog	2020-03-06 14:29:02 UTC (rev 257994)
@@ -1,3 +1,20 @@
+2020-03-06  Enrique Ocaña González  <[email protected]>
+
+        [GStreamer] Streaming aac/mp3 audio doesn't always work
+        https://bugs.webkit.org/show_bug.cgi?id=205801
+
+        Reviewed by Philippe Normand.
+
+        The new test checks that end-of-stream (thus, end of playback) isn't triggered when a live
+        audio stream is being played. Live streams don't have Content-Length and are loaded as
+        they are generated (no future data is available immediately). This is simulated by omitting
+        Content-Length and artificially stalling the stream at a given offset.
+
+        * http/tests/media/resources/serve-video.php: Now the file continues to be served after
+        the stall when stallOffset/stallDuration are used.
+        * http/tests/media/video-no-content-length-stall-expected.txt: Added.
+        * http/tests/media/video-no-content-length-stall.html: Added.
+
 2020-03-04  Doug Kelly  <[email protected]>
 
         Crash in SVGElement::removeEventListener with symbol element

Modified: releases/WebKitGTK/webkit-2.28/LayoutTests/http/tests/media/resources/serve-video.php (257993 => 257994)


--- releases/WebKitGTK/webkit-2.28/LayoutTests/http/tests/media/resources/serve-video.php	2020-03-06 14:28:55 UTC (rev 257993)
+++ releases/WebKitGTK/webkit-2.28/LayoutTests/http/tests/media/resources/serve-video.php	2020-03-06 14:29:02 UTC (rev 257994)
@@ -144,21 +144,26 @@
     if ($settings["stallDuration"])
         set_time_limit(0);
 
+    $stalledOnce = false;
     while (!feof($fn) && $offset <= $end && connection_status() == 0) {
         $readSize = min($settings["chunkSize"], ($end - $offset) + 1);
         $stallNow = false;
-        if ($settings["stallOffset"] && $settings["stallOffset"] >= $offset && $settings["stallOffset"] < $offset + $readSize) {
+        if (!$stalledOnce && $settings["stallOffset"] && $settings["stallOffset"] >= $offset && $settings["stallOffset"] < $offset + $readSize) {
             $readSize = min($settings["chunkSize"], $settings["stallOffset"] - $offset);
             $stallNow = true;
         }
 
         $buffer = fread($fn, $readSize);
+        $readLength = strlen($buffer);
+
         print($buffer);
         flush();
-        $offset += $settings["chunkSize"];
+        $offset += $readLength;
         
-        if ($stallNow)
+        if ($stallNow) {
             sleep($settings["stallDuration"]);
+            $stalledOnce = true;
+        }
     }
     fclose($fn);
 

Added: releases/WebKitGTK/webkit-2.28/LayoutTests/http/tests/media/video-no-content-length-stall-expected.txt (0 => 257994)


--- releases/WebKitGTK/webkit-2.28/LayoutTests/http/tests/media/video-no-content-length-stall-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.28/LayoutTests/http/tests/media/video-no-content-length-stall-expected.txt	2020-03-06 14:29:02 UTC (rev 257994)
@@ -0,0 +1,5 @@
+Live audios (no Content-Length, loaded as they are generated) shouldn't trigger end-of-stream if future data isn't available immediately.
+
+EVENT(ended)
+EXPECTED (video.currentTime > 6 == 'true') OK
+

Added: releases/WebKitGTK/webkit-2.28/LayoutTests/http/tests/media/video-no-content-length-stall.html (0 => 257994)


--- releases/WebKitGTK/webkit-2.28/LayoutTests/http/tests/media/video-no-content-length-stall.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.28/LayoutTests/http/tests/media/video-no-content-length-stall.html	2020-03-06 14:29:02 UTC (rev 257994)
@@ -0,0 +1,30 @@
+<html>
+<head>
+    <script src=""
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        function prepareAudio() {
+            // Global variables used from video-test.js.
+            video = document.getElementById('audio');
+            video.src=""
+                + "&name=hls/english/description.aac&type=audio/aac&stallOffset=512&stallDuration=2";
+            mediaElement = video;
+            video.play();
+        }
+
+        waitForEvent("ended", function onEnded() {
+            testExpected("video.currentTime > 6", true);
+            if (window.testRunner)
+                window.testRunner.notifyDone();
+        });
+    </script>
+</head>
+<body _onload_="prepareAudio()">
+Live audios (no Content-Length, loaded as they are generated) shouldn't trigger end-of-stream if future data isn't available immediately.<br/>
+<audio controls id="audio" playsinline></audio>
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.28/Source/WebCore/ChangeLog (257993 => 257994)


--- releases/WebKitGTK/webkit-2.28/Source/WebCore/ChangeLog	2020-03-06 14:28:55 UTC (rev 257993)
+++ releases/WebKitGTK/webkit-2.28/Source/WebCore/ChangeLog	2020-03-06 14:29:02 UTC (rev 257994)
@@ -1,3 +1,20 @@
+2020-03-06  Enrique Ocaña González  <[email protected]>
+
+        [GStreamer] Streaming aac/mp3 audio doesn't always work
+        https://bugs.webkit.org/show_bug.cgi?id=205801
+
+        Reviewed by Philippe Normand.
+
+        Don't rely on response size to replace Content-Length. This may break streaming videos,
+        which should always have an Infinite duration.
+
+        This patch is based on the fix found by Philippe Normand <[email protected]>
+
+        Test: http/tests/media/video-no-content-length-stall.html
+
+        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
+        (CachedResourceStreamingClient::dataReceived):
+
 2020-03-06  Michael Catanzaro  <[email protected]>
 
         [WPE][GTK] Use Firefox user agent quirk more aggressively on Google Docs

Modified: releases/WebKitGTK/webkit-2.28/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp (257993 => 257994)


--- releases/WebKitGTK/webkit-2.28/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp	2020-03-06 14:28:55 UTC (rev 257993)
+++ releases/WebKitGTK/webkit-2.28/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp	2020-03-06 14:29:02 UTC (rev 257994)
@@ -1171,10 +1171,6 @@
     if (priv->haveSize && (newPosition > priv->size)) {
         GST_DEBUG_OBJECT(src, "Got position previous estimated content size (%" G_GINT64_FORMAT " > %" G_GINT64_FORMAT ")", newPosition, priv->size);
         newSize = newPosition;
-    } else if (!priv->haveSize) {
-        GST_DEBUG_OBJECT(src, "Got initial response without Content-Length, assuming response size as duration.");
-        newSize = length;
-        priv->haveSize = true;
     }
 
     if (newSize) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to