⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 273799 in webkit


Ignore:
Timestamp:
Mar 2, 2021, 7:09:07 PM (6 years ago)
Author:
Alan Coon
Message:

Cherry-pick r273513. rdar://problem/74953307

[Cocoa] Appending a partial segment of a WebM audio file results in no additional samples
​https://bugs.webkit.org/show_bug.cgi?id=222407
<rdar://74610383>

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/media-source/media-source-webm-vorbis-partial.html

When appending a partial WebM segment, it can occur that the parser is mid-way through
parsing a Block or SimpleBlock, and is waiting for enough data to be appended to construct a
full sample. However, previous appends are not accounted for when calculated the amount of
data to be requested from the reader, which both results in too much data read and a
miscalculation of the bytesRemaining out-param. This causes all subsequent appends to
generate no samples, leading to an apparent stall in playback.

Add a new ivar to track the number of partial bytes read, and use that value to calculate
the number of bytes yet to be parsed.

  • platform/graphics/cocoa/SourceBufferParserWebM.cpp: (WebCore::SourceBufferParserWebM::VideoTrackData::createSampleBuffer):
  • platform/graphics/cocoa/SourceBufferParserWebM.h:

LayoutTests:

  • platform/mac-bigsur/media/media-source/content/test-48kHz-vorbis-manifest.json: Added.
  • platform/mac-bigsur/media/media-source/content/test-48kHz-vorbis.webm: Added.
  • platform/mac-bigsur/media/media-source/media-source-webm-vorbis-partial-expected.txt: Added.
  • platform/mac-bigsur/media/media-source/media-source-webm-vorbis-partial.html: Added.

