Changeset 207764 in webkit
- Timestamp:
- Oct 24, 2016, 10:53:12 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/LayoutTests/ChangeLog ¶
r207762 r207764 1 2016-10-24 Eric Carlson <eric.carlson@apple.com> 2 3 [MediaStream] Separate media capture and audio playback muting 4 https://bugs.webkit.org/show_bug.cgi?id=163855 5 <rdar://problem/28827186> 6 7 Reviewed by Darin Adler. 8 9 * fast/mediastream/MediaStream-page-muted-expected.txt: Added. 10 * fast/mediastream/MediaStream-page-muted.html: Added. 11 * media/video-muted-after-setting-page-muted-state.html: Updated. 12 1 13 2016-10-24 Youenn Fablet <youenn@apple.com> 2 14 -
TabularUnified trunk/LayoutTests/media/video-muted-after-setting-page-muted-state.html ¶
r175384 r207764 6 6 testExpected("video.muted", false); 7 7 if (window.internals) 8 internals.setPageMuted( true);8 internals.setPageMuted("audio"); 9 9 testExpected("video.muted", false); 10 10 … … 12 12 testExpected("video.muted", true); 13 13 if (window.internals) 14 internals.setPageMuted( false);14 internals.setPageMuted(""); 15 15 testExpected("video.muted", true); 16 16 endTest(); -
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r207763 r207764 1 2016-10-24 Eric Carlson <eric.carlson@apple.com> 2 3 [MediaStream] Separate media capture and audio playback muting 4 https://bugs.webkit.org/show_bug.cgi?id=163855 5 <rdar://problem/28827186> 6 7 Reviewed by Darin Adler. 8 9 Test: fast/mediastream/MediaStream-page-muted.html 10 11 Change page.muted from a bool to a bitfield so audio and media capture muted are independent. 12 Fix a couple of bugs in the mock media capture device uncovered by new test case. 13 14 * Modules/mediastream/MediaStream.cpp: 15 (WebCore::MediaStream::pageMutedStateDidChange): page.isMuted -> page.mutedState. 16 17 * Modules/webaudio/AudioContext.cpp: 18 (WebCore::AudioContext::pageMutedStateDidChange): Ditto. 19 20 * html/HTMLMediaElement.cpp: 21 (WebCore::HTMLMediaElement::updateVolume): Ditto. 22 (WebCore::HTMLMediaElement::effectiveMuted): Ditto. 23 24 * page/MediaProducer.h: Add MutedState enum. 25 26 * page/Page.cpp: 27 (WebCore::Page::Page): 28 (WebCore::Page::setMuted): Take MutedStateFlags instead of bool. m_muted -> m_mutedState. 29 * page/Page.h: 30 31 * platform/mock/MockRealtimeMediaSource.cpp: 32 (WebCore::MockRealtimeMediaSource::startProducingData): Call setMuted. 33 (WebCore::MockRealtimeMediaSource::stopProducingData): Ditto. 34 * platform/mock/MockRealtimeMediaSource.h: 35 36 * platform/mock/MockRealtimeVideoSource.cpp: 37 (WebCore::MockRealtimeVideoSource::stopProducingData): Call correct base class method. 38 39 * testing/Internals.cpp: 40 (WebCore::Internals::setPageMuted): Change parameter from a bool to a string. 41 * testing/Internals.h: 42 43 * testing/Internals.idl: 44 1 45 2016-10-24 Darin Adler <darin@apple.com> 2 46 -
TabularUnified trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp ¶
r204466 r207764 257 257 return; 258 258 259 bool pageMuted = document->page()->isM uted();259 bool pageMuted = document->page()->isMediaCaptureMuted(); 260 260 if (m_externallyMuted == pageMuted) 261 261 return; -
TabularUnified trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp ¶
r207050 r207764 974 974 { 975 975 if (m_destinationNode && document()->page()) 976 m_destinationNode->setMuted(document()->page()->is Muted());976 m_destinationNode->setMuted(document()->page()->isAudioMuted()); 977 977 } 978 978 -
TabularUnified trunk/Source/WebCore/html/HTMLMediaElement.cpp ¶
r207706 r207764 4847 4847 if (m_mediaController) { 4848 4848 volumeMultiplier *= m_mediaController->volume(); 4849 shouldMute = m_mediaController->muted() || (page && page->is Muted());4849 shouldMute = m_mediaController->muted() || (page && page->isAudioMuted()); 4850 4850 } 4851 4851 … … 7008 7008 bool HTMLMediaElement::effectiveMuted() const 7009 7009 { 7010 return muted() || (document().page() && document().page()->is Muted());7010 return muted() || (document().page() && document().page()->isAudioMuted()); 7011 7011 } 7012 7012 -
TabularUnified trunk/Source/WebCore/page/MediaProducer.h ¶
r197929 r207764 49 49 50 50 virtual MediaStateFlags mediaState() const = 0; 51 52 enum MutedState { 53 NoneMuted = 0, 54 AudioIsMuted = 1 << 0, 55 CaptureDevicesAreMuted = 1 << 1, 56 }; 57 typedef unsigned MutedStateFlags; 58 51 59 virtual void pageMutedStateDidChange() = 0; 52 60 -
TabularUnified trunk/Source/WebCore/page/Page.cpp ¶
r207706 r207764 194 194 , m_areMemoryCacheClientCallsEnabled(true) 195 195 , m_mediaVolume(1) 196 , m_muted(false)197 196 , m_pageScaleFactor(1) 198 197 , m_zoomedOutPageScaleFactor(0) … … 1382 1381 } 1383 1382 1384 void Page::setMuted( boolmuted)1385 { 1386 if (m_muted == muted)1387 return; 1388 1389 m_muted = muted;1383 void Page::setMuted(MediaProducer::MutedStateFlags muted) 1384 { 1385 if (m_mutedState == muted) 1386 return; 1387 1388 m_mutedState = muted; 1390 1389 1391 1390 for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) { -
TabularUnified trunk/Source/WebCore/page/Page.h ¶
r207706 r207764 481 481 MediaProducer::MediaStateFlags mediaState() const { return m_mediaState; } 482 482 void updateIsPlayingMedia(uint64_t); 483 bool isMuted() const { return m_muted; } 484 WEBCORE_EXPORT void setMuted(bool); 483 MediaProducer::MutedStateFlags mutedState() const { return m_mutedState; } 484 bool isAudioMuted() const { return m_mutedState & MediaProducer::AudioIsMuted; } 485 bool isMediaCaptureMuted() const { return m_mutedState & MediaProducer::CaptureDevicesAreMuted; }; 486 WEBCORE_EXPORT void setMuted(MediaProducer::MutedStateFlags); 485 487 486 488 #if ENABLE(MEDIA_SESSION) … … 610 612 bool m_areMemoryCacheClientCallsEnabled; 611 613 float m_mediaVolume; 612 bool m_muted;614 MediaProducer::MutedStateFlags m_mutedState { MediaProducer::NoneMuted }; 613 615 614 616 float m_pageScaleFactor; -
TabularUnified trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp ¶
r206445 r207764 85 85 void RealtimeMediaSource::setMuted(bool muted) 86 86 { 87 if (m_ muted == muted)87 if (m_stopped || m_muted == muted) 88 88 return; 89 89 … … 151 151 } 152 152 153 #if 1154 153 double RealtimeMediaSource::fitnessDistance(const MediaConstraint& constraint) 155 154 { … … 276 275 return 0; 277 276 } 278 #endif279 277 280 278 template <typename ValueType> -
TabularUnified trunk/Source/WebCore/platform/mock/MockRealtimeMediaSource.cpp ¶
r205961 r207764 125 125 } 126 126 127 void MockRealtimeMediaSource::startProducingData() 128 { 129 m_isProducingData = true; 130 setMuted(false); 131 } 132 133 void MockRealtimeMediaSource::stopProducingData() 134 { 135 m_isProducingData = false; 136 setMuted(true); 137 } 138 127 139 } // namespace WebCore 128 140 -
TabularUnified trunk/Source/WebCore/platform/mock/MockRealtimeMediaSource.h ¶
r205961 r207764 70 70 virtual void initializeSupportedConstraints(RealtimeMediaSourceSupportedConstraints&) = 0; 71 71 72 void startProducingData() override { m_isProducingData = true; }73 void stopProducingData() override { m_isProducingData = false; }72 void startProducingData() override; 73 void stopProducingData() override; 74 74 75 75 RefPtr<RealtimeMediaSourceCapabilities> capabilities() override; -
TabularUnified trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp ¶
r207442 r207764 86 86 void MockRealtimeVideoSource::stopProducingData() 87 87 { 88 MockRealtimeMediaSource::st artProducingData();88 MockRealtimeMediaSource::stopProducingData(); 89 89 m_timer.stop(); 90 90 m_elapsedTime += monotonicallyIncreasingTime() - m_startTime; -
TabularUnified trunk/Source/WebCore/testing/Internals.cpp ¶
r207669 r207764 87 87 #include "MallocStatistics.h" 88 88 #include "MediaPlayer.h" 89 #include "MediaProducer.h" 89 90 #include "MemoryCache.h" 90 91 #include "MemoryInfo.h" … … 2946 2947 } 2947 2948 2948 void Internals::setPageMuted( bool muted)2949 void Internals::setPageMuted(const String& states) 2949 2950 { 2950 2951 Document* document = contextDocument(); … … 2952 2953 return; 2953 2954 2955 WebCore::MediaProducer::MutedStateFlags state = MediaProducer::NoneMuted; 2956 Vector<String> stateString; 2957 states.split(',', false, stateString); 2958 for (auto& muteString : stateString) { 2959 if (equalLettersIgnoringASCIICase(muteString, "audio")) 2960 state |= MediaProducer::AudioIsMuted; 2961 if (equalLettersIgnoringASCIICase(muteString, "capturedevices")) 2962 state |= MediaProducer::CaptureDevicesAreMuted; 2963 } 2964 2954 2965 if (Page* page = document->page()) 2955 page->setMuted( muted);2966 page->setMuted(state); 2956 2967 } 2957 2968 -
TabularUnified trunk/Source/WebCore/testing/Internals.h ¶
r207521 r207764 441 441 ExceptionOr<String> pageOverlayLayerTreeAsText() const; 442 442 443 void setPageMuted( bool);443 void setPageMuted(const String&); 444 444 bool isPagePlayingAudio(); 445 445 -
TabularUnified trunk/Source/WebCore/testing/Internals.idl ¶
r207521 r207764 418 418 [MayThrowException] DOMString pageOverlayLayerTreeAsText(); 419 419 420 void setPageMuted( boolean muted);420 void setPageMuted(DOMString mutedState); 421 421 boolean isPagePlayingAudio(); 422 422 -
TabularUnified trunk/Source/WebKit2/ChangeLog ¶
r207762 r207764 1 2016-10-24 Eric Carlson <eric.carlson@apple.com> 2 3 [MediaStream] Separate media capture and audio playback muting 4 https://bugs.webkit.org/show_bug.cgi?id=163855 5 <rdar://problem/28827186> 6 7 Reviewed by Darin Adler. 8 9 * Shared/WebPageCreationParameters.h: Change 'muted' from bool to MutedStateFlags. 10 11 * UIProcess/API/C/WKPage.cpp: Change parameter from bool to WKMediaMutedState. 12 (WKPageSetMuted): 13 * UIProcess/API/C/WKPagePrivate.h: Define WKMediaMutedState. 14 15 * UIProcess/WebPageProxy.cpp: 16 (WebKit::WebPageProxy::WebPageProxy): 17 (WebKit::WebPageProxy::setMuted): m_muted -> m_mutedState. 18 (WebKit::WebPageProxy::creationParameters): Ditto. 19 * UIProcess/WebPageProxy.h: 20 21 * WebProcess/Plugins/PluginView.cpp: 22 (WebKit::PluginView::isMuted): page.isMuted -> page.mutedState. 23 24 * WebProcess/WebPage/WebPage.messages.in: Change SetMuted parameter. 25 1 26 2016-10-24 Youenn Fablet <youenn@apple.com> 2 27 -
TabularUnified trunk/Source/WebKit2/Shared/WebPageCreationParameters.h ¶
r204668 r207764 36 36 #include <WebCore/FloatSize.h> 37 37 #include <WebCore/IntSize.h> 38 #include <WebCore/MediaProducer.h> 38 39 #include <WebCore/Pagination.h> 39 40 #include <WebCore/ScrollTypes.h> … … 100 101 101 102 float mediaVolume; 102 boolmuted;103 WebCore::MediaProducer::MutedStateFlags muted; 103 104 bool mayStartMediaWhenInWindow; 104 105 -
TabularUnified trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp ¶
r207558 r207764 2602 2602 } 2603 2603 2604 void WKPageSetMuted(WKPageRef page, boolmuted)2604 void WKPageSetMuted(WKPageRef page, WKMediaMutedState muted) 2605 2605 { 2606 2606 toImpl(page)->setMuted(muted); -
TabularUnified trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h ¶
r205822 r207764 121 121 122 122 WK_EXPORT bool WKPageIsPlayingAudio(WKPageRef page); 123 WK_EXPORT void WKPageSetMuted(WKPageRef page, bool muted); 123 124 enum { 125 kWKMediaNoneMuted = 0, 126 kWKMediaAudioMuted = 1 << 0, 127 kWKMediaCaptureDevicesMuted = 1 << 1, 128 }; 129 typedef uint32_t WKMediaMutedState; 130 WK_EXPORT void WKPageSetMuted(WKPageRef page, WKMediaMutedState muted); 124 131 125 132 enum { … … 130 137 }; 131 138 typedef uint32_t WKMediaState; 139 132 140 133 141 WK_EXPORT WKMediaState WKPageGetMediaState(WKPageRef page); -
TabularUnified trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp ¶
r207706 r207764 445 445 , m_autoSizingShouldExpandToViewHeight(false) 446 446 , m_mediaVolume(1) 447 , m_muted(false)448 447 , m_mayStartMediaWhenInWindow(true) 449 448 , m_waitingForDidUpdateViewState(false) … … 1589 1588 // We should suppress if the page is not active, is visually idle, and supression is enabled. 1590 1589 bool isLoading = m_pageLoadState.isLoading(); 1591 bool isPlayingAudio = m_mediaState & MediaProducer::IsPlayingAudio && ! m_muted;1590 bool isPlayingAudio = m_mediaState & MediaProducer::IsPlayingAudio && !(m_mutedState & MediaProducer::AudioIsMuted); 1592 1591 bool pageShouldBeSuppressed = !isLoading && !isPlayingAudio && processSuppressionEnabled && (m_viewState & ViewState::IsVisuallyIdle); 1593 1592 if (m_pageSuppressed != pageShouldBeSuppressed) { … … 4153 4152 } 4154 4153 4155 void WebPageProxy::setMuted( bool muted)4156 { 4157 if (m_muted == muted)4158 return; 4159 4160 m_muted = muted;4161 4162 if (!isValid()) 4163 return; 4164 4165 m_process->send(Messages::WebPage::SetMuted( muted), m_pageID);4154 void WebPageProxy::setMuted(WebCore::MediaProducer::MutedStateFlags state) 4155 { 4156 if (m_mutedState == state) 4157 return; 4158 4159 m_mutedState = state; 4160 4161 if (!isValid()) 4162 return; 4163 4164 m_process->send(Messages::WebPage::SetMuted(state), m_pageID); 4166 4165 4167 4166 updateThrottleState(); … … 5484 5483 parameters.topContentInset = m_topContentInset; 5485 5484 parameters.mediaVolume = m_mediaVolume; 5486 parameters.muted = m_muted ;5485 parameters.muted = m_mutedState; 5487 5486 parameters.mayStartMediaWhenInWindow = m_mayStartMediaWhenInWindow; 5488 5487 parameters.minimumLayoutSize = m_minimumLayoutSize; -
TabularUnified trunk/Source/WebKit2/UIProcess/WebPageProxy.h ¶
r207706 r207764 938 938 939 939 void setMediaVolume(float); 940 void setMuted( bool);940 void setMuted(WebCore::MediaProducer::MutedStateFlags); 941 941 void setMayStartMediaWhenInWindow(bool); 942 942 bool mayStartMediaWhenInWindow() const { return m_mayStartMediaWhenInWindow; } … … 1853 1853 1854 1854 float m_mediaVolume; 1855 bool m_muted;1855 WebCore::MediaProducer::MutedStateFlags m_mutedState { WebCore::MediaProducer::NoneMuted }; 1856 1856 bool m_mayStartMediaWhenInWindow; 1857 1857 -
TabularUnified trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp ¶
r207458 r207764 1532 1532 return false; 1533 1533 1534 return frame()->page()->is Muted();1534 return frame()->page()->isAudioMuted(); 1535 1535 } 1536 1536 #endif -
TabularUnified trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in ¶
r207704 r207764 315 315 # Media 316 316 SetMediaVolume(float volume) 317 SetMuted( boolmuted)317 SetMuted(WebCore::MediaProducer::MutedStateFlags muted) 318 318 SetMayStartMediaWhenInWindow(bool mayStartMedia) 319 319
Note:
See TracChangeset
for help on using the changeset viewer.