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

Changeset 274485 in webkit


Ignore:
Timestamp:
Mar 16, 2021, 9:53:47 AM (6 years ago)
Author:
jer.noble@apple.com
Message:

[Cocoa] YouTube audio stalls occasionally
​https://bugs.webkit.org/show_bug.cgi?id=223233
<rdar://75057532>

Reviewed by Eric Carlson.

In r273513, we added support for parsing of audio frames which spanned
appends. But in so doing, left in a bug where the size and starting byte
offset of those audio frames was miscalculated. Previously, the starting
byte offset was reset during each pass through consumeFrameData(), and the
size of the m_packetData was increased by the full packet size each pass
as well, leading to both an incorrect starting point for the frame and an
incorrect overall size of the combined packet data. This lead to a decoding
error when the parser hit the empty frame bytes after the last successful
partial parse.

Now, we will add explicit tracking of the current frame's starting byte
offset as well as the frame's size, reset after each successful full frame
parse.

  • platform/graphics/cocoa/SourceBufferParserWebM.cpp:

(WebCore::SourceBufferParserWebM::AudioTrackData::consumeFrameData):

  • platform/graphics/cocoa/SourceBufferParserWebM.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r274482 r274485  
     12021-03-16  Jer Noble  <jer.noble@apple.com>
     2
     3        [Cocoa] YouTube audio stalls occasionally
     4        https://bugs.webkit.org/show_bug.cgi?id=223233
     5        <rdar://75057532>
     6
     7        Reviewed by Eric Carlson.
     8
     9        In r273513, we added support for parsing of audio frames which spanned
     10        appends. But in so doing, left in a bug where the size and starting byte
     11        offset of those audio frames was miscalculated. Previously, the starting
     12        byte offset was reset during each pass through consumeFrameData(), and the
     13        size of the m_packetData was increased by the full packet size each pass
     14        as well, leading to both an incorrect starting point for the frame and an
     15        incorrect overall size of the combined packet data. This lead to a decoding
     16        error when the parser hit the empty frame bytes after the last successful
     17        partial parse.
     18
     19        Now, we will add explicit tracking of the current frame's starting byte
     20        offset as well as the frame's size, reset after each successful full frame
     21        parse.
     22
     23        * platform/graphics/cocoa/SourceBufferParserWebM.cpp:
     24        (WebCore::SourceBufferParserWebM::AudioTrackData::consumeFrameData):
     25        * platform/graphics/cocoa/SourceBufferParserWebM.h:
     26
    1272021-03-16  Youenn Fablet  <youenn@apple.com>
    228
  • trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp

    r273513 r274485  
    12251225    }
    12261226
    1227     m_packetData.resize(m_packetBytesRead + metadata.size);
    1228     size_t packetDataOffset = m_packetBytesRead;
     1227    if (!m_currentPacketSize) {
     1228        m_currentPacketSize = metadata.size;
     1229        m_packetData.grow(m_packetData.size() + metadata.size);
     1230    }
     1231
     1232    if (!m_currentPacketByteOffset)
     1233        m_currentPacketByteOffset = m_packetBytesRead;
    12291234
    12301235    ASSERT(m_partialBytesRead < metadata.size);
    … …  
    12761281    }
    12771282
    1278     m_packetDescriptions.append({ static_cast<int64_t>(packetDataOffset), 0, static_cast<UInt32>(metadata.size) });
     1283    m_packetDescriptions.append({ static_cast<int64_t>(*m_currentPacketByteOffset), 0, static_cast<UInt32>(*m_currentPacketSize) });
     1284    m_currentPacketByteOffset = WTF::nullopt;
     1285    m_currentPacketSize = WTF::nullopt;
     1286
    12791287    auto sampleDuration = CMTimeGetSeconds(CMTimeSubtract(presentationTime, m_samplePresentationTime)) + CMTimeGetSeconds(m_packetDuration) * sampleCount;
    12801288    if (sampleDuration >= m_minimumSampleDuration)
  • trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.h

    r273513 r274485  
    214214        CMTime m_packetDuration;
    215215        Vector<uint8_t> m_packetData;
     216        Optional<size_t> m_currentPacketByteOffset;
     217        Optional<size_t> m_currentPacketSize;
    216218        size_t m_packetBytesRead { 0 };
    217219        size_t m_byteOffset { 0 };
Note: See TracChangeset for help on using the changeset viewer.