WebKit Bugzilla
Attachment 342214 Details for
Bug 186415
: REGRESSION: Cannot listen to audio on Google Translate with side switch set to "vibrate"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186415-20180607155708.patch (text/plain), 7.22 KB, created by
Jer Noble
on 2018-06-07 15:57:14 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2018-06-07 15:57:14 PDT
Size:
7.22 KB
patch
obsolete
>Subversion Revision: 232546 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index e78e5833913ee31f92233a14b8fb956da9cdf328..fac24a60129653a1d0c7f5dc6586c6b54f04d226 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2018-06-07 Jer Noble <jer.noble@apple.com> >+ >+ REGRESSION: Cannot listen to audio on Google Translate with side switch set to "vibrate" >+ https://bugs.webkit.org/show_bug.cgi?id=186415 >+ <rdar://problem/40584651> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Test: platform/mac/media/audio-session-category-audio-autoplay.html >+ >+ Make sure that the PlatformMediaSession's state has already been set when calling sessionWillBeginPlayback(), >+ so that it's state is accounted for in updateStates(); >+ >+ Drive-by fix: bring the implementation of the Internals.audioSessionCategory() method up to current best practices. >+ >+ * platform/audio/PlatformMediaSession.cpp: >+ (WebCore::PlatformMediaSession::clientWillBeginPlayback): >+ * testing/Internals.cpp: >+ (WebCore::Internals::audioSessionCategory const): >+ * testing/Internals.h: >+ * testing/Internals.idl: >+ > 2018-06-06 Timothy Hatcher <timothy@apple.com> > > Wrong NSVisualEffectMaterial used for exit full screen overlay in dark mode. >diff --git a/Source/WebCore/platform/audio/PlatformMediaSession.cpp b/Source/WebCore/platform/audio/PlatformMediaSession.cpp >index d56e7bdab167b2e19210971c21422a67f7a4ac07..45bf7afb34699a2f411153da451a2559a32318cd 100644 >--- a/Source/WebCore/platform/audio/PlatformMediaSession.cpp >+++ b/Source/WebCore/platform/audio/PlatformMediaSession.cpp >@@ -182,13 +182,16 @@ bool PlatformMediaSession::clientWillBeginPlayback() > if (m_notifyingClient) > return true; > >+ auto oldState = state(); >+ setState(Playing); >+ > if (!PlatformMediaSessionManager::sharedManager().sessionWillBeginPlayback(*this)) { >+ setState(oldState); > if (state() == Interrupted) > m_stateToRestore = Playing; > return false; > } > >- setState(Playing); > return true; > } > >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index 58261eda23db6bd60e15be376cd1b0a295a454bf..1d650bb41a0d913cb4c4895295afa5cd5e0284ea 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -4376,27 +4376,13 @@ void Internals::setMediaStreamTrackIdentifier(MediaStreamTrack& track, String&& > } > #endif > >-String Internals::audioSessionCategory() const >+Internals::AudioSessionCategory Internals::audioSessionCategory() const > { > #if USE(AUDIO_SESSION) >- switch (AudioSession::sharedSession().category()) { >- case AudioSession::AmbientSound: >- return ASCIILiteral("AmbientSound"); >- case AudioSession::SoloAmbientSound: >- return ASCIILiteral("SoloAmbientSound"); >- case AudioSession::MediaPlayback: >- return ASCIILiteral("MediaPlayback"); >- case AudioSession::RecordAudio: >- return ASCIILiteral("RecordAudio"); >- case AudioSession::PlayAndRecord: >- return ASCIILiteral("PlayAndRecord"); >- case AudioSession::AudioProcessing: >- return ASCIILiteral("AudioProcessing"); >- case AudioSession::None: >- return ASCIILiteral("None"); >- } >+ return AudioSession::sharedSession().category(); >+#else >+ return AudioSessionCategory::None; > #endif >- return emptyString(); > } > > void Internals::clearCacheStorageMemoryRepresentation(DOMPromiseDeferred<void>&& promise) >diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h >index 93a7463464e0e99dceb801ce55ffd10d7e8a7a6e..e7406cad25b0a83af42c0ae12f741d4845899bbb 100644 >--- a/Source/WebCore/testing/Internals.h >+++ b/Source/WebCore/testing/Internals.h >@@ -26,6 +26,7 @@ > > #pragma once > >+#include "AudioSession.h" > #include "CSSComputedStyleDeclaration.h" > #include "ContextDestructionObserver.h" > #include "ExceptionOr.h" >@@ -645,7 +646,12 @@ public: > void setMediaStreamTrackIdentifier(MediaStreamTrack&, String&& id); > #endif > >- String audioSessionCategory() const; >+#if USE(AUDIO_SESSION) >+ using AudioSessionCategory = AudioSession::CategoryType; >+#else >+ enum class AudioSessionCategory { None }; >+#endif >+ AudioSessionCategory audioSessionCategory() const; > > void clearCacheStorageMemoryRepresentation(DOMPromiseDeferred<void>&&); > void cacheStorageEngineRepresentation(DOMPromiseDeferred<IDLDOMString>&&); >diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl >index 4073a04820df567b9f63dcfd2cfe24ece958ceac..e27ac466aa115f82caa23445ba8611d239358785 100644 >--- a/Source/WebCore/testing/Internals.idl >+++ b/Source/WebCore/testing/Internals.idl >@@ -82,6 +82,16 @@ enum EventThrottlingBehavior { > "unresponsive" > }; > >+enum AudioSessionCategory { >+ "None", >+ "AmbientSound", >+ "SoloAmbientSound", >+ "MediaPlayback", >+ "RecordAudio", >+ "PlayAndRecord", >+ "AudioProcessing" >+}; >+ > [Conditional=VIDEO] enum PlaybackControlsPurpose { > "ControlsManager", > "NowPlaying" >@@ -600,7 +610,7 @@ enum EventThrottlingBehavior { > > void setConsoleMessageListener(StringCallback callback); > >- DOMString audioSessionCategory(); >+ AudioSessionCategory audioSessionCategory(); > > [Conditional=SERVICE_WORKER] Promise<boolean> hasServiceWorkerRegistration(DOMString scopeURL); > [Conditional=SERVICE_WORKER] void terminateServiceWorker(ServiceWorker worker); >diff --git a/LayoutTests/platform/mac/media/audio-session-category-audio-autoplay-expected.txt b/LayoutTests/platform/mac/media/audio-session-category-audio-autoplay-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..a11c27cae3a7a2ffd74225f22ea2000992b74d64 >--- /dev/null >+++ b/LayoutTests/platform/mac/media/audio-session-category-audio-autoplay-expected.txt >@@ -0,0 +1,8 @@ >+ >+RUN(internals.settings.setShouldManageAudioSessionCategory(true)) >+RUN(audio.autoplay = true) >+RUN(audio.src = findMediaFile("audio", "../../../media/content/test")) >+EVENT(playing) >+EXPECTED (internals.audioSessionCategory() == 'MediaPlayback') OK >+END OF TEST >+ >diff --git a/LayoutTests/platform/mac/media/audio-session-category-audio-autoplay.html b/LayoutTests/platform/mac/media/audio-session-category-audio-autoplay.html >new file mode 100644 >index 0000000000000000000000000000000000000000..5d8f4bfc7130664766e29707cf6d07f11bbbb7cf >--- /dev/null >+++ b/LayoutTests/platform/mac/media/audio-session-category-audio-autoplay.html >@@ -0,0 +1,25 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <title>audio-session-category-track-change</title> >+ <script src="../../../media/video-test.js"></script> >+ <script src="../../../media/media-file.js"></script> >+ <script> >+ function go() { >+ audio = video = mediaElement = document.querySelector('audio'); >+ run('internals.settings.setShouldManageAudioSessionCategory(true)'); >+ run('audio.autoplay = true'); >+ run('audio.src = findMediaFile("audio", "../../../media/content/test")'); >+ waitForEvent('playing', playing); >+ } >+ >+ function playing() { >+ testExpected('internals.audioSessionCategory()', 'MediaPlayback'); >+ endTest(); >+ } >+ </script> >+</head> >+<body onload="go()"> >+ <audio controls></video> >+</body> >+</html>
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 186415
:
342214
|
342218
|
342223
|
342321