Title: [276978] trunk/Source/WebCore
Revision
276978
Author
jer.no...@apple.com
Date
2021-05-04 12:29:31 -0700 (Tue, 04 May 2021)

Log Message

REGRESSION (r276883): [Debug] ASSERTION FAILED: index != notFound in WebCore::PlatformMediaSessionManager::setCurrentSession()
https://bugs.webkit.org/show_bug.cgi?id=225332
<rdar://problem/77476145>

Reviewed by Eric Carlson.

PlatformMediaSessionManager will throw an assert if the session being set as "current" via
sessionWillBeginPlayback() isn't active; we activate the session immediately after this line
inside lazyInitialize(), but this looks to be too late. A similar problem may occur in
HTMLMediaElement::playInternal(), so activate the session there too.

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::lazyInitialize):
(WebCore::AudioContext::willBeginPlayback):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::playInternal):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (276977 => 276978)


--- trunk/Source/WebCore/ChangeLog	2021-05-04 19:25:04 UTC (rev 276977)
+++ trunk/Source/WebCore/ChangeLog	2021-05-04 19:29:31 UTC (rev 276978)
@@ -1,3 +1,22 @@
+2021-05-04  Jer Noble  <jer.no...@apple.com>
+
+        REGRESSION (r276883): [Debug] ASSERTION FAILED: index != notFound in WebCore::PlatformMediaSessionManager::setCurrentSession()
+        https://bugs.webkit.org/show_bug.cgi?id=225332
+        <rdar://problem/77476145>
+
+        Reviewed by Eric Carlson.
+
+        PlatformMediaSessionManager will throw an assert if the session being set as "current" via
+        sessionWillBeginPlayback() isn't active; we activate the session immediately after this line
+        inside lazyInitialize(), but this looks to be too late. A similar problem may occur in
+        HTMLMediaElement::playInternal(), so activate the session there too.
+
+        * Modules/webaudio/AudioContext.cpp:
+        (WebCore::AudioContext::lazyInitialize):
+        (WebCore::AudioContext::willBeginPlayback):
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::playInternal):
+
 2021-05-04  Sergio Villar Senin  <svil...@igalia.com>
 
         ASSERTION FAILED: contentSize >= 0 in WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax

Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (276977 => 276978)


--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2021-05-04 19:25:04 UTC (rev 276977)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2021-05-04 19:29:31 UTC (rev 276978)
@@ -311,7 +311,6 @@
 
     BaseAudioContext::lazyInitialize();
     if (isInitialized()) {
-        m_mediaSession->setActive(true);
         if (state() != State::Running) {
             // This starts the audio thread. The destination node's provideInput() method will now be called repeatedly to render audio.
             // Each time provideInput() is called, a portion of the audio stream is rendered. Let's call this time period a "render quantum".
@@ -399,6 +398,8 @@
         removeBehaviorRestriction(RequirePageConsentForAudioStartRestriction);
     }
 
+    m_mediaSession->setActive(true);
+
     auto willBegin = m_mediaSession->clientWillBeginPlayback();
     ALWAYS_LOG(LOGIDENTIFIER, "returning ", willBegin);
 

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (276977 => 276978)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2021-05-04 19:25:04 UTC (rev 276977)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2021-05-04 19:29:31 UTC (rev 276978)
@@ -3505,6 +3505,7 @@
         return;
     }
 
+    mediaSession().setActive(true);
     if (!mediaSession().clientWillBeginPlayback()) {
         ALWAYS_LOG(LOGIDENTIFIER, "returning because of interruption");
         return;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to