WebKit Bugzilla
Attachment 358809 Details for
Bug 193230
: Define page media state flags for display capture.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-193230-20190111080823.patch (text/plain), 24.14 KB, created by
Eric Carlson
on 2019-01-10 11:08:25 PST
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Eric Carlson
Created:
2019-01-10 11:08:25 PST
Size:
24.14 KB
patch
obsolete
>Subversion Revision: 239676 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 3b718d102b27c05fb479747b9368f58f924e93e2..57cddaedc5dbc2d822b0ce05e574d6ecd066fd51 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,27 @@ >+2019-01-07 Eric Carlson <eric.carlson@apple.com> >+ >+ Define page media state flags for display capture. >+ https://bugs.webkit.org/show_bug.cgi?id=193230 >+ <rdar://problem/47095142> >+ >+ Reviewed by Youenn Fablet. >+ >+ Test: fast/mediastream/get-display-media-muted.html >+ >+ * Modules/mediastream/MediaStreamTrack.cpp: >+ (WebCore::MediaStreamTrack::mediaState const): >+ * page/MediaProducer.h: >+ * platform/mediastream/RealtimeIncomingVideoSource.cpp: >+ (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource): >+ * platform/mediastream/RealtimeMediaSource.h: >+ * platform/mediastream/mac/AVVideoCaptureSource.h: >+ * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h: >+ * platform/mediastream/mac/WindowDisplayCaptureSourceMac.h: >+ * platform/mock/MockRealtimeAudioSource.h: >+ * platform/mock/MockRealtimeVideoSource.h: >+ * testing/Internals.cpp: >+ (WebCore::Internals::pageMediaState): >+ > 2019-01-07 Zalan Bujtas <zalan@apple.com> > > [LFC][BFC] Margin collapsing should not be limited to in-flow non-replaced boxes. >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 4c199aaaae5acbb24d144cde08b4b8dd13b49b07..5a4c329a044e750a8626371e6f11ac470cc7564a 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,18 @@ >+2019-01-07 Eric Carlson <eric.carlson@apple.com> >+ >+ Define page media state flags for display capture. >+ https://bugs.webkit.org/show_bug.cgi?id=193230 >+ <rdar://problem/47095142> >+ >+ Reviewed by Youenn Fablet. >+ >+ * UIProcess/API/C/WKPage.cpp: >+ (WKPageGetMediaState): >+ * UIProcess/API/C/WKPagePrivate.h: >+ * WebProcess/cocoa/UserMediaCaptureManager.cpp: >+ (WebKit::UserMediaCaptureManager::Source::Source): >+ (WebKit::UserMediaCaptureManager::createCaptureSource): >+ > 2019-01-07 Alex Christensen <achristensen@webkit.org> > > Modernize CacheModel and disk cache fetching and clearing >diff --git a/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp b/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp >index 6a7f146ca1c4d7e515a154851df9bd37a053d183..d83c5b74e1021daf10dca4460573fc18ca4d1ea4 100644 >--- a/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp >+++ b/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp >@@ -386,12 +386,14 @@ MediaProducer::MediaStateFlags MediaStreamTrack::mediaState() const > if (m_private->isProducingData()) > return HasActiveAudioCaptureDevice; > } else { >+ auto deviceType = source().deviceType(); >+ ASSERT(deviceType == CaptureDevice::DeviceType::Camera || deviceType == CaptureDevice::DeviceType::Screen || deviceType == CaptureDevice::DeviceType::Window); > if (source().interrupted() && !pageCaptureMuted) >- return HasInterruptedVideoCaptureDevice; >+ return deviceType == CaptureDevice::DeviceType::Camera ? HasInterruptedVideoCaptureDevice : HasInterruptedDisplayCaptureDevice; > if (muted()) >- return HasMutedVideoCaptureDevice; >+ return deviceType == CaptureDevice::DeviceType::Camera ? HasMutedVideoCaptureDevice : HasMutedDisplayCaptureDevice; > if (m_private->isProducingData()) >- return HasActiveVideoCaptureDevice; >+ return deviceType == CaptureDevice::DeviceType::Camera ? HasActiveVideoCaptureDevice : HasActiveDisplayCaptureDevice; > } > > return IsNotPlaying; >diff --git a/Source/WebCore/page/MediaProducer.h b/Source/WebCore/page/MediaProducer.h >index 999a2fd31d6ae793fd66ababe32abf82d1b81b72..d6488af742f20f57f16438ea869af72d99a60c80 100644 >--- a/Source/WebCore/page/MediaProducer.h >+++ b/Source/WebCore/page/MediaProducer.h >@@ -49,10 +49,14 @@ public: > HasInterruptedAudioCaptureDevice = 1 << 15, > HasInterruptedVideoCaptureDevice = 1 << 16, > HasUserInteractedWithMediaElement = 1 << 17, >+ HasActiveDisplayCaptureDevice = 1 << 18, >+ HasMutedDisplayCaptureDevice = 1 << 19, >+ HasInterruptedDisplayCaptureDevice = 1 << 20, > > AudioCaptureMask = HasActiveAudioCaptureDevice | HasMutedAudioCaptureDevice | HasInterruptedAudioCaptureDevice, > VideoCaptureMask = HasActiveVideoCaptureDevice | HasMutedVideoCaptureDevice | HasInterruptedVideoCaptureDevice, >- MediaCaptureMask = AudioCaptureMask | VideoCaptureMask, >+ DisplayCaptureMask = HasActiveDisplayCaptureDevice | HasMutedDisplayCaptureDevice | HasInterruptedDisplayCaptureDevice, >+ MediaCaptureMask = AudioCaptureMask | VideoCaptureMask | DisplayCaptureMask, > }; > typedef unsigned MediaStateFlags; > >diff --git a/Source/WebCore/platform/mediastream/CaptureDevice.h b/Source/WebCore/platform/mediastream/CaptureDevice.h >index 447a89f8182db8ea4271f4bac4c3e16978610508..18a9f06f23ac3ea1271032249c9dc4a30b969918 100644 >--- a/Source/WebCore/platform/mediastream/CaptureDevice.h >+++ b/Source/WebCore/platform/mediastream/CaptureDevice.h >@@ -31,7 +31,7 @@ namespace WebCore { > > class CaptureDevice { > public: >- enum class DeviceType { Unknown, Microphone, Camera, Screen, Application, Window, Browser }; >+ enum class DeviceType { Unknown, Microphone, Camera, Screen, Window }; > > CaptureDevice(const String& persistentId, DeviceType type, const String& label, const String& groupId = emptyString()) > : m_persistentId(persistentId) >@@ -121,9 +121,7 @@ template<> struct EnumTraits<WebCore::CaptureDevice::DeviceType> { > WebCore::CaptureDevice::DeviceType::Microphone, > WebCore::CaptureDevice::DeviceType::Camera, > WebCore::CaptureDevice::DeviceType::Screen, >- WebCore::CaptureDevice::DeviceType::Application, >- WebCore::CaptureDevice::DeviceType::Window, >- WebCore::CaptureDevice::DeviceType::Browser >+ WebCore::CaptureDevice::DeviceType::Window > >; > }; > >diff --git a/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp b/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp >index 907b9b6182ca2bdf78bd0dfcd7d92f9ac28860a2..9c75281c0e164642ddb81de20f94f0e5de627479 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp >+++ b/Source/WebCore/platform/mediastream/RealtimeIncomingVideoSource.cpp >@@ -38,7 +38,7 @@ > namespace WebCore { > > RealtimeIncomingVideoSource::RealtimeIncomingVideoSource(rtc::scoped_refptr<webrtc::VideoTrackInterface>&& videoTrack, String&& videoTrackId) >- : RealtimeMediaSource(RealtimeMediaSource::Type::Video, "remote video"_s, WTFMove(videoTrackId)) >+ : RealtimeMediaSource(Type::Video, "remote video"_s, WTFMove(videoTrackId)) > , m_videoTrack(WTFMove(videoTrack)) > { > notifyMutedChange(!m_videoTrack); >diff --git a/Source/WebCore/platform/mediastream/RealtimeMediaSource.h b/Source/WebCore/platform/mediastream/RealtimeMediaSource.h >index 166c8df53f755e5fc4580d869e87e959ad3b749b..8e462c7e8869ed268a90496eb7f5bde078e9b5f4 100644 >--- a/Source/WebCore/platform/mediastream/RealtimeMediaSource.h >+++ b/Source/WebCore/platform/mediastream/RealtimeMediaSource.h >@@ -161,6 +161,7 @@ public: > virtual bool isIsolated() const { return false; } > > virtual bool isCaptureSource() const { return false; } >+ virtual CaptureDevice::DeviceType deviceType() const { return CaptureDevice::DeviceType::Unknown; } > > virtual void monitorOrientation(OrientationNotifier&) { } > >diff --git a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h >index 603817263deeb03849c87186418649c034f1fb0d..88febeabbe22bbed35d9f401110ce452242151b4 100644 >--- a/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h >+++ b/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.h >@@ -86,6 +86,7 @@ private: > void beginConfiguration() final; > void commitConfiguration() final; > bool isCaptureSource() const final { return true; } >+ CaptureDevice::DeviceType deviceType() const final { return CaptureDevice::DeviceType::Camera; } > bool interrupted() const final; > > void setSizeAndFrameRateWithPreset(IntSize, double, RefPtr<VideoPreset>) final; >diff --git a/Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp b/Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp >index e55894360985e4503632a511f7b0ad5702851422..294c18ca773f5d831c25521324ffe9b8af9cddfa 100644 >--- a/Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp >+++ b/Source/WebCore/platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp >@@ -103,10 +103,6 @@ Optional<CaptureDevice> DisplayCaptureManagerCocoa::captureDeviceWithPersistentI > return windowCaptureDeviceWithPersistentID(id); > break; > >- case CaptureDevice::DeviceType::Application: >- case CaptureDevice::DeviceType::Browser: >- break; >- > case CaptureDevice::DeviceType::Camera: > case CaptureDevice::DeviceType::Microphone: > case CaptureDevice::DeviceType::Unknown: >diff --git a/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp b/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp >index 86dd8ebc3e9f61798c765302807d604627a3533e..a6a0dab5c0b55d1251937ab0ce46db1dc829f9f9 100644 >--- a/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp >+++ b/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp >@@ -81,8 +81,6 @@ public: > #if PLATFORM(MAC) > return WindowDisplayCaptureSourceMac::create(String { device.persistentId() }, constraints); > #endif >- case CaptureDevice::DeviceType::Application: >- case CaptureDevice::DeviceType::Browser: > case CaptureDevice::DeviceType::Microphone: > case CaptureDevice::DeviceType::Camera: > case CaptureDevice::DeviceType::Unknown: >diff --git a/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h b/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h >index 939304f58627e77c491b189fa84b595e7194dac4..04b8d8ca832989120084995891e419b8460456dc 100644 >--- a/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h >+++ b/Source/WebCore/platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h >@@ -62,6 +62,7 @@ private: > void startProducingData() final; > void stopProducingData() final; > void commitConfiguration() final; >+ CaptureDevice::DeviceType deviceType() const final { return CaptureDevice::DeviceType::Screen; } > > bool createDisplayStream(); > void startDisplayStream(); >diff --git a/Source/WebCore/platform/mediastream/mac/WindowDisplayCaptureSourceMac.h b/Source/WebCore/platform/mediastream/mac/WindowDisplayCaptureSourceMac.h >index 33d1b817e9a9e45abafe487de35f1d7a31723ae0..5f49f2b3d686259f29374a156fed118da5d63c1f 100644 >--- a/Source/WebCore/platform/mediastream/mac/WindowDisplayCaptureSourceMac.h >+++ b/Source/WebCore/platform/mediastream/mac/WindowDisplayCaptureSourceMac.h >@@ -51,6 +51,7 @@ private: > > DisplayCaptureSourceCocoa::DisplayFrameType generateFrame() final; > RealtimeMediaSourceSettings::DisplaySurfaceType surfaceType() const final { return RealtimeMediaSourceSettings::DisplaySurfaceType::Window; } >+ CaptureDevice::DeviceType deviceType() const final { return CaptureDevice::DeviceType::Window; } > > RetainPtr<CGImageRef> windowImage(); > >diff --git a/Source/WebCore/platform/mock/MockRealtimeAudioSource.h b/Source/WebCore/platform/mock/MockRealtimeAudioSource.h >index 819b3e8012a58e907a8b51582dee4ea3b0466973..a2f94b7ce7eeb66111239a526a79d60db5725682 100644 >--- a/Source/WebCore/platform/mock/MockRealtimeAudioSource.h >+++ b/Source/WebCore/platform/mock/MockRealtimeAudioSource.h >@@ -64,6 +64,7 @@ private: > void tick(); > > bool isCaptureSource() const final { return true; } >+ CaptureDevice::DeviceType deviceType() const final { return CaptureDevice::DeviceType::Microphone; } > > void delaySamples(Seconds) final; > >diff --git a/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp b/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp >index 1296a37199e719492e1a21952158ae66bbea1c40..8126abd2cef7a4d8bfc5bd2deef7622dbe608eb9 100644 >--- a/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp >+++ b/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp >@@ -116,8 +116,6 @@ public: > case CaptureDevice::DeviceType::Window: > return MockRealtimeVideoSource::create(String { device.persistentId() }, String { device.label() }, String { }, constraints); > break; >- case CaptureDevice::DeviceType::Application: >- case CaptureDevice::DeviceType::Browser: > case CaptureDevice::DeviceType::Microphone: > case CaptureDevice::DeviceType::Camera: > case CaptureDevice::DeviceType::Unknown: >diff --git a/Source/WebCore/platform/mock/MockRealtimeVideoSource.h b/Source/WebCore/platform/mock/MockRealtimeVideoSource.h >index dd215b94ba8f3a6c6ee80a30444d642a9bd6b9e0..3c7e29e2325785e38a41f3bdb50b69e9b920fa0e 100644 >--- a/Source/WebCore/platform/mock/MockRealtimeVideoSource.h >+++ b/Source/WebCore/platform/mock/MockRealtimeVideoSource.h >@@ -68,6 +68,7 @@ private: > void startProducingData() final; > void stopProducingData() final; > bool isCaptureSource() const final { return true; } >+ CaptureDevice::DeviceType deviceType() const final { return CaptureDevice::DeviceType::Camera; } > bool supportsSizeAndFrameRate(Optional<int> width, Optional<int> height, Optional<double>) final; > void setSizeAndFrameRate(Optional<int> width, Optional<int> height, Optional<double>) final; > void setSizeAndFrameRateWithPreset(IntSize, double, RefPtr<VideoPreset>) final; >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index 3c0a59f1d72f1d4a285a815a4172168d771e823a..b301e0640f57903f34a6b6f3562b8cd48ca9bcae 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -4025,6 +4025,10 @@ String Internals::pageMediaState() > string.append("HasMutedVideoCaptureDevice,"); > if (state & MediaProducer::HasUserInteractedWithMediaElement) > string.append("HasUserInteractedWithMediaElement,"); >+ if (state & MediaProducer::HasActiveDisplayCaptureDevice) >+ string.append("HasActiveDisplayCaptureDevice,"); >+ if (state & MediaProducer::HasMutedDisplayCaptureDevice) >+ string.append("HasMutedDisplayCaptureDevice,"); > > if (string.isEmpty()) > string.append("IsNotPlaying"); >diff --git a/Source/WebKit/UIProcess/API/C/WKPage.cpp b/Source/WebKit/UIProcess/API/C/WKPage.cpp >index 63d51b1f15247a7a5c44f7d71ef77bf5b4ba91dd..d4ee8cc0b5fd9a853562dbe00d573137788c1fa8 100644 >--- a/Source/WebKit/UIProcess/API/C/WKPage.cpp >+++ b/Source/WebKit/UIProcess/API/C/WKPage.cpp >@@ -2653,6 +2653,10 @@ WKMediaState WKPageGetMediaState(WKPageRef page) > state |= kWKMediaHasMutedAudioCaptureDevice; > if (coreState & WebCore::MediaProducer::HasMutedVideoCaptureDevice) > state |= kWKMediaHasMutedVideoCaptureDevice; >+ if (coreState & WebCore::MediaProducer::HasActiveDisplayCaptureDevice) >+ state |= kWKMediaHasActiveDisplayCaptureDevice; >+ if (coreState & WebCore::MediaProducer::HasMutedDisplayCaptureDevice) >+ state |= kWKMediaHasMutedDisplayCaptureDevice; > > return state; > } >diff --git a/Source/WebKit/UIProcess/API/C/WKPagePrivate.h b/Source/WebKit/UIProcess/API/C/WKPagePrivate.h >index bb26de8abf15dd4da1a44108efef040251dee2aa..e09e2da4c130522add58c4ee2f678a3cd998851e 100644 >--- a/Source/WebKit/UIProcess/API/C/WKPagePrivate.h >+++ b/Source/WebKit/UIProcess/API/C/WKPagePrivate.h >@@ -148,6 +148,8 @@ enum { > kWKMediaHasActiveVideoCaptureDevice = 1 << 3, > kWKMediaHasMutedAudioCaptureDevice = 1 << 4, > kWKMediaHasMutedVideoCaptureDevice = 1 << 5, >+ kWKMediaHasActiveDisplayCaptureDevice = 1 << 6, >+ kWKMediaHasMutedDisplayCaptureDevice = 1 << 7, > }; > typedef uint32_t WKMediaState; > >diff --git a/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp b/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp >index d67c66d36cd0dbd79d794bcd423c060657c2de57..056d5c342dd05b529c6f26a129b7207fe41343f7 100644 >--- a/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp >+++ b/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp >@@ -149,8 +149,6 @@ void UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstrai > break; > case WebCore::CaptureDevice::DeviceType::Screen: > case WebCore::CaptureDevice::DeviceType::Window: >- case WebCore::CaptureDevice::DeviceType::Application: >- case WebCore::CaptureDevice::DeviceType::Browser: > sourceOrError = RealtimeMediaSourceCenter::singleton().displayCaptureFactory().createDisplayCaptureSource(device, &constraints); > break; > case WebCore::CaptureDevice::DeviceType::Unknown: >diff --git a/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp b/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp >index de25c69e9129d5d3181dd7bab7fd54b3ffaf948e..e2b519ce34a43e0c5ad875468d58cc35e1f5a036 100644 >--- a/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp >+++ b/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp >@@ -56,11 +56,13 @@ static uint64_t nextSessionID() > > class UserMediaCaptureManager::Source : public RealtimeMediaSource { > public: >- Source(String&& sourceID, Type type, String&& name, String&& hashSalt, uint64_t id, UserMediaCaptureManager& manager) >+ Source(String&& sourceID, Type type, CaptureDevice::DeviceType deviceType, String&& name, String&& hashSalt, uint64_t id, UserMediaCaptureManager& manager) > : RealtimeMediaSource(type, WTFMove(name), WTFMove(sourceID), WTFMove(hashSalt)) > , m_id(id) > , m_manager(manager) >+ , m_deviceType(deviceType) > { >+ ASSERT(deviceType == CaptureDevice::DeviceType::Camera || deviceType == CaptureDevice::DeviceType::Screen || deviceType == CaptureDevice::DeviceType::Window); > if (type == Type::Audio) > m_ringBuffer = std::make_unique<CARingBuffer>(makeUniqueRef<SharedRingBufferStorage>(nullptr)); > } >@@ -178,6 +180,7 @@ private: > void startProducingData() final { m_manager.startProducingData(m_id); } > void stopProducingData() final { m_manager.stopProducingData(m_id); } > bool isCaptureSource() const final { return true; } >+ CaptureDevice::DeviceType deviceType() const final { return m_deviceType; } > > // RealtimeMediaSource > void beginConfiguration() final { } >@@ -197,6 +200,7 @@ private: > std::unique_ptr<CARingBuffer> m_ringBuffer; > > std::unique_ptr<ImageTransferSessionVT> m_imageTransferSession; >+ CaptureDevice::DeviceType m_deviceType { CaptureDevice::DeviceType::Unknown }; > > struct ApplyConstraintsCallback { > SuccessHandler successHandler; >@@ -251,7 +255,7 @@ WebCore::CaptureSourceOrError UserMediaCaptureManager::createCaptureSource(const > return WTFMove(errorMessage); > > auto type = device.type() == CaptureDevice::DeviceType::Microphone ? WebCore::RealtimeMediaSource::Type::Audio : WebCore::RealtimeMediaSource::Type::Video; >- auto source = adoptRef(*new Source(String::number(id), type, String { settings.label() }, WTFMove(hashSalt), id, *this)); >+ auto source = adoptRef(*new Source(String::number(id), type, device.type(), String { settings.label() }, WTFMove(hashSalt), id, *this)); > source->setSettings(WTFMove(settings)); > m_sources.set(id, source.copyRef()); > return WebCore::CaptureSourceOrError(WTFMove(source)); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 1486382618788f2984e185d879169f8de3964695..779a491c0b123a5427bcbf744b1c03fa1facfddb 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2019-01-07 Eric Carlson <eric.carlson@apple.com> >+ >+ Define page media state flags for display capture. >+ https://bugs.webkit.org/show_bug.cgi?id=193230 >+ <rdar://problem/47095142> >+ >+ Reviewed by Youenn Fablet. >+ >+ * fast/mediastream/get-display-media-muted-expected.txt: Added. >+ * fast/mediastream/get-display-media-muted.html: Added. >+ > 2019-01-07 Claudio Saavedra <csaavedra@igalia.com> > > [WPE][GTK] Skip css-painting-api tests >diff --git a/LayoutTests/fast/mediastream/get-display-media-muted-expected.txt b/LayoutTests/fast/mediastream/get-display-media-muted-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..f9c632224de3488ad291b67fb2d0a5d3a70c0d3d >--- /dev/null >+++ b/LayoutTests/fast/mediastream/get-display-media-muted-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Mute video track during screen capture >+ >diff --git a/LayoutTests/fast/mediastream/get-display-media-muted.html b/LayoutTests/fast/mediastream/get-display-media-muted.html >new file mode 100644 >index 0000000000000000000000000000000000000000..bcf3e67332613baa2e92473e805385da64999936 >--- /dev/null >+++ b/LayoutTests/fast/mediastream/get-display-media-muted.html >@@ -0,0 +1,74 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <meta charset="utf-8"> >+ <title>Mute screen capture, make sure page state updates correctly.</title> >+ <script src="../../resources/testharness.js"></script> >+ <script src="../../resources/testharnessreport.js"></script> >+ <script> >+ >+ if (window.testRunner) >+ testRunner.setUserMediaPermission(true); >+ >+ async function waitForPageStateChange(numberOfTries, originalState) >+ { >+ return new Promise(async (resolve) => { >+ while (numberOfTries) { >+ if (internals.pageMediaState() != originalState) { >+ resolve(true); >+ return; >+ } >+ >+ await new Promise(resolve => { setTimeout(resolve, 10) }); >+ --numberOfTries; >+ } >+ >+ resolve(false); >+ }); >+ } >+ >+ promise_test(async (test) => { >+ await new Promise(async (resolve, reject) => { >+ let stream = await navigator.mediaDevices.getDisplayMedia({ video: true }); >+ let pageMediaState = internals.pageMediaState(); >+ >+ assert_false(pageMediaState.includes('HasMutedDisplayCaptureDevice'), 'page state does not include HasMutedDisplayCaptureDevice'); >+ assert_false(pageMediaState.includes('HasMutedVideoCaptureDevice'), 'page state does not include HasMutedVideoCaptureDevice'); >+ assert_false(pageMediaState.includes('HasMutedAudioCaptureDevice'), 'page state does not include HasMutedAudioCaptureDevice'); >+ >+ let track = stream.getVideoTracks()[0]; >+ track.onunmute = () => { assert_unreached("Got 'unmute' event unexpectedly!") }; >+ >+ track.onmute = async (evt) => { >+ >+ if (!await waitForPageStateChange(10, pageMediaState)) >+ assert_unreached(`Page state did not change from ${pageMediaState}`); >+ >+ track.onunmute = async (evt) => { >+ if (!await waitForPageStateChange(10, pageMediaState)) >+ assert_unreached(`Page state did not change from ${pageMediaState}`); >+ >+ pageMediaState = internals.pageMediaState(); >+ assert_false(pageMediaState.includes('HasMutedDisplayCaptureDevice'), 'page state does not include HasMutedDisplayCaptureDevice'); >+ assert_true(pageMediaState.includes('HasActiveDisplayCaptureDevice'), 'page state includes HasActiveDisplayCaptureDevice'); >+ resolve() >+ } >+ >+ pageMediaState = internals.pageMediaState(); >+ assert_true(pageMediaState.includes('HasMutedDisplayCaptureDevice'), 'page state includes HasMutedDisplayCaptureDevice'); >+ assert_false(pageMediaState.includes('HasActiveDisplayCaptureDevice'), 'page state does not include HasActiveDisplayCaptureDevice'); >+ internals.setMediaStreamTrackMuted(track, false) >+ } >+ >+ pageMediaState = internals.pageMediaState(); >+ internals.setMediaStreamTrackMuted(track, true); >+ >+ setTimeout(() => reject("Muted state did not change in .5 second"), 500); >+ }); >+ }, "Mute video track during screen capture"); >+ >+ </script> >+</head> >+<body> >+</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 193230
:
358577
| 358809