Changeset 201435 in webkit


Ignore:
Timestamp:
May 26, 2016, 3:05:26 PM (9 years ago)
Author:
adachan@apple.com
Message:

Add WebKitAdditions extension point in HTMLMediaElement.
https://bugs.webkit.org/show_bug.cgi?id=158097

Reviewed by Eric Carlson.

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::shouldOverrideBackgroundLoadingRestriction):
We need to load data in the background if playing to wireless playback target.
(WebCore::HTMLMediaElement::fullscreenModeChanged):
Moved from header file.

  • html/HTMLMediaElement.h:
  • platform/audio/PlatformMediaSession.cpp:

(WebCore::PlatformMediaSession::clientWillPausePlayback):
The code to start m_clientDataBufferingTimer is also in visibilityChanged().
Moved that code to PlatformMediaSession::scheduleClientDataBufferingCheck() and call
that method here.
(WebCore::PlatformMediaSession::visibilityChanged):
Call PlatformMediaSession::scheduleClientDataBufferingCheck().
(WebCore::PlatformMediaSession::scheduleClientDataBufferingCheck):
Start m_clientDataBufferingTimer if it's not already active.
(WebCore::PlatformMediaSession::shouldOverrideBackgroundLoadingRestriction):
Call the client.

  • platform/audio/PlatformMediaSession.h:

(WebCore::PlatformMediaSessionClient::shouldOverrideBackgroundLoadingRestriction):

  • platform/audio/PlatformMediaSessionManager.cpp:

