OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/media/media_stream_dispatcher.h" | 5 #include "content/renderer/media/media_stream_dispatcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "content/common/media/media_stream_messages.h" | 10 #include "content/common/media/media_stream_messages.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 Send(new MediaStreamHostMsg_CloseDevice(routing_id(), label)); | 168 Send(new MediaStreamHostMsg_CloseDevice(routing_id(), label)); |
169 } | 169 } |
170 | 170 |
171 void MediaStreamDispatcher::OnStreamStarted(const std::string& label) { | 171 void MediaStreamDispatcher::OnStreamStarted(const std::string& label) { |
172 DCHECK(thread_checker_.CalledOnValidThread()); | 172 DCHECK(thread_checker_.CalledOnValidThread()); |
173 DVLOG(1) << "MediaStreamDispatcher::OnStreamStarted(" << label << ")"; | 173 DVLOG(1) << "MediaStreamDispatcher::OnStreamStarted(" << label << ")"; |
174 | 174 |
175 Send(new MediaStreamHostMsg_StreamStarted(label)); | 175 Send(new MediaStreamHostMsg_StreamStarted(label)); |
176 } | 176 } |
177 | 177 |
178 void MediaStreamDispatcher::GetVideoCaptureDevices( | |
179 StreamDeviceInfoArray& video_array) { | |
tommi (sloooow) - chröme
2017/03/21 09:21:17
see comment in header for style issue
braveyao
2017/03/22 00:45:32
Done.
| |
180 for (const auto& stream_it : label_stream_map_) { | |
181 for (const auto& device_it : stream_it.second.video_array) { | |
tommi (sloooow) - chröme
2017/03/21 09:21:17
|device_it| is misleading, since the variable is n
braveyao
2017/03/22 00:45:32
Done.
| |
182 if (device_it.device.type == MEDIA_DEVICE_VIDEO_CAPTURE) | |
183 video_array.push_back(device_it); | |
184 } | |
185 } | |
186 } | |
187 | |
178 void MediaStreamDispatcher::OnDestruct() { | 188 void MediaStreamDispatcher::OnDestruct() { |
179 // Do not self-destruct. UserMediaClientImpl owns |this|. | 189 // Do not self-destruct. UserMediaClientImpl owns |this|. |
180 } | 190 } |
181 | 191 |
182 bool MediaStreamDispatcher::Send(IPC::Message* message) { | 192 bool MediaStreamDispatcher::Send(IPC::Message* message) { |
183 if (!RenderThread::Get()) { | 193 if (!RenderThread::Get()) { |
184 delete message; | 194 delete message; |
185 return false; | 195 return false; |
186 } | 196 } |
187 | 197 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 DCHECK(thread_checker_.CalledOnValidThread()); | 367 DCHECK(thread_checker_.CalledOnValidThread()); |
358 LabelStreamMap::iterator it = label_stream_map_.find(label); | 368 LabelStreamMap::iterator it = label_stream_map_.find(label); |
359 if (it == label_stream_map_.end() || | 369 if (it == label_stream_map_.end() || |
360 it->second.video_array.size() <= static_cast<size_t>(index)) { | 370 it->second.video_array.size() <= static_cast<size_t>(index)) { |
361 return StreamDeviceInfo::kNoId; | 371 return StreamDeviceInfo::kNoId; |
362 } | 372 } |
363 return it->second.video_array[index].session_id; | 373 return it->second.video_array[index].session_id; |
364 } | 374 } |
365 | 375 |
366 } // namespace content | 376 } // namespace content |
OLD | NEW |