Changeset 178486 in webkit


Ignore:
Timestamp:
Jan 14, 2015 10:00:43 PM (9 years ago)
Author:
jer.noble@apple.com
Message:

[Mac][MSE] Stalled YouTube playback does not allow display to sleep.
https://bugs.webkit.org/show_bug.cgi?id=140468
rdar://problem/19171162

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/media-source/media-source-stalled-holds-sleep-assertion.html

The unstated convention of MediaPlayerPrivate::paused() is that implementations should
return 'true' if the playback rate is 0. However, MediaPlayerPrivateMediaSourceAVFObjC
was returning 'false' if it was supposed to be playing, regardless of the actual rate.
This caused a check in HTMLMediaElement of whether to release the sleep assertion token
to fail, thinking the media engine was still playing.

Add some testing infrastructure to allow us to test whether the media element is disabling
display sleep from within layout tests.

  • html/HTMLMediaElement.h:

(WebCore::HTMLMediaElement::isDisablingSleep):

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

(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paused):

  • testing/Internals.cpp:

(WebCore::Internals::elementIsBlockingDisplaySleep):

  • testing/Internals.h:
  • testing/Internals.idl:

LayoutTests:

  • media/media-source/content/test-fragmented-manifest.json: Added.
  • media/media-source/content/test-fragmented.mp4: Added.
  • media/media-source/media-source-loader.js: Added.

(MediaSourceLoader):
(MediaSourceLoader.prototype.loadManifest):
(MediaSourceLoader.prototype.loadManifestSucceeded):
(MediaSourceLoader.prototype.loadManifestFailed):
(MediaSourceLoader.prototype.loadMediaData):
(MediaSourceLoader.prototype.loadMediaDataSucceeded):
(MediaSourceLoader.prototype.loadMediaDataFailed):
(MediaSourceLoader.prototype.type):
(MediaSourceLoader.prototype.duration):
(MediaSourceLoader.prototype.initSegment):
(MediaSourceLoader.prototype.mediaSegmentsLength):
(MediaSourceLoader.prototype.mediaSegment):

  • media/media-source/media-source-stalled-holds-sleep-assertion-expected.txt: Added.
  • media/media-source/media-source-stalled-holds-sleep-assertion.html: Added.
