OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/media/media_stream_device_settings.h" | 5 #include "content/browser/renderer_host/media/media_stream_device_settings.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/task.h" | 8 #include "base/task.h" |
9 #include "content/browser/renderer_host/media/media_stream_settings_requester.h" | 9 #include "content/browser/renderer_host/media/media_stream_settings_requester.h" |
10 #include "content/common/media/media_stream_options.h" | 10 #include "content/common/media/media_stream_options.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 for (DeviceMap::iterator it = request->devices.begin(); | 117 for (DeviceMap::iterator it = request->devices.begin(); |
118 it != request->devices.end(); ++it) { | 118 it != request->devices.end(); ++it) { |
119 for (StreamDeviceInfoArray::iterator device_it = it->second.begin(); | 119 for (StreamDeviceInfoArray::iterator device_it = it->second.begin(); |
120 device_it != it->second.end(); ++device_it) { | 120 device_it != it->second.end(); ++device_it) { |
121 if (!device_it->in_use) { | 121 if (!device_it->in_use) { |
122 devices_to_use.push_back(*device_it); | 122 devices_to_use.push_back(*device_it); |
123 break; | 123 break; |
124 } | 124 } |
125 } | 125 } |
126 } | 126 } |
127 if (num_media_requests != devices_to_use.size()) { | 127 if (!request->devices[kVideoCapture].empty() && |
| 128 num_media_requests != devices_to_use.size()) { |
128 // Not all requested device types were opened. This happens if all | 129 // Not all requested device types were opened. This happens if all |
129 // video capture devices are already opened, |in_use| isn't set for | 130 // video capture devices are already opened, |in_use| isn't set for |
130 // audio devices. Allow the first video capture device in the list to be | 131 // audio devices. Allow the first video capture device in the list to be |
131 // opened for this user too. | 132 // opened for this user too. |
132 DCHECK_NE(request->options.video_option, StreamOptions::kNoCamera); | |
133 StreamDeviceInfoArray device_array = (request->devices[kVideoCapture]); | 133 StreamDeviceInfoArray device_array = (request->devices[kVideoCapture]); |
134 devices_to_use.push_back(*(device_array.begin())); | 134 devices_to_use.push_back(*(device_array.begin())); |
135 } | 135 } |
136 | 136 |
137 // Post result and delete request. | 137 // Post result and delete request. |
138 requester_->DevicesAccepted(label, devices_to_use); | 138 requester_->DevicesAccepted(label, devices_to_use); |
139 requests_.erase(request_it); | 139 requests_.erase(request_it); |
140 delete request; | 140 delete request; |
141 } | 141 } |
142 } | 142 } |
143 } | 143 } |
144 | 144 |
145 void MediaStreamDeviceSettings::UseFakeUI() { | 145 void MediaStreamDeviceSettings::UseFakeUI() { |
146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
147 use_fake_ui_ = true; | 147 use_fake_ui_ = true; |
148 } | 148 } |
149 | 149 |
150 } // namespace media_stream | 150 } // namespace media_stream |
OLD | NEW |