Title: [215617] trunk/Source/WebCore
- Revision
- 215617
- Author
- [email protected]
- Date
- 2017-04-21 11:09:41 -0700 (Fri, 21 Apr 2017)
Log 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:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (215616 => 215617)
--- trunk/Source/WebCore/ChangeLog 2017-04-21 17:58:32 UTC (rev 215616)
+++ trunk/Source/WebCore/ChangeLog 2017-04-21 18:09:41 UTC (rev 215617)
@@ -1,3 +1,28 @@
+2017-04-21 Jer Noble <[email protected]>
+
+ 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:
+
2017-04-21 Konstantin Tokarev <[email protected]>
[cmake] WTF target should not have wtf and subdirectries in public interface
Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (215616 => 215617)
--- trunk/Source/WebCore/html/MediaElementSession.cpp 2017-04-21 17:58:32 UTC (rev 215616)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp 2017-04-21 18:09:41 UTC (rev 215617)
@@ -370,6 +370,8 @@
bool MediaElementSession::wantsToObserveViewportVisibilityForAutoplay() const
{
+ if (!m_element.isVideo())
+ return false;
return hasBehaviorRestriction(InvisibleAutoplayNotPermitted) || hasBehaviorRestriction(OverrideUserGestureRequirementForMainContent);
}
Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp (215616 => 215617)
--- trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp 2017-04-21 17:58:32 UTC (rev 215616)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp 2017-04-21 18:09:41 UTC (rev 215617)
@@ -69,6 +69,7 @@
m_restrictions[PlatformMediaSession::Audio] = NoRestrictions;
m_restrictions[PlatformMediaSession::VideoAudio] = NoRestrictions;
m_restrictions[PlatformMediaSession::WebAudio] = NoRestrictions;
+ m_restrictions[PlatformMediaSession::MediaStreamCapturingAudio] = NoRestrictions;
}
bool PlatformMediaSessionManager::has(PlatformMediaSession::MediaType type) const
@@ -168,19 +169,19 @@
void PlatformMediaSessionManager::addRestriction(PlatformMediaSession::MediaType type, SessionRestrictions restriction)
{
- ASSERT(type > PlatformMediaSession::None && type <= PlatformMediaSession::WebAudio);
+ ASSERT(type > PlatformMediaSession::None && type <= PlatformMediaSession::MediaStreamCapturingAudio);
m_restrictions[type] |= restriction;
}
void PlatformMediaSessionManager::removeRestriction(PlatformMediaSession::MediaType type, SessionRestrictions restriction)
{
- ASSERT(type > PlatformMediaSession::None && type <= PlatformMediaSession::WebAudio);
+ ASSERT(type > PlatformMediaSession::None && type <= PlatformMediaSession::MediaStreamCapturingAudio);
m_restrictions[type] &= ~restriction;
}
PlatformMediaSessionManager::SessionRestrictions PlatformMediaSessionManager::restrictions(PlatformMediaSession::MediaType type)
{
- ASSERT(type > PlatformMediaSession::None && type <= PlatformMediaSession::WebAudio);
+ ASSERT(type > PlatformMediaSession::None && type <= PlatformMediaSession::MediaStreamCapturingAudio);
return m_restrictions[type];
}
Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h (215616 => 215617)
--- trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2017-04-21 17:58:32 UTC (rev 215616)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2017-04-21 18:09:41 UTC (rev 215617)
@@ -135,7 +135,7 @@
void systemWillSleep() override;
void systemDidWake() override;
- SessionRestrictions m_restrictions[PlatformMediaSession::WebAudio + 1];
+ SessionRestrictions m_restrictions[PlatformMediaSession::MediaStreamCapturingAudio + 1];
mutable Vector<PlatformMediaSession*> m_sessions;
std::unique_ptr<RemoteCommandListener> m_remoteCommandListener;
std::unique_ptr<SystemSleepListener> m_systemSleepListener;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes