WebKit Bugzilla
Attachment 339268 Details for
Bug 185182
: Pipe volume through PlaybackSessionManager/Proxy.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185182-20180501210652.patch (text/plain), 16.27 KB, created by
Jer Noble
on 2018-05-01 21:06:53 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2018-05-01 21:06:53 PDT
Size:
16.27 KB
patch
obsolete
>Subversion Revision: 231157 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 94ad2070a4ea348dc42026f18b777d87595753d6..6f20d8cdafdd20a8d32619e20b7a804a223a27e8 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,33 @@ >+2018-05-01 Jer Noble <jer.noble@apple.com> >+ >+ Pipe volume through PlaybackSessionManager/Proxy. >+ https://bugs.webkit.org/show_bug.cgi?id=185182 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add support for the volume property to PlaybackSessionModel, and all its clients. >+ >+ * platform/cocoa/PlaybackSessionModel.h: >+ (WebCore::PlaybackSessionModelClient::volumeChanged): >+ * platform/cocoa/PlaybackSessionModelMediaElement.h: >+ * platform/cocoa/PlaybackSessionModelMediaElement.mm: >+ (WebCore::PlaybackSessionModelMediaElement::updateForEventName): >+ (WebCore::PlaybackSessionModelMediaElement::setVolume): >+ (WebCore::PlaybackSessionModelMediaElement::volume const): >+ * platform/ios/PlaybackSessionInterfaceAVKit.h: >+ * platform/ios/PlaybackSessionInterfaceAVKit.mm: >+ (WebCore::PlaybackSessionInterfaceAVKit::volumeChanged): >+ * platform/ios/WebAVPlayerController.h: >+ * platform/ios/WebAVPlayerController.mm: >+ (-[WebAVPlayerController volume]): >+ (-[WebAVPlayerController setVolume:]): >+ (-[WebAVPlayerController volumeChanged:]): >+ (-[WebAVPlayerController resetMediaState]): >+ * platform/ios/WebVideoFullscreenControllerAVKit.mm: >+ (VideoFullscreenControllerContext::volumeChanged): >+ (VideoFullscreenControllerContext::volume const): >+ (VideoFullscreenControllerContext::setVolume): >+ > 2018-04-30 Michael Catanzaro <mcatanzaro@igalia.com> > > [GTK] Webkit should spoof as Safari on a Mac when on Chase.com >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 264f5ad2ac9aad9f5b6bfd9e5229be6d5890780f..5e885ff045367e66ce5c52d8e2b1074cb6b1e891 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,17 @@ >+2018-05-01 Jer Noble <jer.noble@apple.com> >+ >+ Pipe volume through PlaybackSessionManager/Proxy. >+ https://bugs.webkit.org/show_bug.cgi?id=185182 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebProcess/cocoa/PlaybackSessionManager.h: >+ * WebProcess/cocoa/PlaybackSessionManager.messages.in: >+ * WebProcess/cocoa/PlaybackSessionManager.mm: >+ (WebKit::PlaybackSessionInterfaceContext::volumeChanged): >+ (WebKit::PlaybackSessionManager::volumeChanged): >+ (WebKit::PlaybackSessionManager::setVolume): >+ > 2018-05-01 Jer Noble <jer.noble@apple.com> > > Get the WebKit.framework bundle by asking for WKWebView >diff --git a/Source/WebCore/platform/cocoa/PlaybackSessionModel.h b/Source/WebCore/platform/cocoa/PlaybackSessionModel.h >index 747809d265b0e3677d9a52f887562f1336a57c38..1c4f0e3aee94113f70814ae850c84d44e77e2e99 100644 >--- a/Source/WebCore/platform/cocoa/PlaybackSessionModel.h >+++ b/Source/WebCore/platform/cocoa/PlaybackSessionModel.h >@@ -58,6 +58,7 @@ public: > virtual void togglePictureInPicture() = 0; > virtual void toggleMuted() = 0; > virtual void setMuted(bool) = 0; >+ virtual void setVolume(double) = 0; > > enum ExternalPlaybackTargetType { TargetTypeNone, TargetTypeAirPlay, TargetTypeTVOut }; > >@@ -81,6 +82,7 @@ public: > virtual String externalPlaybackLocalizedDeviceName() const = 0; > virtual bool wirelessVideoPlaybackDisabled() const = 0; > virtual bool isMuted() const = 0; >+ virtual double volume() const = 0; > virtual bool isPictureInPictureActive() const = 0; > }; > >@@ -101,6 +103,7 @@ public: > virtual void externalPlaybackChanged(bool /* enabled */, PlaybackSessionModel::ExternalPlaybackTargetType, const String& /* localizedDeviceName */) { } > virtual void wirelessVideoPlaybackDisabledChanged(bool) { } > virtual void mutedChanged(bool) { } >+ virtual void volumeChanged(double) { } > virtual void pictureInPictureActiveChanged(bool) { } > virtual void ensureControlsManager() { } > }; >diff --git a/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.h b/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.h >index 7a0748eec641c890d7eead1686519a6d41ffd356..f5927dce035a7de7c0c6c9046e6d5b0204cac8d3 100644 >--- a/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.h >+++ b/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.h >@@ -72,6 +72,7 @@ public: > WEBCORE_EXPORT void togglePictureInPicture() final; > WEBCORE_EXPORT void toggleMuted() final; > WEBCORE_EXPORT void setMuted(bool) final; >+ WEBCORE_EXPORT void setVolume(double) final; > > double duration() const final; > double currentTime() const final; >@@ -92,6 +93,7 @@ public: > String externalPlaybackLocalizedDeviceName() const final; > bool wirelessVideoPlaybackDisabled() const final; > bool isMuted() const final; >+ double volume() const final; > bool isPictureInPictureActive() const final; > > protected: >diff --git a/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm b/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm >index b8610efa1e59fc3febdd2718a16639bc38124b15..79a030cabcc3760507df6e42c8e4386e38428507 100644 >--- a/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm >+++ b/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm >@@ -181,8 +181,10 @@ void PlaybackSessionModelMediaElement::updateForEventName(const WTF::AtomicStrin > > if (all > || eventName == eventNames().volumechangeEvent) { >- for (auto client : m_clients) >+ for (auto client : m_clients) { > client->mutedChanged(isMuted()); >+ client->volumeChanged(volume()); >+ } > } > } > void PlaybackSessionModelMediaElement::addClient(PlaybackSessionModelClient& client) >@@ -299,6 +301,12 @@ void PlaybackSessionModelMediaElement::setMuted(bool muted) > m_mediaElement->setMuted(muted); > } > >+void PlaybackSessionModelMediaElement::setVolume(double volume) >+{ >+ if (m_mediaElement) >+ m_mediaElement->setVolume(volume); >+} >+ > void PlaybackSessionModelMediaElement::updateMediaSelectionOptions() > { > if (!m_mediaElement) >@@ -538,6 +546,11 @@ bool PlaybackSessionModelMediaElement::isMuted() const > return m_mediaElement ? m_mediaElement->muted() : false; > } > >+double PlaybackSessionModelMediaElement::volume() const >+{ >+ return m_mediaElement ? m_mediaElement->volume() : 0; >+} >+ > bool PlaybackSessionModelMediaElement::isPictureInPictureActive() const > { > if (!m_mediaElement) >diff --git a/Source/WebCore/platform/ios/PlaybackSessionInterfaceAVKit.h b/Source/WebCore/platform/ios/PlaybackSessionInterfaceAVKit.h >index ece7715192a7230a7c3521537bbcbd237d2ca352..85801915e0f019680df47c816c0bddb5b60bc393 100644 >--- a/Source/WebCore/platform/ios/PlaybackSessionInterfaceAVKit.h >+++ b/Source/WebCore/platform/ios/PlaybackSessionInterfaceAVKit.h >@@ -79,6 +79,7 @@ public: > WEBCORE_EXPORT void externalPlaybackChanged(bool enabled, PlaybackSessionModel::ExternalPlaybackTargetType, const String& localizedDeviceName) override; > WEBCORE_EXPORT void wirelessVideoPlaybackDisabledChanged(bool) override; > WEBCORE_EXPORT void mutedChanged(bool) override; >+ WEBCORE_EXPORT void volumeChanged(double) override; > > WEBCORE_EXPORT virtual void invalidate(); > >diff --git a/Source/WebCore/platform/ios/PlaybackSessionInterfaceAVKit.mm b/Source/WebCore/platform/ios/PlaybackSessionInterfaceAVKit.mm >index 3f1dcda082f63da0b1d57c6b1a83a7cf9cfbcd05..a8fd3b04d02967eeca52cda0ec19057ba5325b52 100644 >--- a/Source/WebCore/platform/ios/PlaybackSessionInterfaceAVKit.mm >+++ b/Source/WebCore/platform/ios/PlaybackSessionInterfaceAVKit.mm >@@ -201,6 +201,11 @@ void PlaybackSessionInterfaceAVKit::mutedChanged(bool muted) > [m_playerController setMuted:muted]; > } > >+void PlaybackSessionInterfaceAVKit::volumeChanged(double volume) >+{ >+ [m_playerController volumeChanged:volume]; >+} >+ > void PlaybackSessionInterfaceAVKit::invalidate() > { > if (!m_playbackSessionModel) >diff --git a/Source/WebCore/platform/ios/WebAVPlayerController.h b/Source/WebCore/platform/ios/WebAVPlayerController.h >index 1e03205ad032fdcf8ef696d20b82cfea17cac546..38d7daec119f2f491df64a9d0db901d01a04986e 100644 >--- a/Source/WebCore/platform/ios/WebAVPlayerController.h >+++ b/Source/WebCore/platform/ios/WebAVPlayerController.h >@@ -71,6 +71,8 @@ class PlaybackSessionInterfaceAVKit; > @property (retain) AVValueTiming *timing; > @property (retain) NSArray *seekableTimeRanges; > @property (getter=isMuted) BOOL muted; >+@property double volume; >+- (void)volumeChanged:(double)volume; > > @property (readonly) BOOL hasMediaSelectionOptions; > @property (readonly) BOOL hasAudioMediaSelectionOptions; >diff --git a/Source/WebCore/platform/ios/WebAVPlayerController.mm b/Source/WebCore/platform/ios/WebAVPlayerController.mm >index fc9baad7ddfd3dcc256878e2304b341a540977ad..0d0173e85965d8e5e4b243596b0fda4a112814c9 100644 >--- a/Source/WebCore/platform/ios/WebAVPlayerController.mm >+++ b/Source/WebCore/platform/ios/WebAVPlayerController.mm >@@ -511,6 +511,24 @@ - (void)toggleMuted:(id)sender > self.delegate->toggleMuted(); > } > >+- (double)volume >+{ >+ return self.delegate ? self.delegate->volume() : 0; >+} >+ >+- (void)setVolume:(double)volume >+{ >+ if (self.delegate) >+ self.delegate->setVolume(volume); >+} >+ >+- (void)volumeChanged:(double)volume >+{ >+ UNUSED_PARAM(volume); >+ [self willChangeValueForKey:@"volume"]; >+ [self didChangeValueForKey:@"volume"]; >+} >+ > - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context > { > using namespace PAL; >@@ -616,6 +634,7 @@ - (void)resetMediaState > self.maxTiming = nil; > self.timing = nil; > self.rate = 0; >+ self.volume = 0; > > self.seekableTimeRanges = [NSMutableArray array]; > >diff --git a/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm b/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm >index 255914f44c5d68134312ed89ae478eccfeec1a29..ea30f89458e0cd70746c8600db4c1501f9c5bce9 100644 >--- a/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm >+++ b/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm >@@ -173,6 +173,7 @@ private: > void togglePictureInPicture() override { } > void toggleMuted() override; > void setMuted(bool) final; >+ void setVolume(double) final; > > // PlaybackSessionModelClient > void durationChanged(double) override; >@@ -186,6 +187,7 @@ private: > void externalPlaybackChanged(bool enabled, PlaybackSessionModel::ExternalPlaybackTargetType, const String& localizedDeviceName) override; > void wirelessVideoPlaybackDisabledChanged(bool) override; > void mutedChanged(bool) override; >+ void volumeChanged(double) override; > > // VideoFullscreenModel > void addClient(VideoFullscreenModelClient&) override; >@@ -198,6 +200,7 @@ private: > bool hasVideo() const override; > FloatSize videoDimensions() const override; > bool isMuted() const override; >+ double volume() const override; > bool isPictureInPictureActive() const override; > > HashSet<PlaybackSessionModelClient*> m_playbackClients; >@@ -520,6 +523,18 @@ void VideoFullscreenControllerContext::mutedChanged(bool muted) > client->mutedChanged(muted); > } > >+void VideoFullscreenControllerContext::volumeChanged(double volume) >+{ >+ if (WebThreadIsCurrent()) { >+ dispatch_async(dispatch_get_main_queue(), [protectedThis = makeRefPtr(this), volume] { >+ protectedThis->volumeChanged(volume); >+ }); >+ return; >+ } >+ >+ for (auto& client : m_playbackClients) >+ client->volumeChanged(volume); >+} > #pragma mark VideoFullscreenModel > > void VideoFullscreenControllerContext::addClient(VideoFullscreenModelClient& client) >@@ -600,6 +615,12 @@ bool VideoFullscreenControllerContext::isMuted() const > return m_playbackModel ? m_playbackModel->isMuted() : false; > } > >+double VideoFullscreenControllerContext::volume() const >+{ >+ ASSERT(isUIThread()); >+ return m_playbackModel ? m_playbackModel->volume() : false; >+} >+ > bool VideoFullscreenControllerContext::isPictureInPictureActive() const > { > ASSERT(isUIThread()); >@@ -671,6 +692,15 @@ void VideoFullscreenControllerContext::setMuted(bool muted) > }); > } > >+void VideoFullscreenControllerContext::setVolume(double volume) >+{ >+ ASSERT(isUIThread()); >+ WebThreadRun([protectedThis = makeRefPtr(this), this, volume] { >+ if (m_playbackModel) >+ m_playbackModel->setVolume(volume); >+ }); >+} >+ > void VideoFullscreenControllerContext::beginScrubbing() > { > ASSERT(isUIThread()); >diff --git a/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h b/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h >index a844f0e1aaed8ce192fe96044aa072d9d5c87318..7f406854cac6f2a65dac29081744581111f25336 100644 >--- a/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h >+++ b/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h >@@ -88,6 +88,7 @@ private: > void externalPlaybackChanged(bool enabled, WebCore::PlaybackSessionModel::ExternalPlaybackTargetType, const String& localizedDeviceName) final; > void wirelessVideoPlaybackDisabledChanged(bool) final; > void mutedChanged(bool) final; >+ void volumeChanged(double) final; > > PlaybackSessionInterfaceContext(PlaybackSessionManager&, uint64_t contextId); > >@@ -139,6 +140,7 @@ protected: > void externalPlaybackChanged(uint64_t contextId, bool enabled, WebCore::PlaybackSessionModel::ExternalPlaybackTargetType, String localizedDeviceName); > void wirelessVideoPlaybackDisabledChanged(uint64_t contextId, bool); > void mutedChanged(uint64_t contextId, bool); >+ void volumeChanged(uint64_t contextId, double); > > // Messages from PlaybackSessionManagerProxy > void play(uint64_t contextId); >@@ -157,6 +159,7 @@ protected: > void togglePictureInPicture(uint64_t contextId); > void toggleMuted(uint64_t contextId); > void setMuted(uint64_t contextId, bool muted); >+ void setVolume(uint64_t contextId, double volume); > > WebPage* m_page; > HashMap<WebCore::HTMLMediaElement*, uint64_t> m_mediaElements; >diff --git a/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.messages.in b/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.messages.in >index b6e166f69c990ab7ae82c3d81c616b017936dba9..4d2a786e1390564823a18993f5fcf57291cf65d6 100644 >--- a/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.messages.in >+++ b/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.messages.in >@@ -39,5 +39,6 @@ messages -> PlaybackSessionManager { > TogglePictureInPicture(uint64_t contextId) > ToggleMuted(uint64_t contextId) > SetMuted(uint64_t contextId, bool muted) >+ SetVolume(uint64_t contextId, double volume) > } > #endif >diff --git a/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm b/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm >index acf52f600de6c3155816363c7d7040f8e6621d32..c5df31e0fce940b5743b1fdf8f7f3131ad83fd3a 100644 >--- a/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm >+++ b/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm >@@ -155,6 +155,12 @@ void PlaybackSessionInterfaceContext::mutedChanged(bool muted) > m_manager->mutedChanged(m_contextId, muted); > } > >+void PlaybackSessionInterfaceContext::volumeChanged(double volume) >+{ >+ if (m_manager) >+ m_manager->volumeChanged(m_contextId, volume); >+} >+ > #pragma mark - PlaybackSessionManager > > Ref<PlaybackSessionManager> PlaybackSessionManager::create(WebPage& page) >@@ -378,6 +384,11 @@ void PlaybackSessionManager::mutedChanged(uint64_t contextId, bool muted) > m_page->send(Messages::PlaybackSessionManagerProxy::MutedChanged(contextId, muted)); > } > >+void PlaybackSessionManager::volumeChanged(uint64_t contextId, double volume) >+{ >+ m_page->send(Messages::PlaybackSessionManagerProxy::VolumeChanged(contextId, volume)); >+} >+ > #pragma mark Messages from PlaybackSessionManagerProxy: > > void PlaybackSessionManager::play(uint64_t contextId) >@@ -477,6 +488,12 @@ void PlaybackSessionManager::setMuted(uint64_t contextId, bool muted) > ensureModel(contextId).setMuted(muted); > } > >+void PlaybackSessionManager::setVolume(uint64_t contextId, double volume) >+{ >+ UserGestureIndicator indicator(ProcessingUserGesture); >+ ensureModel(contextId).setVolume(volume); >+} >+ > } // namespace WebKit > > #endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
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 185182
:
339268
|
339269