| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/common/media/media_stream_messages.h" | 8 #include "content/common/media/media_stream_messages.h" |
| 9 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h" | 9 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h" |
| 10 #include "content/renderer/render_view_impl.h" | 10 #include "content/renderer/render_view_impl.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 void MediaStreamDispatcher::OnDeviceOpened( | 226 void MediaStreamDispatcher::OnDeviceOpened( |
| 227 int request_id, | 227 int request_id, |
| 228 const std::string& label, | 228 const std::string& label, |
| 229 const media_stream::StreamDeviceInfo& device_info) { | 229 const media_stream::StreamDeviceInfo& device_info) { |
| 230 for (RequestList::iterator it = requests_.begin(); | 230 for (RequestList::iterator it = requests_.begin(); |
| 231 it != requests_.end(); ++it) { | 231 it != requests_.end(); ++it) { |
| 232 Request& request = *it; | 232 Request& request = *it; |
| 233 if (request.ipc_request == request_id) { | 233 if (request.ipc_request == request_id) { |
| 234 Stream new_stream; | 234 Stream new_stream; |
| 235 new_stream.handler = request.handler; | 235 new_stream.handler = request.handler; |
| 236 new_stream.video_array.push_back(device_info); | 236 if (device_info.stream_type == |
| 237 content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE) { |
| 238 new_stream.video_array.push_back(device_info); |
| 239 } else { |
| 240 new_stream.audio_array.push_back(device_info); |
| 241 } |
| 237 label_stream_map_[label] = new_stream; | 242 label_stream_map_[label] = new_stream; |
| 238 request.handler->OnDeviceOpened(request.request_id, label, | 243 request.handler->OnDeviceOpened(request.request_id, label, |
| 239 device_info); | 244 device_info); |
| 240 DVLOG(1) << "MediaStreamDispatcher::OnDeviceOpened(" | 245 DVLOG(1) << "MediaStreamDispatcher::OnDeviceOpened(" |
| 241 << request.request_id << ", " << label << ")"; | 246 << request.request_id << ", " << label << ")"; |
| 242 requests_.erase(it); | 247 requests_.erase(it); |
| 243 break; | 248 break; |
| 244 } | 249 } |
| 245 } | 250 } |
| 246 } | 251 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 275 | 280 |
| 276 int MediaStreamDispatcher::video_session_id(const std::string& label, | 281 int MediaStreamDispatcher::video_session_id(const std::string& label, |
| 277 int index) { | 282 int index) { |
| 278 LabelStreamMap::iterator it = label_stream_map_.find(label); | 283 LabelStreamMap::iterator it = label_stream_map_.find(label); |
| 279 if (it == label_stream_map_.end()) | 284 if (it == label_stream_map_.end()) |
| 280 return media_stream::StreamDeviceInfo::kNoId; | 285 return media_stream::StreamDeviceInfo::kNoId; |
| 281 | 286 |
| 282 DCHECK_GT(it->second.video_array.size(), static_cast<size_t>(index)); | 287 DCHECK_GT(it->second.video_array.size(), static_cast<size_t>(index)); |
| 283 return it->second.video_array[index].session_id; | 288 return it->second.video_array[index].session_id; |
| 284 } | 289 } |
| OLD | NEW |