Changeset 237657 in webkit


Ignore:
Timestamp:
Oct 31, 2018 3:05:51 PM (5 years ago)
Author:
aboya@igalia.com
Message:

[MSE] Use tolerance when growing the coded frame group
https://bugs.webkit.org/show_bug.cgi?id=190085

Reviewed by Jer Noble.

Source/WebCore:

Test: media/media-source/media-source-append-acb-tolerance.html

This patch introduces a millisecond tolerance in the range of
potential frames that should be erased frame from the track buffer
when the coded frame group is growing.

This is necessary because some files have imprecise overlapping
timestamps (especially WebM files).

This fixes a stall when seeking back and forth in YouTube with WebM
video.

A test case simulating the problem with video/mock using timestamps
similar to those of a typical 30 fps WebM video is also added.

  • Modules/mediasource/SourceBuffer.cpp:

(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):

LayoutTests:

A test simulating unordered appends with imprecise timestamps,
overlapping <1ms (replicating a typical WebM 30fps video file) is
added.

  • media/media-source/media-source-append-acb-tolerance.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r237656 r237657  
     12018-10-31  Alicia Boya García  <aboya@igalia.com>
     2
     3        [MSE] Use tolerance when growing the coded frame group
     4        https://bugs.webkit.org/show_bug.cgi?id=190085
     5
     6        Reviewed by Jer Noble.
     7
     8        A test simulating unordered appends with imprecise timestamps,
     9        overlapping <1ms (replicating a typical WebM 30fps video file) is
     10        added.
     11
     12        * media/media-source/media-source-append-acb-tolerance.html: Added.
     13
    1142018-10-31  Devin Rousso  <drousso@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r237655 r237657  
     12018-10-31  Alicia Boya García  <aboya@igalia.com>
     2
     3        [MSE] Use tolerance when growing the coded frame group
     4        https://bugs.webkit.org/show_bug.cgi?id=190085
     5
     6        Reviewed by Jer Noble.
     7
     8        Test: media/media-source/media-source-append-acb-tolerance.html
     9
     10        This patch introduces a millisecond tolerance in the range of
     11        potential frames that should be erased frame from the track buffer
     12        when the coded frame group is growing.
     13
     14        This is necessary because some files have imprecise overlapping
     15        timestamps (especially WebM files).
     16
     17        This fixes a stall when seeking back and forth in YouTube with WebM
     18        video.
     19
     20        A test case simulating the problem with video/mock using timestamps
     21        similar to those of a typical 30 fps WebM video is also added.
     22
     23        * Modules/mediasource/SourceBuffer.cpp:
     24        (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
     25
    1262018-10-31  Jer Noble  <jer.noble@apple.com>
    227
  • trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp

    r237274 r237657  
    16461646        }
    16471647
     1648        // There are many files out there where the frame times are not perfectly contiguous and may have small overlaps
     1649        // between the beginning of a frame and the end of the previous one; therefore a tolerance is needed whenever
     1650        // durations are considered.
     1651        // For instance, most WebM files are muxed rounded to the millisecond (the default TimecodeScale of the format)
     1652        // but their durations use a finer timescale (causing a sub-millisecond overlap). More rarely, there are also
     1653        // MP4 files with slightly off tfdt boxes, presenting a similar problem at the beginning of each fragment.
     1654        const MediaTime contiguousFrameTolerance = MediaTime(1, 1000);
     1655
    16481656        // If highest presentation timestamp for track buffer is set and less than or equal to presentation timestamp
    16491657        if (trackBuffer.highestPresentationTimestamp.isValid() && trackBuffer.highestPresentationTimestamp <= presentationTimestamp) {
     
    16591667
    16601668                MediaTime highestBufferedTime = trackBuffer.buffered.maximumBufferedTime();
     1669                MediaTime eraseBeginTime = trackBuffer.highestPresentationTimestamp;
     1670                MediaTime eraseEndTime = frameEndTimestamp - contiguousFrameTolerance;
    16611671
    16621672                PresentationOrderSampleMap::iterator_range range;
    16631673                if (highestBufferedTime - trackBuffer.highestPresentationTimestamp < trackBuffer.lastFrameDuration)
    16641674                    // If the new frame is at the end of the buffered ranges, perform a sequential scan from end (O(1)).
    1665                     range = trackBuffer.samples.presentationOrder().findSamplesBetweenPresentationTimesFromEnd(trackBuffer.highestPresentationTimestamp, frameEndTimestamp);
     1675                    range = trackBuffer.samples.presentationOrder().findSamplesBetweenPresentationTimesFromEnd(eraseBeginTime, eraseEndTime);
    16661676                else
    16671677                    // In any other case, perform a binary search (O(log(n)).
    1668                     range = trackBuffer.samples.presentationOrder().findSamplesBetweenPresentationTimes(trackBuffer.highestPresentationTimestamp, frameEndTimestamp);
     1678                    range = trackBuffer.samples.presentationOrder().findSamplesBetweenPresentationTimes(eraseBeginTime, eraseEndTime);
    16691679
    16701680                if (range.first != trackBuffer.samples.presentationOrder().end())
     
    17271737        // In order to check whether a frame should be added to the decode queue we check whether it starts after the
    17281738        // lastEnqueuedDecodeEndTime or even a bit before that to accomodate files with imprecise timing information.
    1729         //
    1730         // There are many files out there where the frame times are not perfectly contiguous, therefore a tolerance is needed.
    1731         // For instance, most WebM files are muxed rounded to the millisecond (the default TimecodeScale of the format).
    1732         const MediaTime contiguousFrameTolerance = MediaTime(1, 1000);
    17331739        if (trackBuffer.lastEnqueuedDecodeEndTime.isInvalid() || decodeTimestamp >= (trackBuffer.lastEnqueuedDecodeEndTime - contiguousFrameTolerance)) {
    17341740            DecodeOrderSampleMap::KeyType decodeKey(sample.decodeTime(), sample.presentationTime());
Note: See TracChangeset for help on using the changeset viewer.