Changeset 216938 in webkit
- Timestamp:
- May 16, 2017 11:27:31 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 2 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r216935 r216938 1 2017-05-16 Eric Carlson <eric.carlson@apple.com> 2 3 [MediaStream] Return default device list until user gives permission to capture 4 https://bugs.webkit.org/show_bug.cgi?id=172168 5 <rdar://problem/31816884> 6 7 Reviewed by Youenn Fablet. 8 9 * fast/mediastream/MediaDevices-enumerateDevices-expected.txt: Removed. 10 * fast/mediastream/MediaDevices-enumerateDevices.html: Removed. 11 * fast/mediastream/media-devices-enumerate-devices-expected.txt: Added. 12 * fast/mediastream/media-devices-enumerate-devices.html: Added. 13 1 14 2017-05-16 Tim Horton <timothy_horton@apple.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r216937 r216938 1 2017-05-16 Eric Carlson <eric.carlson@apple.com> 2 3 [MediaStream] Return default device list until user gives permission to capture 4 https://bugs.webkit.org/show_bug.cgi?id=172168 5 <rdar://problem/31816884> 6 7 Reviewed by Youenn Fablet. 8 9 Test: fast/mediastream/media-devices-enumerate-devices.html 10 11 * Modules/mediastream/MediaDevicesRequest.cpp: 12 (WebCore::MediaDevicesRequest::filterDeviceList): Remove all but the "default" number of 13 devices of each type. 14 (WebCore::MediaDevicesRequest::start): Call filterDeviceList. 15 * Modules/mediastream/MediaDevicesRequest.h: 16 1 17 2017-05-16 Claudio Saavedra <csaavedra@igalia.com> 2 18 -
trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.cpp
r215929 r216938 77 77 } 78 78 79 void MediaDevicesRequest::filterDeviceList(Vector<RefPtr<MediaDeviceInfo>>& devices) 80 { 81 #if !PLATFORM(COCOA) 82 UNUSED_PARAM(devices); 83 #else 84 85 #if PLATFORM(IOS) 86 static const int defaultCameraCount = 2; 87 #endif 88 #if PLATFORM(MAC) 89 static const int defaultCameraCount = 1; 90 #endif 91 static const int defaultMicrophoneCount = 1; 92 93 int cameraCount = 0; 94 int microphoneCount = 0; 95 devices.removeAllMatching([&](const RefPtr<MediaDeviceInfo>& device) -> bool { 96 if (device->kind() == MediaDeviceInfo::Kind::Videoinput && ++cameraCount > defaultCameraCount) 97 return true; 98 if (device->kind() == MediaDeviceInfo::Kind::Audioinput && ++microphoneCount > defaultMicrophoneCount) 99 return true; 100 101 return false; 102 }); 103 104 #endif 105 } 106 79 107 void MediaDevicesRequest::start() 80 108 { … … 105 133 } 106 134 135 if (!originHasPersistentAccess && !document.hasHadActiveMediaStreamTrack()) 136 filterDeviceList(devices); 137 107 138 callOnMainThread([protectedThis = makeRef(*this), devices = WTFMove(devices)]() mutable { 108 139 protectedThis->m_promise.resolve(devices); -
trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.h
r215929 r216938 52 52 void contextDestroyed() final; 53 53 54 void filterDeviceList(Vector<RefPtr<MediaDeviceInfo>>&); 55 54 56 MediaDevices::EnumerateDevicesPromise m_promise; 55 57 RefPtr<MediaDevicesRequest> m_protector;
Note: See TracChangeset
for help on using the changeset viewer.