WebKit Bugzilla
Attachment 346282 Details for
Bug 188230
: Always use MediaPlayback audio category when playing to AppleTV
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch.
media_playback_category_patch.txt (text/plain), 5.75 KB, created by
Eric Carlson
on 2018-08-01 11:12:57 PDT
(
hide
)
Description:
Proposed patch.
Filename:
MIME Type:
Creator:
Eric Carlson
Created:
2018-08-01 11:12:57 PDT
Size:
5.75 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 44dd219a253..cfcc2ce7252 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2018-08-01 Eric Carlson <eric.carlson@apple.com> >+ >+ Always use MediaPlayback audio category when playing to AppleTV or behind lock screen >+ https://bugs.webkit.org/show_bug.cgi?id=188230 >+ <rdar://problem/42497809> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * platform/audio/PlatformMediaSession.cpp: >+ (WebCore::PlatformMediaSession::mediaPlaybackAudioCategoryRequired const): New. >+ * platform/audio/PlatformMediaSession.h: >+ >+ * platform/audio/PlatformMediaSessionManager.cpp: >+ (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground const): Set m_suspendedUnderLock. >+ (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground const): Clear m_suspendedUnderLock. >+ >+ * platform/audio/PlatformMediaSessionManager.h: >+ (WebCore::PlatformMediaSessionManager::applicationSuspendedUnderLock const): >+ >+ * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: >+ (PlatformMediaSessionManager::updateSessionState): Check session.mediaPlaybackAudioCategoryRequired(). >+ > 2018-08-01 Eric Carlson <eric.carlson@apple.com> > > [iOS] Remove the delay before setting audio session category added in r233535 >diff --git a/Source/WebCore/platform/audio/PlatformMediaSession.cpp b/Source/WebCore/platform/audio/PlatformMediaSession.cpp >index ee19b67530e..2f9b8884b80 100644 >--- a/Source/WebCore/platform/audio/PlatformMediaSession.cpp >+++ b/Source/WebCore/platform/audio/PlatformMediaSession.cpp >@@ -326,6 +326,18 @@ bool PlatformMediaSession::activeAudioSessionRequired() > return canProduceAudio(); > } > >+bool PlatformMediaSession::mediaPlaybackAudioCategoryRequired() const >+{ >+ auto type = mediaType(); >+ if (type != PlatformMediaSession::VideoAudio && type != PlatformMediaSession::Audio) >+ return false; >+ >+ if (isPlayingToWirelessPlaybackTarget() || PlatformMediaSessionManager::sharedManager().applicationSuspendedUnderLock()) >+ return true; >+ >+ return canProduceAudio() && state() == PlatformMediaSession::State::Playing; >+} >+ > bool PlatformMediaSession::canProduceAudio() const > { > return m_client.canProduceAudio(); >diff --git a/Source/WebCore/platform/audio/PlatformMediaSession.h b/Source/WebCore/platform/audio/PlatformMediaSession.h >index fd6f08cdfbd..0b66c51c018 100644 >--- a/Source/WebCore/platform/audio/PlatformMediaSession.h >+++ b/Source/WebCore/platform/audio/PlatformMediaSession.h >@@ -168,6 +168,7 @@ public: > #endif > > bool activeAudioSessionRequired(); >+ bool mediaPlaybackAudioCategoryRequired() const; > bool canProduceAudio() const; > void canProduceAudioChanged(); > >diff --git a/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp b/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp >index 95317311190..cb1fcd8267c 100644 >--- a/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp >+++ b/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp >@@ -315,6 +315,8 @@ void PlatformMediaSessionManager::applicationDidEnterBackground(bool suspendedUn > { > LOG(Media, "PlatformMediaSessionManager::applicationDidEnterBackground - suspendedUnderLock(%d)", suspendedUnderLock); > >+ m_suspendedUnderLock = suspendedUnderLock; >+ > if (m_isApplicationInBackground) > return; > >@@ -336,6 +338,7 @@ void PlatformMediaSessionManager::applicationWillEnterForeground(bool suspendedU > return; > > m_isApplicationInBackground = false; >+ m_suspendedUnderLock = false; > > forEachSession([&] (PlatformMediaSession& session, size_t) { > if ((suspendedUnderLock && m_restrictions[session.mediaType()] & SuspendedUnderLockPlaybackRestricted) || m_restrictions[session.mediaType()] & BackgroundProcessPlaybackRestricted) >diff --git a/Source/WebCore/platform/audio/PlatformMediaSessionManager.h b/Source/WebCore/platform/audio/PlatformMediaSessionManager.h >index ad363839683..a70c3e4d33c 100644 >--- a/Source/WebCore/platform/audio/PlatformMediaSessionManager.h >+++ b/Source/WebCore/platform/audio/PlatformMediaSessionManager.h >@@ -73,6 +73,7 @@ public: > WEBCORE_EXPORT void applicationDidBecomeActive() const; > WEBCORE_EXPORT void applicationWillEnterForeground(bool suspendedUnderLock) const; > WEBCORE_EXPORT void applicationDidEnterBackground(bool suspendedUnderLock) const; >+ bool applicationSuspendedUnderLock() const { return m_suspendedUnderLock; } > > void stopAllMediaPlaybackForDocument(const Document*); > WEBCORE_EXPORT void stopAllMediaPlaybackForProcess(); >@@ -154,6 +155,7 @@ private: > > bool m_interrupted { false }; > mutable bool m_isApplicationInBackground { false }; >+ mutable bool m_suspendedUnderLock { false }; > bool m_willIgnoreSystemInterruptions { false }; > mutable int m_iteratingOverSessions { 0 }; > }; >diff --git a/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp b/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp >index c958c32f7ed..112a099aa3b 100644 >--- a/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp >+++ b/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp >@@ -70,7 +70,7 @@ void PlatformMediaSessionManager::updateSessionState() > auto type = session.mediaType(); > if (type == PlatformMediaSession::WebAudio) > hasWebAudioType = true; >- if ((type == PlatformMediaSession::VideoAudio || type == PlatformMediaSession::Audio) && session.canProduceAudio() && session.state() == PlatformMediaSession::Playing) >+ if (session.mediaPlaybackAudioCategoryRequired()) > hasAudibleAudioOrVideoMediaType = true; > return (type == PlatformMediaSession::MediaStreamCapturingAudio); > });
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188230
:
346282
|
346285