git-svn-id: ​https://svn.webkit.org/repository/webkit/trunk@273513 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-612.1.5-branch
Files:
6 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-612.1.5-branch/LayoutTests/ChangeLog

    r273798 r273799  
     12021-03-02  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r273513. rdar://problem/74953307
     4
     5    [Cocoa] Appending a partial segment of a WebM audio file results in no additional samples
     6    https://bugs.webkit.org/show_bug.cgi?id=222407
     7    <rdar://74610383>
     8   
     9    Reviewed by Eric Carlson.
     10   
     11    Source/WebCore:
     12   
     13    Test: media/media-source/media-source-webm-vorbis-partial.html
     14   
     15    When appending a partial WebM segment, it can occur that the parser is mid-way through
     16    parsing a Block or SimpleBlock, and is waiting for enough data to be appended to construct a
     17    full sample. However, previous appends are not accounted for when calculated the amount of
     18    data to be requested from the reader, which both results in too much data read and a
     19    miscalculation of the `bytesRemaining` out-param. This causes all subsequent appends to
     20    generate no samples, leading to an apparent stall in playback.
     21   
     22    Add a new ivar to track the number of partial bytes read, and use that value to calculate
     23    the number of bytes yet to be parsed.
     24   
     25    * platform/graphics/cocoa/SourceBufferParserWebM.cpp:
     26    (WebCore::SourceBufferParserWebM::VideoTrackData::createSampleBuffer):
     27    * platform/graphics/cocoa/SourceBufferParserWebM.h:
     28   
     29    LayoutTests:
     30   
     31    * platform/mac-bigsur/media/media-source/content/test-48kHz-vorbis-manifest.json: Added.
     32    * platform/mac-bigsur/media/media-source/content/test-48kHz-vorbis.webm: Added.
     33    * platform/mac-bigsur/media/media-source/media-source-webm-vorbis-partial-expected.txt: Added.
     34    * platform/mac-bigsur/media/media-source/media-source-webm-vorbis-partial.html: Added.
     35   
     36   
     37    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273513 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     38
     39    2021-02-25  Jer Noble  <jer.noble@apple.com>
     40
     41            [Cocoa] Appending a partial segment of a WebM audio file results in no additional samples
     42            https://bugs.webkit.org/show_bug.cgi?id=222407
     43            <rdar://74610383>
     44
     45            Reviewed by Eric Carlson.
     46
     47            * platform/mac-bigsur/media/media-source/content/test-48kHz-vorbis-manifest.json: Added.
     48            * platform/mac-bigsur/media/media-source/content/test-48kHz-vorbis.webm: Added.
     49            * platform/mac-bigsur/media/media-source/media-source-webm-vorbis-partial-expected.txt: Added.
     50            * platform/mac-bigsur/media/media-source/media-source-webm-vorbis-partial.html: Added.
     51
    1522021-03-02  Alan Coon  <alancoon@apple.com>
    253
  • branches/safari-612.1.5-branch/Source/WebCore/ChangeLog

    r273798 r273799  
     12021-03-02  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r273513. rdar://problem/74953307
     4
     5    [Cocoa] Appending a partial segment of a WebM audio file results in no additional samples
     6    https://bugs.webkit.org/show_bug.cgi?id=222407
     7    <rdar://74610383>
     8   
     9    Reviewed by Eric Carlson.
     10   
     11    Source/WebCore:
     12   
     13    Test: media/media-source/media-source-webm-vorbis-partial.html
     14   
     15    When appending a partial WebM segment, it can occur that the parser is mid-way through
     16    parsing a Block or SimpleBlock, and is waiting for enough data to be appended to construct a
     17    full sample. However, previous appends are not accounted for when calculated the amount of
     18    data to be requested from the reader, which both results in too much data read and a
     19    miscalculation of the `bytesRemaining` out-param. This causes all subsequent appends to
     20    generate no samples, leading to an apparent stall in playback.
     21   
     22    Add a new ivar to track the number of partial bytes read, and use that value to calculate
     23    the number of bytes yet to be parsed.
     24   
     25    * platform/graphics/cocoa/SourceBufferParserWebM.cpp:
     26    (WebCore::SourceBufferParserWebM::VideoTrackData::createSampleBuffer):
     27    * platform/graphics/cocoa/SourceBufferParserWebM.h:
     28   
     29    LayoutTests:
     30   
     31    * platform/mac-bigsur/media/media-source/content/test-48kHz-vorbis-manifest.json: Added.
     32    * platform/mac-bigsur/media/media-source/content/test-48kHz-vorbis.webm: Added.
     33    * platform/mac-bigsur/media/media-source/media-source-webm-vorbis-partial-expected.txt: Added.
     34    * platform/mac-bigsur/media/media-source/media-source-webm-vorbis-partial.html: Added.
     35   
     36   
     37    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273513 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     38
     39    2021-02-25  Jer Noble  <jer.noble@apple.com>
     40
     41            [Cocoa] Appending a partial segment of a WebM audio file results in no additional samples
     42            https://bugs.webkit.org/show_bug.cgi?id=222407
     43            <rdar://74610383>
     44
     45            Reviewed by Eric Carlson.
     46
     47            Test: media/media-source/media-source-webm-vorbis-partial.html
     48
     49            When appending a partial WebM segment, it can occur that the parser is mid-way through
     50            parsing a Block or SimpleBlock, and is waiting for enough data to be appended to construct a
     51            full sample. However, previous appends are not accounted for when calculated the amount of
     52            data to be requested from the reader, which both results in too much data read and a
     53            miscalculation of the `bytesRemaining` out-param. This causes all subsequent appends to
     54            generate no samples, leading to an apparent stall in playback.
     55
     56            Add a new ivar to track the number of partial bytes read, and use that value to calculate
     57            the number of bytes yet to be parsed.
     58
     59            * platform/graphics/cocoa/SourceBufferParserWebM.cpp:
     60            (WebCore::SourceBufferParserWebM::VideoTrackData::createSampleBuffer):
     61            * platform/graphics/cocoa/SourceBufferParserWebM.h:
     62
    1632021-03-02  Alan Coon  <alancoon@apple.com>
    264
  • branches/safari-612.1.5-branch/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp

    r272758 r273799  
    12301230    m_packetData.resize(m_packetBytesRead + metadata.size);
    12311231    size_t packetDataOffset = m_packetBytesRead;
     1232
     1233    ASSERT(m_partialBytesRead < metadata.size);
    12321234    size_t bytesToRead = metadata.size;
     1235    if (m_partialBytesRead && m_partialBytesRead < bytesToRead)
     1236        bytesToRead -= m_partialBytesRead;
    12331237    while (bytesToRead) {
    12341238        uint64_t bytesRead;
    … …  
    12391243
    12401244        // FIXME: We can't yet handle parsing a Frame that doesn't have all its memory available.
    1241         if (status.code == webm::Status::kOkPartial || status.code == webm::Status::kWouldBlock)
     1245        if (status.code == webm::Status::kOkPartial || status.code == webm::Status::kWouldBlock) {
     1246            m_partialBytesRead += bytesRead;
    12421247            return status;
     1248        }
     1249
     1250        m_partialBytesRead = 0;
    12431251    }
    12441252
  • branches/safari-612.1.5-branch/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.h

    r273089 r273799  
    216216        size_t m_packetBytesRead { 0 };
    217217        size_t m_byteOffset { 0 };
     218        size_t m_partialBytesRead { 0 };
    218219        Vector<AudioStreamPacketDescription> m_packetDescriptions;
    219220
Note: See TracChangeset for help on using the changeset viewer.