WebKit Bugzilla
Attachment 346280 Details for
Bug 188225
: [iOS] Remove the delay before setting audio session category added in r233535
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch.
revert_audio_session_delay_patch.txt (text/plain), 8.56 KB, created by
Eric Carlson
on 2018-08-01 10:20:31 PDT
(
hide
)
Description:
Proposed patch.
Filename:
MIME Type:
Creator:
Eric Carlson
Created:
2018-08-01 10:20:31 PDT
Size:
8.56 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 4b8a6aa2efb..44dd219a253 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,27 @@ >+2018-08-01 Eric Carlson <eric.carlson@apple.com> >+ >+ [iOS] Remove the delay before setting audio session category added in r233535 >+ https://bugs.webkit.org/show_bug.cgi?id=188225 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * platform/audio/PlatformMediaSessionManager.cpp: >+ (WebCore::PlatformMediaSessionManager::beginInterruption): scheduleUpdateSessionState -> updateSessionState. >+ (WebCore::PlatformMediaSessionManager::addSession): Ditto. >+ (WebCore::PlatformMediaSessionManager::removeSession): Ditto. >+ (WebCore::PlatformMediaSessionManager::sessionStateChanged): Ditto. >+ (WebCore::PlatformMediaSessionManager::sessionCanProduceAudioChanged): Ditto. >+ (WebCore::PlatformMediaSessionManager::updateSessionState): Ditto. >+ (WebCore::PlatformMediaSessionManager::audioOutputDeviceChanged): Ditto. >+ (WebCore::PlatformMediaSessionManager::scheduleUpdateSessionState): Deleted. >+ * platform/audio/PlatformMediaSessionManager.h: >+ >+ * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: >+ (PlatformMediaSessionManager::updateSessionState): >+ (PlatformMediaSessionManager::scheduleUpdateSessionState): Deleted. >+ * rendering/RenderLayer.cpp: >+ (WebCore::RenderLayer::updateClipRects): >+ > 2018-08-01 Thibault Saunier <tsaunier@igalia.com> > > [GStreamer] Make sure that first buffer running time is 0 in GStreamerMediaStreamSource >diff --git a/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp b/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp >index f8c531a7bc2..95317311190 100644 >--- a/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp >+++ b/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp >@@ -116,7 +116,7 @@ void PlatformMediaSessionManager::beginInterruption(PlatformMediaSession::Interr > forEachSession([type] (PlatformMediaSession& session, size_t) { > session.beginInterruption(type); > }); >- scheduleUpdateSessionState(); >+ updateSessionState(); > } > > void PlatformMediaSessionManager::endInterruption(PlatformMediaSession::EndInterruptionFlags flags) >@@ -143,7 +143,7 @@ void PlatformMediaSessionManager::addSession(PlatformMediaSession& session) > if (!m_audioHardwareListener) > m_audioHardwareListener = AudioHardwareListener::create(*this); > >- scheduleUpdateSessionState(); >+ updateSessionState(); > } > > void PlatformMediaSessionManager::removeSession(PlatformMediaSession& session) >@@ -164,7 +164,7 @@ void PlatformMediaSessionManager::removeSession(PlatformMediaSession& session) > m_audioHardwareListener = nullptr; > } > >- scheduleUpdateSessionState(); >+ updateSessionState(); > } > > void PlatformMediaSessionManager::addRestriction(PlatformMediaSession::MediaType type, SessionRestrictions restriction) >@@ -250,7 +250,7 @@ void PlatformMediaSessionManager::sessionWillEndPlayback(PlatformMediaSession& s > > void PlatformMediaSessionManager::sessionStateChanged(PlatformMediaSession&) > { >- scheduleUpdateSessionState(); >+ updateSessionState(); > } > > void PlatformMediaSessionManager::setCurrentSession(PlatformMediaSession& session) >@@ -354,11 +354,11 @@ void PlatformMediaSessionManager::sessionIsPlayingToWirelessPlaybackTargetChange > > void PlatformMediaSessionManager::sessionCanProduceAudioChanged(PlatformMediaSession&) > { >- scheduleUpdateSessionState(); >+ updateSessionState(); > } > > #if !PLATFORM(COCOA) >-void PlatformMediaSessionManager::scheduleUpdateSessionState() >+void PlatformMediaSessionManager::updateSessionState() > { > } > #endif >@@ -401,7 +401,7 @@ void PlatformMediaSessionManager::systemDidWake() > > void PlatformMediaSessionManager::audioOutputDeviceChanged() > { >- scheduleUpdateSessionState(); >+ updateSessionState(); > } > > void PlatformMediaSessionManager::stopAllMediaPlaybackForDocument(const Document* document) >diff --git a/Source/WebCore/platform/audio/PlatformMediaSessionManager.h b/Source/WebCore/platform/audio/PlatformMediaSessionManager.h >index 0e3dffd717e..ad363839683 100644 >--- a/Source/WebCore/platform/audio/PlatformMediaSessionManager.h >+++ b/Source/WebCore/platform/audio/PlatformMediaSessionManager.h >@@ -126,7 +126,7 @@ protected: > private: > friend class Internals; > >- void scheduleUpdateSessionState(); >+ void updateSessionState(); > > // RemoteCommandListenerClient > WEBCORE_EXPORT void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType, const PlatformMediaSession::RemoteCommandArgument*) override; >@@ -152,8 +152,6 @@ private: > bool m_canPlayToTarget { false }; > #endif > >- std::unique_ptr<DeferrableOneShotTimer> m_updateStateTimer; >- > bool m_interrupted { false }; > mutable bool m_isApplicationInBackground { false }; > bool m_willIgnoreSystemInterruptions { false }; >diff --git a/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp b/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp >index fbf2f29cf50..c958c32f7ed 100644 >--- a/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp >+++ b/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp >@@ -37,9 +37,8 @@ using namespace WebCore; > > static const size_t kWebAudioBufferSize = 128; > static const size_t kLowPowerVideoBufferSize = 4096; >-static const Seconds updateSessionStateDelay { 100_ms }; > >-void PlatformMediaSessionManager::scheduleUpdateSessionState() >+void PlatformMediaSessionManager::updateSessionState() > { > LOG(Media, "PlatformMediaSessionManager::scheduleUpdateSessionState() - types: Video(%d), Audio(%d), WebAudio(%d)", count(PlatformMediaSession::Video), count(PlatformMediaSession::Audio), count(PlatformMediaSession::WebAudio)); > >@@ -65,34 +64,25 @@ void PlatformMediaSessionManager::scheduleUpdateSessionState() > if (!DeprecatedGlobalSettings::shouldManageAudioSessionCategory()) > return; > >- if (!m_updateStateTimer) { >- auto updateSessionState = [this] () mutable { >- >- bool hasWebAudioType = false; >- bool hasAudibleAudioOrVideoMediaType = false; >- bool hasAudioCapture = anyOfSessions([&hasWebAudioType, &hasAudibleAudioOrVideoMediaType] (PlatformMediaSession& session, size_t) mutable { >- auto type = session.mediaType(); >- if (type == PlatformMediaSession::WebAudio) >- hasWebAudioType = true; >- if ((type == PlatformMediaSession::VideoAudio || type == PlatformMediaSession::Audio) && session.canProduceAudio() && session.state() == PlatformMediaSession::Playing) >- hasAudibleAudioOrVideoMediaType = true; >- return (type == PlatformMediaSession::MediaStreamCapturingAudio); >- }); >- >- if (hasAudioCapture) >- AudioSession::sharedSession().setCategory(AudioSession::PlayAndRecord); >- else if (hasAudibleAudioOrVideoMediaType) >- AudioSession::sharedSession().setCategory(AudioSession::MediaPlayback); >- else if (hasWebAudioType) >- AudioSession::sharedSession().setCategory(AudioSession::AmbientSound); >- else >- AudioSession::sharedSession().setCategory(AudioSession::None); >- }; >- >- m_updateStateTimer = std::make_unique<DeferrableOneShotTimer>(WTFMove(updateSessionState), updateSessionStateDelay); >- } >- >- m_updateStateTimer->restart(); >+ bool hasWebAudioType = false; >+ bool hasAudibleAudioOrVideoMediaType = false; >+ bool hasAudioCapture = anyOfSessions([&hasWebAudioType, &hasAudibleAudioOrVideoMediaType] (PlatformMediaSession& session, size_t) mutable { >+ auto type = session.mediaType(); >+ if (type == PlatformMediaSession::WebAudio) >+ hasWebAudioType = true; >+ if ((type == PlatformMediaSession::VideoAudio || type == PlatformMediaSession::Audio) && session.canProduceAudio() && session.state() == PlatformMediaSession::Playing) >+ hasAudibleAudioOrVideoMediaType = true; >+ return (type == PlatformMediaSession::MediaStreamCapturingAudio); >+ }); >+ >+ if (hasAudioCapture) >+ AudioSession::sharedSession().setCategory(AudioSession::PlayAndRecord); >+ else if (hasAudibleAudioOrVideoMediaType) >+ AudioSession::sharedSession().setCategory(AudioSession::MediaPlayback); >+ else if (hasWebAudioType) >+ AudioSession::sharedSession().setCategory(AudioSession::AmbientSound); >+ else >+ AudioSession::sharedSession().setCategory(AudioSession::None); > } > > #endif // USE(AUDIO_SESSION)
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 188225
: 346280