Changeset 207584 in webkit


Ignore:
Timestamp:
Oct 19, 2016 8:10:12 PM (8 years ago)
Author:
jer.noble@apple.com
Message:

REGRESSION (r206025): All YouTube videos play with black bars on all four sides
https://bugs.webkit.org/show_bug.cgi?id=163308

Reviewed by Darin Adler.

Source/WebCore:

Test: media/media-source/media-source-resize.html

After r206025, we do not fire resize events when the size change notification happens equal-
to-or-before the current time, which can happen at the very beginning of a stream. Take care
of this case by checking that the target time isn't actually in the past inside of
sizeWillChangeAtTime(), and also always skip the boundary time observer when there was no
previous size (such as after a flush due to a seek).

  • platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
  • platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:

(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setNaturalSize):

  • platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:

(WebCore::SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples):
(WebCore::SourceBufferPrivateAVFObjC::enqueueSample):

LayoutTests:

  • media/media-source/media-source-resize-expected.txt: Added.
  • media/media-source/media-source-resize.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r207583 r207584  
     12016-10-19  Jer Noble  <jer.noble@apple.com>
     2
     3        REGRESSION (r206025): All YouTube videos play with black bars on all four sides
     4        https://bugs.webkit.org/show_bug.cgi?id=163308
     5
     6        Reviewed by Darin Adler.
     7
     8        * media/media-source/media-source-resize-expected.txt: Added.
     9        * media/media-source/media-source-resize.html: Added.
     10
    1112016-10-19  Nan Wang  <n_wang@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r207583 r207584  
     12016-10-19  Jer Noble  <jer.noble@apple.com>
     2
     3        REGRESSION (r206025): All YouTube videos play with black bars on all four sides
     4        https://bugs.webkit.org/show_bug.cgi?id=163308
     5
     6        Reviewed by Darin Adler.
     7
     8        Test: media/media-source/media-source-resize.html
     9
     10        After r206025, we do not fire resize events when the size change notification happens equal-
     11        to-or-before the current time, which can happen at the very beginning of a stream. Take care
     12        of this case by checking that the target time isn't actually in the past inside of
     13        sizeWillChangeAtTime(), and also always skip the boundary time observer when there was no
     14        previous size (such as after a flush due to a seek).
     15
     16        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
     17        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
     18        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime):
     19        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setNaturalSize):
     20        * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
     21        (WebCore::SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples):
     22        (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
     23
    1242016-10-19  Nan Wang  <n_wang@apple.com>
    225
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h

    r206811 r207584  
    8585    void effectiveRateChanged();
    8686    void sizeWillChangeAtTime(const MediaTime&, const FloatSize&);
     87    void setNaturalSize(const FloatSize&);
    8788    void flushPendingSizeChanges();
    8889    void characteristicsChanged();
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm

    r206811 r207584  
    690690        if (!weakThis)
    691691            return;
    692         RetainPtr<id> observer = weakThis->m_sizeChangeObservers.takeFirst();
    693         weakThis->m_naturalSize = size;
    694         weakThis->m_player->sizeChanged();
     692        weakThis->m_sizeChangeObservers.removeFirst();
     693        weakThis->setNaturalSize(size);
    695694    }];
    696695    m_sizeChangeObservers.append(WTFMove(observer));
     696
     697    if (currentMediaTime() >= time)
     698        setNaturalSize(size);
     699}
     700
     701void MediaPlayerPrivateMediaSourceAVFObjC::setNaturalSize(const FloatSize& size)
     702{
     703    if (size == m_naturalSize)
     704        return;
     705
     706    m_naturalSize = size;
     707    m_player->sizeChanged();
    697708}
    698709
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h

    r206518 r207584  
    158158    CDMSessionMediaSourceAVFObjC* m_session { nullptr };
    159159
    160     FloatSize m_cachedSize;
     160    Optional<FloatSize> m_cachedSize;
    161161    FloatSize m_currentSize;
    162162    bool m_parsingSucceeded;
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm

    r207523 r207584  
    963963    }
    964964
     965    m_cachedSize = Nullopt;
     966
    965967    if (m_mediaSource) {
    966968        m_mediaSource->player()->setHasAvailableVideoFrame(false);
     
    986988        CMFormatDescriptionRef formatDescription = CMSampleBufferGetFormatDescription(platformSample.sample.cmSampleBuffer);
    987989        FloatSize formatSize = FloatSize(CMVideoFormatDescriptionGetPresentationDimensions(formatDescription, true, true));
    988         if (formatSize != m_cachedSize) {
     990        if (!m_cachedSize || formatSize != m_cachedSize.value()) {
    989991            LOG(MediaSource, "SourceBufferPrivateAVFObjC::enqueueSample(%p) - size change detected: {width=%lf, height=%lf}", formatSize.width(), formatSize.height());
     992            bool sizeWasNull = !m_cachedSize;
    990993            m_cachedSize = formatSize;
    991             if (m_mediaSource)
    992                 m_mediaSource->player()->sizeWillChangeAtTime(mediaSample->presentationTime(), formatSize);
     994            if (m_mediaSource) {
     995                if (sizeWasNull)
     996                    m_mediaSource->player()->setNaturalSize(formatSize);
     997                else
     998                    m_mediaSource->player()->sizeWillChangeAtTime(mediaSample->presentationTime(), formatSize);
     999            }
    9931000        }
    9941001
     
    10341041FloatSize SourceBufferPrivateAVFObjC::naturalSize()
    10351042{
    1036     return m_cachedSize;
     1043    return m_cachedSize.valueOr(FloatSize());
    10371044}
    10381045
Note: See TracChangeset for help on using the changeset viewer.