(WebCore::PlatformMediaSessionManager::sessionCanLoadMedia):
Call the new PlatformMediaSession::shouldOverrideBackgroundLoadingRestriction().

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r201432 r201435  
     12016-05-25  Ada Chan  <adachan@apple.com>
     2
     3        Add WebKitAdditions extension point in HTMLMediaElement.
     4        https://bugs.webkit.org/show_bug.cgi?id=158097
     5
     6        Reviewed by Eric Carlson.
     7
     8        * html/HTMLMediaElement.cpp:
     9        (WebCore::HTMLMediaElement::shouldOverrideBackgroundLoadingRestriction):
     10        We need to load data in the background if playing to wireless playback target.
     11        (WebCore::HTMLMediaElement::fullscreenModeChanged):
     12        Moved from header file.
     13        * html/HTMLMediaElement.h:
     14
     15        * platform/audio/PlatformMediaSession.cpp:
     16        (WebCore::PlatformMediaSession::clientWillPausePlayback):
     17        The code to start m_clientDataBufferingTimer is also in visibilityChanged().
     18        Moved that code to PlatformMediaSession::scheduleClientDataBufferingCheck() and call
     19        that method here.
     20        (WebCore::PlatformMediaSession::visibilityChanged):
     21        Call PlatformMediaSession::scheduleClientDataBufferingCheck().
     22        (WebCore::PlatformMediaSession::scheduleClientDataBufferingCheck):
     23        Start m_clientDataBufferingTimer if it's not already active.
     24        (WebCore::PlatformMediaSession::shouldOverrideBackgroundLoadingRestriction):
     25        Call the client.
     26
     27        * platform/audio/PlatformMediaSession.h:
     28        (WebCore::PlatformMediaSessionClient::shouldOverrideBackgroundLoadingRestriction):
     29
     30        * platform/audio/PlatformMediaSessionManager.cpp:
     31        (WebCore::PlatformMediaSessionManager::sessionCanLoadMedia):
     32        Call the new PlatformMediaSession::shouldOverrideBackgroundLoadingRestriction().
     33
    1342016-05-26  Jer Noble  <jer.noble@apple.com>
    235
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r201305 r201435  
    153153#endif
    154154
     155#if USE(APPLE_INTERNAL_SDK)
     156#include <WebKitAdditions/HTMLMediaElementAdditions.cpp>
     157#endif
     158
    155159namespace WebCore {
    156160
     
    70257029}
    70267030
    7027 }
    7028 
    7029 #endif
     7031#if !USE(APPLE_INTERNAL_SDK)
     7032bool HTMLMediaElement::shouldOverrideBackgroundLoadingRestriction() const
     7033{
     7034#if ENABLE(WIRELESS_PLAYBACK_TARGET)
     7035    if (isPlayingToWirelessPlaybackTarget())
     7036        return true;
     7037#endif
     7038
     7039    return false;
     7040}
     7041
     7042void HTMLMediaElement::fullscreenModeChanged(VideoFullscreenMode mode)
     7043{
     7044    m_videoFullscreenMode = mode;
     7045}
     7046#endif
     7047
     7048}
     7049
     7050#endif
  • trunk/Source/WebCore/html/HTMLMediaElement.h

    r201305 r201435  
    371371    using MediaPlayerEnums::VideoFullscreenMode;
    372372    VideoFullscreenMode fullscreenMode() const { return m_videoFullscreenMode; }
    373     virtual void fullscreenModeChanged(VideoFullscreenMode mode) { m_videoFullscreenMode = mode; }
     373    virtual void fullscreenModeChanged(VideoFullscreenMode);
    374374
    375375    void enterFullscreen(VideoFullscreenMode);
     
    758758    void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) override;
    759759    bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const override;
     760    bool shouldOverrideBackgroundLoadingRestriction() const override;
    760761
    761762    void pageMutedStateDidChange() override;
  • trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp

    r200446 r201435  
    187187    setState(Paused);
    188188    PlatformMediaSessionManager::sharedManager().sessionWillEndPlayback(*this);
    189     if (!m_clientDataBufferingTimer.isActive())
    190         m_clientDataBufferingTimer.startOneShot(kClientDataBufferingTimerThrottleDelay);
     189    scheduleClientDataBufferingCheck();
    191190    return true;
    192191}
     
    249248void PlatformMediaSession::visibilityChanged()
    250249{
     250    scheduleClientDataBufferingCheck();
     251}
     252
     253void PlatformMediaSession::scheduleClientDataBufferingCheck()
     254{
    251255    if (!m_clientDataBufferingTimer.isActive())
    252256        m_clientDataBufferingTimer.startOneShot(kClientDataBufferingTimerThrottleDelay);
     
    282286{
    283287    return m_client.elementIsHidden();
     288}
     289
     290bool PlatformMediaSession::shouldOverrideBackgroundLoadingRestriction() const
     291{
     292    return m_client.shouldOverrideBackgroundLoadingRestriction();
    284293}
    285294
  • trunk/Source/WebCore/platform/audio/PlatformMediaSession.h

    r199351 r201435  
    138138    bool isHidden() const;
    139139
     140    bool shouldOverrideBackgroundLoadingRestriction() const;
     141
    140142    virtual bool canPlayToWirelessPlaybackTarget() const { return false; }
    141143    virtual bool isPlayingToWirelessPlaybackTarget() const { return m_isPlayingToWirelessPlaybackTarget; }
     
    156158    bool canProduceAudio() const { return m_canProduceAudio; }
    157159    void setCanProduceAudio(bool);
     160
     161    void scheduleClientDataBufferingCheck();
    158162
    159163protected:
     
    204208
    205209    virtual bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const = 0;
     210    virtual bool shouldOverrideBackgroundLoadingRestriction() const { return false; }
    206211
    207212    virtual void wirelessRoutesAvailableDidChange() { }
  • trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp

    r199351 r201435  
    281281bool PlatformMediaSessionManager::sessionCanLoadMedia(const PlatformMediaSession& session) const
    282282{
    283     return session.state() == PlatformMediaSession::Playing || !session.isHidden() || session.isPlayingToWirelessPlaybackTarget();
     283    return session.state() == PlatformMediaSession::Playing || !session.isHidden() || session.shouldOverrideBackgroundLoadingRestriction();
    284284}
    285285
Note: See TracChangeset for help on using the changeset viewer.