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

Changeset 236258 in webkit


Ignore:
Timestamp:
Sep 20, 2018, 7:08:18 AM (8 years ago)
Author:
aboya@igalia.com
Message:

[MSE] Use some tolerance when deciding whether a frame should be appended to the decode queue
​https://bugs.webkit.org/show_bug.cgi?id=189782

Reviewed by Xabier Rodriguez-Calvar.

Ideally, container formats should use exact timestamps and frames
should not overlap. Unfortunately, there are lots of files out there
where this is not always the case.

This is particularly a problem in WebM, where timestamps are expressed
in a power of 10 timescale, which forces some rounding.

This patch makes SourceBuffer allow frames with a small overlaps
(<=1ms) as those usually found in WebM. 1 ms is chosen because it's
the default time scale of WebM files.

  • Modules/mediasource/SourceBuffer.cpp:

(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r236256 r236258  
     12018-09-20  Alicia Boya García  <aboya@igalia.com>
     2
     3        [MSE] Use some tolerance when deciding whether a frame should be appended to the decode queue
     4        https://bugs.webkit.org/show_bug.cgi?id=189782
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        Ideally, container formats should use exact timestamps and frames
     9        should not overlap. Unfortunately, there are lots of files out there
     10        where this is not always the case.
     11
     12        This is particularly a problem in WebM, where timestamps are expressed
     13        in a power of 10 timescale, which forces some rounding.
     14
     15        This patch makes SourceBuffer allow frames with a small overlaps
     16        (<=1ms) as those usually found in WebM. 1 ms is chosen because it's
     17        the default time scale of WebM files.
     18
     19        * Modules/mediasource/SourceBuffer.cpp:
     20        (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
     21
    1222018-09-20  Yacine Bandou  <yacine.bandou@softathome.com>
    223
  • trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp

    r234995 r236258  
    16761676        trackBuffer.samples.addSample(sample);
    16771677
    1678         if (trackBuffer.lastEnqueuedDecodeEndTime.isInvalid() || decodeTimestamp >= trackBuffer.lastEnqueuedDecodeEndTime) {
     1678        // Note: The terminology here is confusing: "enqueuing" means providing a frame to the inner media framework.
     1679        // First, frames are inserted in the decode queue; later, at the end of the append all the frames in the decode
     1680        // queue are "enqueued" (sent to the inner media framework) in `provideMediaData()`.
     1681        //
     1682        // In order to check whether a frame should be added to the decode queue we check whether it starts after the
     1683        // lastEnqueuedDecodeEndTime or even a bit before that to accomodate files with imprecise timing information.
     1684        //
     1685        // There are many files out there where the frame times are not perfectly contiguous, therefore a tolerance is needed.
     1686        // For instance, most WebM files are muxed rounded to the millisecond (the default TimecodeScale of the format).
     1687        const MediaTime contiguousFrameTolerance = MediaTime(1, 1000);
     1688        if (trackBuffer.lastEnqueuedDecodeEndTime.isInvalid() || decodeTimestamp >= (trackBuffer.lastEnqueuedDecodeEndTime - contiguousFrameTolerance)) {
    16791689            DecodeOrderSampleMap::KeyType decodeKey(sample.decodeTime(), sample.presentationTime());
    16801690            trackBuffer.decodeQueue.insert(DecodeOrderSampleMap::MapType::value_type(decodeKey, &sample));
Note: See TracChangeset for help on using the changeset viewer.