Title: [170370] trunk/Source/WebCore
- Revision
- 170370
- Author
- [email protected]
- Date
- 2014-06-24 10:20:36 -0700 (Tue, 24 Jun 2014)
Log Message
Don't set AudioSession active while interrupted.
https://bugs.webkit.org/show_bug.cgi?id=134239
Patch by Jeremy Jones <[email protected]> on 2014-06-24
Reviewed by Eric Carlson.
To activate the AudioSession there must be a session with audio or video
and being playing or paused.
* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::hasActive): added
(WebCore::MediaSessionManager::beginInterruption): updateSessionState
(WebCore::MediaSessionManager::sessionWillBeginPlayback): updateSessionState
* platform/audio/MediaSessionManager.h: declare hasActive()
* platform/audio/mac/MediaSessionManagerMac.cpp:
(MediaSessionManager::updateSessionState): use hasActive()
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (170369 => 170370)
--- trunk/Source/WebCore/ChangeLog 2014-06-24 17:18:26 UTC (rev 170369)
+++ trunk/Source/WebCore/ChangeLog 2014-06-24 17:20:36 UTC (rev 170370)
@@ -1,3 +1,21 @@
+2014-06-24 Jeremy Jones <[email protected]>
+
+ Don't set AudioSession active while interrupted.
+ https://bugs.webkit.org/show_bug.cgi?id=134239
+
+ Reviewed by Eric Carlson.
+
+ To activate the AudioSession there must be a session with audio or video
+ and being playing or paused.
+
+ * platform/audio/MediaSessionManager.cpp:
+ (WebCore::MediaSessionManager::hasActive): added
+ (WebCore::MediaSessionManager::beginInterruption): updateSessionState
+ (WebCore::MediaSessionManager::sessionWillBeginPlayback): updateSessionState
+ * platform/audio/MediaSessionManager.h: declare hasActive()
+ * platform/audio/mac/MediaSessionManagerMac.cpp:
+ (MediaSessionManager::updateSessionState): use hasActive()
+
2014-06-24 Jer Noble <[email protected]>
REGRESSION(r170336): Crash in HTMLMediaElement::seekTimerFired()
Modified: trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp (170369 => 170370)
--- trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp 2014-06-24 17:18:26 UTC (rev 170369)
+++ trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp 2014-06-24 17:20:36 UTC (rev 170370)
@@ -68,6 +68,16 @@
return false;
}
+bool MediaSessionManager::hasActive() const
+{
+ for (auto* session : m_sessions) {
+ if (session->mediaType() != MediaSession::None && (session->state() == MediaSession::State::Playing || session->state() == MediaSession::State::Paused))
+ return true;
+ }
+
+ return false;
+}
+
int MediaSessionManager::count(MediaSession::MediaType type) const
{
ASSERT(type >= MediaSession::None && type <= MediaSession::WebAudio);
@@ -89,6 +99,7 @@
Vector<MediaSession*> sessions = m_sessions;
for (auto* session : sessions)
session->beginInterruption(type);
+ updateSessionState();
}
void MediaSessionManager::endInterruption(MediaSession::EndInterruptionFlags flags)
@@ -185,6 +196,8 @@
if (restrictions & ConcurrentPlaybackNotPermitted)
oneSession->pauseSession();
}
+
+ updateSessionState();
}
void MediaSessionManager::sessionWillEndPlayback(MediaSession& session)
Modified: trunk/Source/WebCore/platform/audio/MediaSessionManager.h (170369 => 170370)
--- trunk/Source/WebCore/platform/audio/MediaSessionManager.h 2014-06-24 17:18:26 UTC (rev 170369)
+++ trunk/Source/WebCore/platform/audio/MediaSessionManager.h 2014-06-24 17:20:36 UTC (rev 170370)
@@ -58,6 +58,7 @@
virtual ~MediaSessionManager() { }
bool has(MediaSession::MediaType) const;
+ bool hasActive() const;
int count(MediaSession::MediaType) const;
void beginInterruption(MediaSession::InterruptionType);
Modified: trunk/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.cpp (170369 => 170370)
--- trunk/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.cpp 2014-06-24 17:18:26 UTC (rev 170369)
+++ trunk/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.cpp 2014-06-24 17:20:36 UTC (rev 170370)
@@ -55,10 +55,7 @@
#endif
#if PLATFORM(IOS)
- if (has(MediaSession::WebAudio) || has(MediaSession::Video) || has(MediaSession::Audio))
- AudioSession::sharedSession().setActive(true);
- else
- AudioSession::sharedSession().setActive(false);
+ AudioSession::sharedSession().setActive(hasActive());
if (!Settings::shouldManageAudioSessionCategory())
return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes