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 StreamDeviceInfoArray MediaStreamDispatcher::GetNonScreenCaptureDevices() { |
| 179 StreamDeviceInfoArray video_array; |
| 180 for (const auto& stream_it : label_stream_map_) { |
| 181 for (const auto& video_device : stream_it.second.video_array) { |
| 182 if (!IsScreenCaptureMediaType(video_device.device.type)) |
| 183 video_array.push_back(video_device); |
| 184 } |
| 185 } |
| 186 return video_array; |
| 187 } |
| 188 |
178 void MediaStreamDispatcher::OnDestruct() { | 189 void MediaStreamDispatcher::OnDestruct() { |
179 // Do not self-destruct. UserMediaClientImpl owns |this|. | 190 // Do not self-destruct. UserMediaClientImpl owns |this|. |
180 } | 191 } |
181 | 192 |
182 bool MediaStreamDispatcher::Send(IPC::Message* message) { | 193 bool MediaStreamDispatcher::Send(IPC::Message* message) { |
183 if (!RenderThread::Get()) { | 194 if (!RenderThread::Get()) { |
184 delete message; | 195 delete message; |
185 return false; | 196 return false; |
186 } | 197 } |
187 | 198 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 DCHECK(thread_checker_.CalledOnValidThread()); | 368 DCHECK(thread_checker_.CalledOnValidThread()); |
358 LabelStreamMap::iterator it = label_stream_map_.find(label); | 369 LabelStreamMap::iterator it = label_stream_map_.find(label); |
359 if (it == label_stream_map_.end() || | 370 if (it == label_stream_map_.end() || |
360 it->second.video_array.size() <= static_cast<size_t>(index)) { | 371 it->second.video_array.size() <= static_cast<size_t>(index)) { |
361 return StreamDeviceInfo::kNoId; | 372 return StreamDeviceInfo::kNoId; |
362 } | 373 } |
363 return it->second.video_array[index].session_id; | 374 return it->second.video_array[index].session_id; |
364 } | 375 } |
365 | 376 |
366 } // namespace content | 377 } // namespace content |
OLD | NEW |