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

Changeset 215617 in webkit


Ignore:
Timestamp:
Apr 21, 2017, 11:09:41 AM (9 years ago)
Author:
jer.noble@apple.com
Message:

Fix some spurious ASSERTs when working with capturing media elements
https://bugs.webkit.org/show_bug.cgi?id=171096

Reviewed by Youenn Fablet.

Two related ASSERTS:

1) When we added a new PlatformMediaSession MediaType (MediaStreamCapturingAudio), we did not update all the
places that validated the enum. This would lead to spurious ASSERTs when an element capturing audio would
fail various checks to enusre it's type's validity.

2) Audio elements will ASSERT when they change page visibility, as they do not have a renderer which implements
visibleInViewportStateChanged(). So opt out of visibility-state checking for non-video media elements.

  • html/MediaElementSession.cpp:

(WebCore::MediaElementSession::wantsToObserveViewportVisibilityForAutoplay):

  • platform/audio/PlatformMediaSessionManager.cpp:

(WebCore::PlatformMediaSessionManager::resetRestrictions):
(WebCore::PlatformMediaSessionManager::addRestriction):
(WebCore::PlatformMediaSessionManager::removeRestriction):
(WebCore::PlatformMediaSessionManager::restrictions):

  • platform/audio/PlatformMediaSessionManager.h:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r215614 r215617  
     12017-04-21  Jer Noble  <jer.noble@apple.com>
     2
     3        Fix some spurious ASSERTs when working with capturing media elements
     4        https://bugs.webkit.org/show_bug.cgi?id=171096
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Two related ASSERTS:
     9
     10        1) When we added a new PlatformMediaSession MediaType (MediaStreamCapturingAudio), we did not update all the
     11        places that validated the enum. This would lead to spurious ASSERTs when an element capturing audio would
     12        fail various checks to enusre it's type's validity.
     13
     14        2) Audio elements will ASSERT when they change page visibility, as they do not have a renderer which implements
     15        visibleInViewportStateChanged(). So opt out of visibility-state checking for non-video media elements.
     16
     17        * html/MediaElementSession.cpp:
     18        (WebCore::MediaElementSession::wantsToObserveViewportVisibilityForAutoplay):
     19        * platform/audio/PlatformMediaSessionManager.cpp:
     20        (WebCore::PlatformMediaSessionManager::resetRestrictions):
     21        (WebCore::PlatformMediaSessionManager::addRestriction):
     22        (WebCore::PlatformMediaSessionManager::removeRestriction):
     23        (WebCore::PlatformMediaSessionManager::restrictions):
     24        * platform/audio/PlatformMediaSessionManager.h:
     25
    1262017-04-21  Konstantin Tokarev  <annulen@yandex.ru>
    227
  • trunk/Source/WebCore/html/MediaElementSession.cpp

    r215452 r215617  
    371371bool MediaElementSession::wantsToObserveViewportVisibilityForAutoplay() const
    372372{
     373    if (!m_element.isVideo())
     374        return false;
    373375    return hasBehaviorRestriction(InvisibleAutoplayNotPermitted) || hasBehaviorRestriction(OverrideUserGestureRequirementForMainContent);
    374376}
  • trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp

    r215242 r215617  
    7070    m_restrictions[PlatformMediaSession::VideoAudio] = NoRestrictions;
    7171    m_restrictions[PlatformMediaSession::WebAudio] = NoRestrictions;
     72    m_restrictions[PlatformMediaSession::MediaStreamCapturingAudio] = NoRestrictions;
    7273}
    7374
     
    169170void PlatformMediaSessionManager::addRestriction(PlatformMediaSession::MediaType type, SessionRestrictions restriction)
    170171{
    171     ASSERT(type > PlatformMediaSession::None && type <= PlatformMediaSession::WebAudio);
     172    ASSERT(type > PlatformMediaSession::None && type <= PlatformMediaSession::MediaStreamCapturingAudio);
    172173    m_restrictions[type] |= restriction;
    173174}
     
    175176void PlatformMediaSessionManager::removeRestriction(PlatformMediaSession::MediaType type, SessionRestrictions restriction)
    176177{
    177     ASSERT(type > PlatformMediaSession::None && type <= PlatformMediaSession::WebAudio);
     178    ASSERT(type > PlatformMediaSession::None && type <= PlatformMediaSession::MediaStreamCapturingAudio);
    178179    m_restrictions[type] &= ~restriction;
    179180}
     
    181182PlatformMediaSessionManager::SessionRestrictions PlatformMediaSessionManager::restrictions(PlatformMediaSession::MediaType type)
    182183{
    183     ASSERT(type > PlatformMediaSession::None && type <= PlatformMediaSession::WebAudio);
     184    ASSERT(type > PlatformMediaSession::None && type <= PlatformMediaSession::MediaStreamCapturingAudio);
    184185    return m_restrictions[type];
    185186}
  • trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h

    r210828 r215617  
    136136    void systemDidWake() override;
    137137
    138     SessionRestrictions m_restrictions[PlatformMediaSession::WebAudio + 1];
     138    SessionRestrictions m_restrictions[PlatformMediaSession::MediaStreamCapturingAudio + 1];
    139139    mutable Vector<PlatformMediaSession*> m_sessions;
    140140    std::unique_ptr<RemoteCommandListener> m_remoteCommandListener;
Note: See TracChangeset for help on using the changeset viewer.