Changeset 257977 in webkit


Ignore:
Timestamp:
Mar 6, 2020 4:41:27 AM (4 years ago)
Author:
eocanha@igalia.com
Message:

[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 <pnormand@igalia.com>

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.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r257971 r257977  
     12020-03-06  Enrique Ocaña González  <eocanha@igalia.com>
     2
     3        [GStreamer] Streaming aac/mp3 audio doesn't always work
     4        https://bugs.webkit.org/show_bug.cgi?id=205801
     5
     6        Reviewed by Philippe Normand.
     7
     8        The new test checks that end-of-stream (thus, end of playback) isn't triggered when a live
     9        audio stream is being played. Live streams don't have Content-Length and are loaded as
     10        they are generated (no future data is available immediately). This is simulated by omitting
     11        Content-Length and artificially stalling the stream at a given offset.
     12
     13        * http/tests/media/resources/serve-video.php: Now the file continues to be served after
     14        the stall when stallOffset/stallDuration are used.
     15        * http/tests/media/video-no-content-length-stall-expected.txt: Added.
     16        * http/tests/media/video-no-content-length-stall.html: Added.
     17
    1182020-03-06  Carlos Garcia Campos  <cgarcia@igalia.com>
    219
  • trunk/LayoutTests/http/tests/media/resources/serve-video.php

    r188686 r257977  
    145145        set_time_limit(0);
    146146
     147    $stalledOnce = false;
    147148    while (!feof($fn) && $offset <= $end && connection_status() == 0) {
    148149        $readSize = min($settings["chunkSize"], ($end - $offset) + 1);
    149150        $stallNow = false;
    150         if ($settings["stallOffset"] && $settings["stallOffset"] >= $offset && $settings["stallOffset"] < $offset + $readSize) {
     151        if (!$stalledOnce && $settings["stallOffset"] && $settings["stallOffset"] >= $offset && $settings["stallOffset"] < $offset + $readSize) {
    151152            $readSize = min($settings["chunkSize"], $settings["stallOffset"] - $offset);
    152153            $stallNow = true;
     
    154155
    155156        $buffer = fread($fn, $readSize);
     157        $readLength = strlen($buffer);
     158
    156159        print($buffer);
    157160        flush();
    158         $offset += $settings["chunkSize"];
     161        $offset += $readLength;
    159162       
    160         if ($stallNow)
     163        if ($stallNow) {
    161164            sleep($settings["stallDuration"]);
     165            $stalledOnce = true;
     166        }
    162167    }
    163168    fclose($fn);
  • trunk/Source/WebCore/ChangeLog

    r257976 r257977  
     12020-03-06  Enrique Ocaña González  <eocanha@igalia.com>
     2
     3        [GStreamer] Streaming aac/mp3 audio doesn't always work
     4        https://bugs.webkit.org/show_bug.cgi?id=205801
     5
     6        Reviewed by Philippe Normand.
     7
     8        Don't rely on response size to replace Content-Length. This may break streaming videos,
     9        which should always have an Infinite duration.
     10
     11        This patch is based on the fix found by Philippe Normand <pnormand@igalia.com>
     12
     13        Test: http/tests/media/video-no-content-length-stall.html
     14
     15        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
     16        (CachedResourceStreamingClient::dataReceived):
     17
    1182020-03-06  Frederic Wang  <fwang@igalia.com>
    219
  • trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp

    r257635 r257977  
    11721172        GST_DEBUG_OBJECT(src, "Got position previous estimated content size (%" G_GINT64_FORMAT " > %" G_GINT64_FORMAT ")", newPosition, priv->size);
    11731173        newSize = newPosition;
    1174     } else if (!priv->haveSize) {
    1175         GST_DEBUG_OBJECT(src, "Got initial response without Content-Length, assuming response size as duration.");
    1176         newSize = length;
    1177         priv->haveSize = true;
    11781174    }
    11791175
Note: See TracChangeset for help on using the changeset viewer.