<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[212418] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/212418">212418</a></dd>
<dt>Author</dt> <dd>eric.carlson@apple.com</dd>
<dt>Date</dt> <dd>2017-02-15 18:01:59 -0800 (Wed, 15 Feb 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>[MediaStream] delete CaptureDeviceInfo struct
https://bugs.webkit.org/show_bug.cgi?id=168395
Source/WebCore:
The CaptureDeviceInfo struct and CaptureDevice class were almost identical, so
add an "enabled" field to the later, delete the former, and switch all uses of
CaptureDeviceInfo to CaptureDevice.
Do some minor drive-by cleanup of AVCaptureDeviceManager::refreshCaptureDevices
and CaptureDeviceManager::captureDeviceFromDeviceID.
Reviewed by Sam Weinig.
No new tests, no behavior change.
* Modules/mediastream/MediaDevicesRequest.cpp:
(WebCore::MediaDevicesRequest::start): SourceKind -> DeviceType
* platform/mediastream/CaptureDevice.h:
(WebCore::CaptureDevice::CaptureDevice):
(WebCore::CaptureDevice::type): Renamed from kind.
(WebCore::CaptureDevice::setType):
(WebCore::CaptureDevice::enabled): Added.
(WebCore::CaptureDevice::setEnabled):
(WebCore::CaptureDevice::kind): Deleted.
(WebCore::CaptureDevice::setKind): Deleted.
* platform/mediastream/CaptureDeviceManager.cpp:
(CaptureDeviceManager::getSourcesInfo):
(CaptureDeviceManager::captureDeviceFromDeviceID): Don't call sourceWithUID.
(CaptureDeviceManager::bestSourcesForTypeAndConstraints):
(CaptureDeviceManager::sourceWithUID):
* platform/mediastream/CaptureDeviceManager.h:
(WebCore::CaptureDeviceManager::refreshCaptureDevices):
(WebCore::CaptureDeviceManager::refreshCaptureDeviceList): Deleted.
* platform/mediastream/mac/AVCaptureDeviceManager.h:
* platform/mediastream/mac/AVCaptureDeviceManager.mm:
(WebCore::AVCaptureDeviceManager::captureDevices):
(WebCore::deviceIsAvailable):
(WebCore::AVCaptureDeviceManager::refreshCaptureDevices):
(WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints):
(WebCore::AVCaptureDeviceManager::deviceConnected):
(WebCore::AVCaptureDeviceManager::deviceDisconnected):
(WebCore::AVCaptureDeviceManager::captureDeviceList): Deleted.
(WebCore::shouldConsiderDeviceInDeviceList): Deleted.
(WebCore::AVCaptureDeviceManager::refreshCaptureDeviceList): Deleted.
* platform/mock/MockRealtimeMediaSource.cpp:
(WebCore::MockRealtimeMediaSource::audioDeviceInfo):
(WebCore::MockRealtimeMediaSource::videoDeviceInfo):
Source/WebKit2:
Reviewed by Sam Weinig.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<CaptureDevice>::encode):
(IPC::ArgumentCoder<CaptureDevice>::decode):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaDevicesRequestcpp">trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamCaptureDeviceh">trunk/Source/WebCore/platform/mediastream/CaptureDevice.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamCaptureDeviceManagercpp">trunk/Source/WebCore/platform/mediastream/CaptureDeviceManager.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamCaptureDeviceManagerh">trunk/Source/WebCore/platform/mediastream/CaptureDeviceManager.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreammacAVCaptureDeviceManagerh">trunk/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreammacAVCaptureDeviceManagermm">trunk/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmockMockRealtimeMediaSourcecpp">trunk/Source/WebCore/platform/mock/MockRealtimeMediaSource.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedWebCoreArgumentCoderscpp">trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (212417 => 212418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-02-16 01:17:57 UTC (rev 212417)
+++ trunk/Source/WebCore/ChangeLog        2017-02-16 02:01:59 UTC (rev 212418)
</span><span class="lines">@@ -1,3 +1,54 @@
</span><ins>+2017-02-15 Eric Carlson <eric.carlson@apple.com>
+
+ [MediaStream] delete CaptureDeviceInfo struct
+ https://bugs.webkit.org/show_bug.cgi?id=168395
+
+ The CaptureDeviceInfo struct and CaptureDevice class were almost identical, so
+ add an "enabled" field to the later, delete the former, and switch all uses of
+ CaptureDeviceInfo to CaptureDevice.
+
+ Do some minor drive-by cleanup of AVCaptureDeviceManager::refreshCaptureDevices
+ and CaptureDeviceManager::captureDeviceFromDeviceID.
+
+ Reviewed by Sam Weinig.
+
+ No new tests, no behavior change.
+
+ * Modules/mediastream/MediaDevicesRequest.cpp:
+ (WebCore::MediaDevicesRequest::start): SourceKind -> DeviceType
+ * platform/mediastream/CaptureDevice.h:
+ (WebCore::CaptureDevice::CaptureDevice):
+ (WebCore::CaptureDevice::type): Renamed from kind.
+ (WebCore::CaptureDevice::setType):
+ (WebCore::CaptureDevice::enabled): Added.
+ (WebCore::CaptureDevice::setEnabled):
+ (WebCore::CaptureDevice::kind): Deleted.
+ (WebCore::CaptureDevice::setKind): Deleted.
+
+ * platform/mediastream/CaptureDeviceManager.cpp:
+ (CaptureDeviceManager::getSourcesInfo):
+ (CaptureDeviceManager::captureDeviceFromDeviceID): Don't call sourceWithUID.
+ (CaptureDeviceManager::bestSourcesForTypeAndConstraints):
+ (CaptureDeviceManager::sourceWithUID):
+ * platform/mediastream/CaptureDeviceManager.h:
+ (WebCore::CaptureDeviceManager::refreshCaptureDevices):
+ (WebCore::CaptureDeviceManager::refreshCaptureDeviceList): Deleted.
+
+ * platform/mediastream/mac/AVCaptureDeviceManager.h:
+ * platform/mediastream/mac/AVCaptureDeviceManager.mm:
+ (WebCore::AVCaptureDeviceManager::captureDevices):
+ (WebCore::deviceIsAvailable):
+ (WebCore::AVCaptureDeviceManager::refreshCaptureDevices):
+ (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints):
+ (WebCore::AVCaptureDeviceManager::deviceConnected):
+ (WebCore::AVCaptureDeviceManager::deviceDisconnected):
+ (WebCore::AVCaptureDeviceManager::captureDeviceList): Deleted.
+ (WebCore::shouldConsiderDeviceInDeviceList): Deleted.
+ (WebCore::AVCaptureDeviceManager::refreshCaptureDeviceList): Deleted.
+ * platform/mock/MockRealtimeMediaSource.cpp:
+ (WebCore::MockRealtimeMediaSource::audioDeviceInfo):
+ (WebCore::MockRealtimeMediaSource::videoDeviceInfo):
+
</ins><span class="cx"> 2017-02-15 Sam Weinig <sam@webkit.org>
</span><span class="cx">
</span><span class="cx"> [WebIDL] Remove custom conversion from FontFace code by using a Variant
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaDevicesRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.cpp (212417 => 212418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.cpp        2017-02-16 01:17:57 UTC (rev 212417)
+++ trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.cpp        2017-02-16 02:01:59 UTC (rev 212418)
</span><span class="lines">@@ -103,7 +103,7 @@
</span><span class="cx"> continue;
</span><span class="cx">
</span><span class="cx"> auto groupId = hashID(deviceInfo.groupId());
</span><del>- auto deviceType = deviceInfo.kind() == CaptureDevice::SourceKind::Audio ? MediaDeviceInfo::Kind::Audioinput : MediaDeviceInfo::Kind::Videoinput;
</del><ins>+ auto deviceType = deviceInfo.type() == CaptureDevice::DeviceType::Audio ? MediaDeviceInfo::Kind::Audioinput : MediaDeviceInfo::Kind::Videoinput;
</ins><span class="cx"> devices.append(MediaDeviceInfo::create(scriptExecutionContext(), label, id, groupId, deviceType));
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamCaptureDeviceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/CaptureDevice.h (212417 => 212418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/CaptureDevice.h        2017-02-16 01:17:57 UTC (rev 212417)
+++ trunk/Source/WebCore/platform/mediastream/CaptureDevice.h        2017-02-16 02:01:59 UTC (rev 212418)
</span><span class="lines">@@ -33,11 +33,11 @@
</span><span class="cx">
</span><span class="cx"> class CaptureDevice {
</span><span class="cx"> public:
</span><del>- enum class SourceKind { Unknown, Audio, Video };
</del><ins>+ enum class DeviceType { Unknown, Audio, Video };
</ins><span class="cx">
</span><del>- CaptureDevice(const String& persistentId, SourceKind kind, const String& label, const String& groupId)
</del><ins>+ CaptureDevice(const String& persistentId, DeviceType type, const String& label, const String& groupId = emptyString())
</ins><span class="cx"> : m_persistentId(persistentId)
</span><del>- , m_kind(kind)
</del><ins>+ , m_type(type)
</ins><span class="cx"> , m_label(label)
</span><span class="cx"> , m_groupId(groupId)
</span><span class="cx"> {
</span><span class="lines">@@ -54,14 +54,17 @@
</span><span class="cx"> const String& groupId() const { return m_groupId; }
</span><span class="cx"> void setGroupId(const String& id) { m_groupId = id; }
</span><span class="cx">
</span><del>- SourceKind kind() const { return m_kind; }
- void setKind(SourceKind kind) { m_kind = kind; }
</del><ins>+ DeviceType type() const { return m_type; }
+ void setType(DeviceType type) { m_type = type; }
</ins><span class="cx">
</span><ins>+ bool enabled() const { return m_enabled; }
+ void setEnabled(bool enabled) { m_enabled = enabled; }
</ins><span class="cx"> private:
</span><span class="cx"> String m_persistentId;
</span><del>- SourceKind m_kind { SourceKind::Unknown };
</del><ins>+ DeviceType m_type { DeviceType::Unknown };
</ins><span class="cx"> String m_label;
</span><span class="cx"> String m_groupId;
</span><ins>+ bool m_enabled { false };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamCaptureDeviceManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/CaptureDeviceManager.cpp (212417 => 212418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/CaptureDeviceManager.cpp        2017-02-16 01:17:57 UTC (rev 212417)
+++ trunk/Source/WebCore/platform/mediastream/CaptureDeviceManager.cpp        2017-02-16 02:01:59 UTC (rev 212418)
</span><span class="lines">@@ -47,21 +47,20 @@
</span><span class="cx"> Vector<CaptureDevice> CaptureDeviceManager::getSourcesInfo()
</span><span class="cx"> {
</span><span class="cx"> Vector<CaptureDevice> sourcesInfo;
</span><del>- for (auto captureDevice : captureDeviceList()) {
- if (!captureDevice.m_enabled || captureDevice.m_sourceType == RealtimeMediaSource::None)
</del><ins>+ for (auto captureDevice : captureDevices()) {
+ if (!captureDevice.enabled() || captureDevice.type() == CaptureDevice::DeviceType::Unknown)
</ins><span class="cx"> continue;
</span><span class="cx">
</span><del>- CaptureDevice::SourceKind kind = captureDevice.m_sourceType == RealtimeMediaSource::Video ? CaptureDevice::SourceKind::Video : CaptureDevice::SourceKind::Audio;
- sourcesInfo.append(CaptureDevice(captureDevice.m_persistentDeviceID, kind, captureDevice.m_localizedName, captureDevice.m_groupID));
</del><ins>+ sourcesInfo.append(captureDevice);
</ins><span class="cx"> }
</span><span class="cx"> LOG(Media, "CaptureDeviceManager::getSourcesInfo(%p), found %zu active devices", this, sourcesInfo.size());
</span><span class="cx"> return sourcesInfo;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool CaptureDeviceManager::captureDeviceFromDeviceID(const String& captureDeviceID, CaptureDeviceInfo& foundDevice)
</del><ins>+bool CaptureDeviceManager::captureDeviceFromDeviceID(const String& captureDeviceID, CaptureDevice& foundDevice)
</ins><span class="cx"> {
</span><del>- for (auto& device : captureDeviceList()) {
- if (device.m_persistentDeviceID == captureDeviceID) {
</del><ins>+ for (auto& device : captureDevices()) {
+ if (device.persistentId() == captureDeviceID) {
</ins><span class="cx"> foundDevice = device;
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="lines">@@ -81,11 +80,12 @@
</span><span class="cx"> }
</span><span class="cx"> } sortBasedOnFitnessScore;
</span><span class="cx">
</span><del>- for (auto& captureDevice : captureDeviceList()) {
- if (!captureDevice.m_enabled)
</del><ins>+ CaptureDevice::DeviceType deviceType = type == RealtimeMediaSource::Video ? CaptureDevice::DeviceType::Video : CaptureDevice::DeviceType::Audio;
+ for (auto& captureDevice : captureDevices()) {
+ if (!captureDevice.enabled() || captureDevice.type() != deviceType)
</ins><span class="cx"> continue;
</span><span class="cx">
</span><del>- if (RefPtr<RealtimeMediaSource> captureSource = sourceWithUID(captureDevice.m_persistentDeviceID, type, &constraints, invalidConstraint))
</del><ins>+ if (auto captureSource = createMediaSourceForCaptureDeviceWithConstraints(captureDevice, &constraints, invalidConstraint))
</ins><span class="cx"> bestSources.append(captureSource.leakRef());
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -103,13 +103,17 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<RealtimeMediaSource> CaptureDeviceManager::sourceWithUID(const String& deviceUID, RealtimeMediaSource::Type type, const MediaConstraints* constraints, String& invalidConstraint)
</span><span class="cx"> {
</span><del>- for (auto& captureDevice : captureDeviceList()) {
- if (captureDevice.m_persistentDeviceID != deviceUID || captureDevice.m_sourceType != type)
</del><ins>+ for (auto& captureDevice : captureDevices()) {
+ if (type == RealtimeMediaSource::None)
</ins><span class="cx"> continue;
</span><span class="cx">
</span><del>- if (!captureDevice.m_enabled)
</del><ins>+ CaptureDevice::DeviceType deviceType = type == RealtimeMediaSource::Video ? CaptureDevice::DeviceType::Video : CaptureDevice::DeviceType::Audio;
+ if (captureDevice.persistentId() != deviceUID || captureDevice.type() != deviceType)
</ins><span class="cx"> continue;
</span><span class="cx">
</span><ins>+ if (!captureDevice.enabled())
+ continue;
+
</ins><span class="cx"> if (auto mediaSource = createMediaSourceForCaptureDeviceWithConstraints(captureDevice, constraints, invalidConstraint))
</span><span class="cx"> return mediaSource;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamCaptureDeviceManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/CaptureDeviceManager.h (212417 => 212418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/CaptureDeviceManager.h        2017-02-16 01:17:57 UTC (rev 212417)
+++ trunk/Source/WebCore/platform/mediastream/CaptureDeviceManager.h        2017-02-16 02:01:59 UTC (rev 212418)
</span><span class="lines">@@ -32,21 +32,10 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-struct CaptureDeviceInfo {
-public:
- String m_persistentDeviceID;
- String m_localizedName;
- String m_sourceId;
- String m_groupID { emptyString() };
- bool m_enabled { true };
- RealtimeMediaSource::Type m_sourceType { RealtimeMediaSource::None };
- RealtimeMediaSourceSettings::VideoFacingMode m_position { RealtimeMediaSourceSettings::Unknown };
-};
-
</del><span class="cx"> class CaptureDeviceManager {
</span><span class="cx"> public:
</span><del>- virtual Vector<CaptureDeviceInfo>& captureDeviceList() = 0;
- virtual void refreshCaptureDeviceList() { }
</del><ins>+ virtual Vector<CaptureDevice>& captureDevices() = 0;
+ virtual void refreshCaptureDevices() { }
</ins><span class="cx"> virtual Vector<CaptureDevice> getSourcesInfo();
</span><span class="cx"> virtual Vector<String> bestSourcesForTypeAndConstraints(RealtimeMediaSource::Type, const MediaConstraints&, String&);
</span><span class="cx"> virtual RefPtr<RealtimeMediaSource> sourceWithUID(const String&, RealtimeMediaSource::Type, const MediaConstraints*, String&);
</span><span class="lines">@@ -53,9 +42,9 @@
</span><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> virtual ~CaptureDeviceManager();
</span><del>- virtual RefPtr<RealtimeMediaSource> createMediaSourceForCaptureDeviceWithConstraints(const CaptureDeviceInfo&, const MediaConstraints*, String&) = 0;
</del><ins>+ virtual RefPtr<RealtimeMediaSource> createMediaSourceForCaptureDeviceWithConstraints(const CaptureDevice&, const MediaConstraints*, String&) = 0;
</ins><span class="cx">
</span><del>- bool captureDeviceFromDeviceID(const String& captureDeviceID, CaptureDeviceInfo& source);
</del><ins>+ bool captureDeviceFromDeviceID(const String& captureDeviceID, CaptureDevice& source);
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreammacAVCaptureDeviceManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.h (212417 => 212418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.h        2017-02-16 01:17:57 UTC (rev 212417)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.h        2017-02-16 02:01:59 UTC (rev 212418)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx"> class AVCaptureDeviceManager final : public CaptureDeviceManager {
</span><span class="cx"> friend class NeverDestroyed<AVCaptureDeviceManager>;
</span><span class="cx"> public:
</span><del>- Vector<CaptureDeviceInfo>& captureDeviceList() final;
</del><ins>+ Vector<CaptureDevice>& captureDevices() final;
</ins><span class="cx">
</span><span class="cx"> static AVCaptureDeviceManager& singleton();
</span><span class="cx">
</span><span class="lines">@@ -60,12 +60,12 @@
</span><span class="cx"> AVCaptureDeviceManager();
</span><span class="cx"> ~AVCaptureDeviceManager() final;
</span><span class="cx">
</span><del>- RefPtr<RealtimeMediaSource> createMediaSourceForCaptureDeviceWithConstraints(const CaptureDeviceInfo&, const MediaConstraints*, String&) final;
- void refreshCaptureDeviceList() final;
</del><ins>+ RefPtr<RealtimeMediaSource> createMediaSourceForCaptureDeviceWithConstraints(const CaptureDevice&, const MediaConstraints*, String&) final;
+ void refreshCaptureDevices() final;
</ins><span class="cx"> void registerForDeviceNotifications();
</span><span class="cx">
</span><span class="cx"> RetainPtr<WebCoreAVCaptureDeviceManagerObserver> m_objcObserver;
</span><del>- Vector<CaptureDeviceInfo> m_devices;
</del><ins>+ Vector<CaptureDevice> m_devices;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreammacAVCaptureDeviceManagermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm (212417 => 212418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm        2017-02-16 01:17:57 UTC (rev 212417)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm        2017-02-16 02:01:59 UTC (rev 212418)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-Vector<CaptureDeviceInfo>& AVCaptureDeviceManager::captureDeviceList()
</del><ins>+Vector<CaptureDevice>& AVCaptureDeviceManager::captureDevices()
</ins><span class="cx"> {
</span><span class="cx"> if (!isAvailable())
</span><span class="cx"> return m_devices;
</span><span class="lines">@@ -100,7 +100,7 @@
</span><span class="cx"> static bool firstTime = true;
</span><span class="cx"> if (firstTime && !m_devices.size()) {
</span><span class="cx"> firstTime = false;
</span><del>- refreshCaptureDeviceList();
</del><ins>+ refreshCaptureDevices();
</ins><span class="cx"> registerForDeviceNotifications();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -107,7 +107,7 @@
</span><span class="cx"> return m_devices;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline static bool shouldConsiderDeviceInDeviceList(AVCaptureDeviceTypedef *device)
</del><ins>+inline static bool deviceIsAvailable(AVCaptureDeviceTypedef *device)
</ins><span class="cx"> {
</span><span class="cx"> if (![device isConnected])
</span><span class="cx"> return false;
</span><span class="lines">@@ -120,37 +120,28 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void AVCaptureDeviceManager::refreshCaptureDeviceList()
</del><ins>+void AVCaptureDeviceManager::refreshCaptureDevices()
</ins><span class="cx"> {
</span><span class="cx"> for (AVCaptureDeviceTypedef *platformDevice in [getAVCaptureDeviceClass() devices]) {
</span><del>- if (!shouldConsiderDeviceInDeviceList(platformDevice))
- continue;
</del><span class="cx">
</span><del>- CaptureDeviceInfo captureDevice;
</del><ins>+ CaptureDevice captureDevice;
</ins><span class="cx"> if (!captureDeviceFromDeviceID(platformDevice.uniqueID, captureDevice)) {
</span><del>- CaptureDeviceInfo captureDevice = { platformDevice.uniqueID, platformDevice.localizedName, createCanonicalUUIDString() };
-
- if ([platformDevice position] == AVCaptureDevicePositionFront)
- captureDevice.m_position = RealtimeMediaSourceSettings::User;
- if ([platformDevice position] == AVCaptureDevicePositionBack)
- captureDevice.m_position = RealtimeMediaSourceSettings::Environment;
-
</del><span class="cx"> bool hasAudio = [platformDevice hasMediaType:AVMediaTypeAudio] || [platformDevice hasMediaType:AVMediaTypeMuxed];
</span><span class="cx"> bool hasVideo = [platformDevice hasMediaType:AVMediaTypeVideo] || [platformDevice hasMediaType:AVMediaTypeMuxed];
</span><span class="cx"> if (!hasAudio && !hasVideo)
</span><span class="cx"> continue;
</span><span class="cx">
</span><del>- // FIXME: For a given device, the source ID should persist when visiting the same request origin,
- // but differ across different request origins.
- captureDevice.m_sourceType = hasVideo ? RealtimeMediaSource::Video : RealtimeMediaSource::Audio;
</del><ins>+ CaptureDevice::DeviceType type = hasVideo ? CaptureDevice::DeviceType::Video : CaptureDevice::DeviceType::Audio;
+ CaptureDevice captureDevice(platformDevice.uniqueID, type, platformDevice.localizedName);
+ captureDevice.setEnabled(deviceIsAvailable(platformDevice));
+ m_devices.append(captureDevice);
+
</ins><span class="cx"> if (hasVideo && hasAudio) {
</span><span class="cx"> // Add the audio component as a separate device.
</span><del>- CaptureDeviceInfo audioCaptureDevice = captureDevice;
- audioCaptureDevice.m_sourceId = createCanonicalUUIDString();
- audioCaptureDevice.m_sourceType = RealtimeMediaSource::Audio;
</del><ins>+ CaptureDevice audioCaptureDevice(platformDevice.uniqueID, CaptureDevice::DeviceType::Audio, platformDevice.localizedName);
+ captureDevice.setEnabled(deviceIsAvailable(platformDevice));
</ins><span class="cx"> m_devices.append(audioCaptureDevice);
</span><span class="cx"> }
</span><del>- m_devices.append(captureDevice);
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -185,16 +176,16 @@
</span><span class="cx"> return CaptureDeviceManager::getSourcesInfo();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<RealtimeMediaSource> AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints(const CaptureDeviceInfo& captureDevice, const MediaConstraints* constraints, String& invalidConstraint)
</del><ins>+RefPtr<RealtimeMediaSource> AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints(const CaptureDevice& captureDevice, const MediaConstraints* constraints, String& invalidConstraint)
</ins><span class="cx"> {
</span><del>- AVCaptureDeviceTypedef *device = [getAVCaptureDeviceClass() deviceWithUniqueID:captureDevice.m_persistentDeviceID];
</del><ins>+ AVCaptureDeviceTypedef *device = [getAVCaptureDeviceClass() deviceWithUniqueID:captureDevice.persistentId()];
</ins><span class="cx"> if (!device)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- if (captureDevice.m_sourceType == RealtimeMediaSource::Audio)
- return AVAudioCaptureSource::create(device, captureDevice.m_sourceId, constraints, invalidConstraint);
</del><ins>+ if (captureDevice.type() == CaptureDevice::DeviceType::Audio)
+ return AVAudioCaptureSource::create(device, emptyString(), constraints, invalidConstraint);
</ins><span class="cx">
</span><del>- return AVVideoCaptureSource::create(device, captureDevice.m_sourceId, constraints, invalidConstraint);
</del><ins>+ return AVVideoCaptureSource::create(device, emptyString(), constraints, invalidConstraint);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void AVCaptureDeviceManager::registerForDeviceNotifications()
</span><span class="lines">@@ -205,12 +196,12 @@
</span><span class="cx">
</span><span class="cx"> void AVCaptureDeviceManager::deviceConnected()
</span><span class="cx"> {
</span><del>- refreshCaptureDeviceList();
</del><ins>+ refreshCaptureDevices();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void AVCaptureDeviceManager::deviceDisconnected(AVCaptureDeviceTypedef* device)
</span><span class="cx"> {
</span><del>- Vector<CaptureDeviceInfo>& devices = captureDeviceList();
</del><ins>+ Vector<CaptureDevice>& devices = captureDevices();
</ins><span class="cx">
</span><span class="cx"> size_t count = devices.size();
</span><span class="cx"> if (!count)
</span><span class="lines">@@ -218,9 +209,9 @@
</span><span class="cx">
</span><span class="cx"> String deviceID = device.uniqueID;
</span><span class="cx"> for (size_t i = 0; i < count; ++i) {
</span><del>- if (devices[i].m_persistentDeviceID == deviceID) {
</del><ins>+ if (devices[i].persistentId() == deviceID) {
</ins><span class="cx"> LOG(Media, "AVCaptureDeviceManager::deviceDisconnected(%p), device %d disabled", this, i);
</span><del>- devices[i].m_enabled = false;
</del><ins>+ devices[i].setEnabled(false);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmockMockRealtimeMediaSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mock/MockRealtimeMediaSource.cpp (212417 => 212418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mock/MockRealtimeMediaSource.cpp        2017-02-16 01:17:57 UTC (rev 212417)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeMediaSource.cpp        2017-02-16 02:01:59 UTC (rev 212418)
</span><span class="lines">@@ -70,13 +70,13 @@
</span><span class="cx">
</span><span class="cx"> CaptureDevice MockRealtimeMediaSource::audioDeviceInfo()
</span><span class="cx"> {
</span><del>- static NeverDestroyed<CaptureDevice> deviceInfo(mockAudioSourcePersistentID(), CaptureDevice::SourceKind::Audio, mockAudioSourceName(), "");
</del><ins>+ static NeverDestroyed<CaptureDevice> deviceInfo(mockAudioSourcePersistentID(), CaptureDevice::DeviceType::Audio, mockAudioSourceName(), "");
</ins><span class="cx"> return deviceInfo;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> CaptureDevice MockRealtimeMediaSource::videoDeviceInfo()
</span><span class="cx"> {
</span><del>- static NeverDestroyed<CaptureDevice> deviceInfo(mockVideoSourcePersistentID(), CaptureDevice::SourceKind::Video, mockVideoSourceName(), "");
</del><ins>+ static NeverDestroyed<CaptureDevice> deviceInfo(mockVideoSourcePersistentID(), CaptureDevice::DeviceType::Video, mockVideoSourceName(), "");
</ins><span class="cx"> return deviceInfo;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (212417 => 212418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-02-16 01:17:57 UTC (rev 212417)
+++ trunk/Source/WebKit2/ChangeLog        2017-02-16 02:01:59 UTC (rev 212418)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2017-02-15 Eric Carlson <eric.carlson@apple.com>
+
+ [MediaStream] delete CaptureDeviceInfo struct
+ https://bugs.webkit.org/show_bug.cgi?id=168395
+
+ Reviewed by Sam Weinig.
+
+ * Shared/WebCoreArgumentCoders.cpp:
+ (IPC::ArgumentCoder<CaptureDevice>::encode):
+ (IPC::ArgumentCoder<CaptureDevice>::decode):
+
</ins><span class="cx"> 2017-02-15 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><span class="cx"> Try again.
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebCoreArgumentCoderscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (212417 => 212418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2017-02-16 01:17:57 UTC (rev 212417)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2017-02-16 02:01:59 UTC (rev 212418)
</span><span class="lines">@@ -2422,7 +2422,8 @@
</span><span class="cx"> encoder << device.persistentId();
</span><span class="cx"> encoder << device.label();
</span><span class="cx"> encoder << device.groupId();
</span><del>- encoder.encodeEnum(device.kind());
</del><ins>+ encoder << device.enabled();
+ encoder.encodeEnum(device.type());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool ArgumentCoder<CaptureDevice>::decode(Decoder& decoder, WebCore::CaptureDevice& device)
</span><span class="lines">@@ -2439,14 +2440,19 @@
</span><span class="cx"> if (!decoder.decode(groupId))
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- CaptureDevice::SourceKind kind;
- if (!decoder.decodeEnum(kind))
</del><ins>+ bool enabled;
+ if (!decoder.decode(enabled))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><ins>+ CaptureDevice::DeviceType type;
+ if (!decoder.decodeEnum(type))
+ return false;
+
</ins><span class="cx"> device.setPersistentId(persistentId);
</span><span class="cx"> device.setLabel(label);
</span><span class="cx"> device.setGroupId(groupId);
</span><del>- device.setKind(kind);
</del><ins>+ device.setType(type);
+ device.setEnabled(enabled);
</ins><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>