Location:
trunk
Files:
6 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r178471 r178486  
     12015-01-14  Jer Noble  <jer.noble@apple.com>
     2
     3        [Mac][MSE] Stalled YouTube playback does not allow display to sleep.
     4        https://bugs.webkit.org/show_bug.cgi?id=140468
     5        rdar://problem/19171162
     6
     7        Reviewed by Eric Carlson.
     8
     9        * media/media-source/content/test-fragmented-manifest.json: Added.
     10        * media/media-source/content/test-fragmented.mp4: Added.
     11        * media/media-source/media-source-loader.js: Added.
     12        (MediaSourceLoader):
     13        (MediaSourceLoader.prototype.loadManifest):
     14        (MediaSourceLoader.prototype.loadManifestSucceeded):
     15        (MediaSourceLoader.prototype.loadManifestFailed):
     16        (MediaSourceLoader.prototype.loadMediaData):
     17        (MediaSourceLoader.prototype.loadMediaDataSucceeded):
     18        (MediaSourceLoader.prototype.loadMediaDataFailed):
     19        (MediaSourceLoader.prototype.type):
     20        (MediaSourceLoader.prototype.duration):
     21        (MediaSourceLoader.prototype.initSegment):
     22        (MediaSourceLoader.prototype.mediaSegmentsLength):
     23        (MediaSourceLoader.prototype.mediaSegment):
     24        * media/media-source/media-source-stalled-holds-sleep-assertion-expected.txt: Added.
     25        * media/media-source/media-source-stalled-holds-sleep-assertion.html: Added.
     26
    1272015-01-14  Andrzej Badowski  <a.badowski@samsung.com>
    228
  • trunk/LayoutTests/media/media-source/media-source-canplaythrough.html

    r160336 r178486  
    1616        internals.initializeMockMediaSource();
    1717
    18     function runTest() {
     18    function runTest()
     19    {
    1920        findMediaElement();
    2021        source = new MediaSource();
     
    2728    }
    2829
    29     function startLoad() {
     30    function startLoad()
     31    {
    3032        sourceBuffer = source.addSourceBuffer('video/mock; codecs="mock"');
    3133        sourceBuffer.addEventListener('update', sourceUpdated);
     
    3739    }
    3840
    39     function sourceUpdated() {
     41    function sourceUpdated()
     42    {
    4043        source.activeSourceBuffers.length;
    4144        if (nextRequest < totalLength) {
  • trunk/Source/WebCore/ChangeLog

    r178481 r178486  
     12015-01-14  Jer Noble  <jer.noble@apple.com>
     2
     3        [Mac][MSE] Stalled YouTube playback does not allow display to sleep.
     4        https://bugs.webkit.org/show_bug.cgi?id=140468
     5        rdar://problem/19171162
     6
     7        Reviewed by Eric Carlson.
     8
     9        Test: media/media-source/media-source-stalled-holds-sleep-assertion.html
     10
     11        The unstated convention of MediaPlayerPrivate::paused() is that implementations should
     12        return 'true' if the playback rate is 0. However, MediaPlayerPrivateMediaSourceAVFObjC
     13        was returning 'false' if it was supposed to be playing, regardless of the actual rate.
     14        This caused a check in HTMLMediaElement of whether to release the sleep assertion token
     15        to fail, thinking the media engine was still playing.
     16
     17        Add some testing infrastructure to allow us to test whether the media element is disabling
     18        display sleep from within layout tests.
     19
     20        * html/HTMLMediaElement.h:
     21        (WebCore::HTMLMediaElement::isDisablingSleep):
     22        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
     23        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paused):
     24        * testing/Internals.cpp:
     25        (WebCore::Internals::elementIsBlockingDisplaySleep):
     26        * testing/Internals.h:
     27        * testing/Internals.idl:
     28
    1292015-01-14  Zalan Bujtas  <zalan@apple.com>
    230
  • trunk/Source/WebCore/html/HTMLMediaElement.h

    r178367 r178486  
    466466    MediaControlsHost* mediaControlsHost() { return m_mediaControlsHost.get(); }
    467467
     468    bool isDisablingSleep() const { return m_sleepDisabler.get(); }
     469
    468470protected:
    469471    HTMLMediaElement(const QualifiedName&, Document&, bool);
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm

    r176924 r178486  
    338338bool MediaPlayerPrivateMediaSourceAVFObjC::paused() const
    339339{
    340     return !m_playing;
     340    return ![m_synchronizer rate];
    341341}
    342342
  • trunk/Source/WebCore/testing/Internals.cpp

    r178462 r178486  
    6060#include "HTMLSelectElement.h"
    6161#include "HTMLTextAreaElement.h"
     62#include "HTMLVideoElement.h"
    6263#include "HistoryController.h"
    6364#include "HistoryItem.h"
     
    24352436}
    24362437
     2438bool Internals::elementIsBlockingDisplaySleep(Element* element) const
     2439{
     2440    HTMLMediaElement* mediaElement = downcast<HTMLMediaElement>(element);
     2441    return mediaElement ? mediaElement->isDisablingSleep() : false;
     2442}
     2443
    24372444void Internals::installMockPageOverlay(const String& overlayType, ExceptionCode& ec)
    24382445{
  • trunk/Source/WebCore/testing/Internals.h

    r178462 r178486  
    352352    void simulateSystemSleep() const;
    353353    void simulateSystemWake() const;
     354    bool elementIsBlockingDisplaySleep(Element*) const;
    354355
    355356    void installMockPageOverlay(const String& overlayType, ExceptionCode&);
  • trunk/Source/WebCore/testing/Internals.idl

    r178462 r178486  
    308308    [Conditional=VIDEO] void simulateSystemSleep();
    309309    [Conditional=VIDEO] void simulateSystemWake();
     310    [Conditional=VIDEO] boolean elementIsBlockingDisplaySleep(Element element);
    310311
    311312    [RaisesException] void installMockPageOverlay(PageOverlayType type);
Note: See TracChangeset for help on using the changeset viewer.