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/browser/renderer_host/media/media_stream_manager.h" | 5 #include "content/browser/renderer_host/media/media_stream_manager.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // It can be null if the requester has no interest to know the result. | 143 // It can be null if the requester has no interest to know the result. |
144 // Currently it is only used by |DEVICE_ACCESS| type. | 144 // Currently it is only used by |DEVICE_ACCESS| type. |
145 MediaStreamManager::MediaRequestResponseCallback callback; | 145 MediaStreamManager::MediaRequestResponseCallback callback; |
146 | 146 |
147 scoped_ptr<MediaStreamUIProxy> ui_proxy; | 147 scoped_ptr<MediaStreamUIProxy> ui_proxy; |
148 | 148 |
149 private: | 149 private: |
150 std::vector<MediaRequestState> state_; | 150 std::vector<MediaRequestState> state_; |
151 }; | 151 }; |
152 | 152 |
| 153 |
153 MediaStreamManager::EnumerationCache::EnumerationCache() | 154 MediaStreamManager::EnumerationCache::EnumerationCache() |
154 : valid(false) { | 155 : valid(false) { |
155 } | 156 } |
156 | 157 |
157 MediaStreamManager::EnumerationCache::~EnumerationCache() { | 158 MediaStreamManager::EnumerationCache::~EnumerationCache() { |
158 } | 159 } |
159 | 160 |
160 MediaStreamManager::MediaStreamManager() | 161 MediaStreamManager::MediaStreamManager() |
161 : audio_manager_(NULL), | 162 : audio_manager_(NULL), |
162 monitoring_started_(false), | 163 monitoring_started_(false), |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 MediaStreamRequester* requester, | 408 MediaStreamRequester* requester, |
408 int render_process_id, | 409 int render_process_id, |
409 int render_view_id, | 410 int render_view_id, |
410 ResourceContext* rc, | 411 ResourceContext* rc, |
411 int page_request_id, | 412 int page_request_id, |
412 MediaStreamType type, | 413 MediaStreamType type, |
413 const GURL& security_origin) { | 414 const GURL& security_origin) { |
414 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 415 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
415 DCHECK(type == MEDIA_DEVICE_AUDIO_CAPTURE || | 416 DCHECK(type == MEDIA_DEVICE_AUDIO_CAPTURE || |
416 type == MEDIA_DEVICE_VIDEO_CAPTURE); | 417 type == MEDIA_DEVICE_VIDEO_CAPTURE); |
417 | 418 DCHECK(requester); |
418 // When the requester is NULL, the request is made by the UI to ensure MSM | |
419 // starts monitoring devices. | |
420 if (!requester) { | |
421 if (!monitoring_started_) | |
422 StartMonitoring(); | |
423 | |
424 return std::string(); | |
425 } | |
426 | 419 |
427 // Create a new request. | 420 // Create a new request. |
428 StreamOptions options; | 421 StreamOptions options; |
429 if (type == MEDIA_DEVICE_AUDIO_CAPTURE) { | 422 if (type == MEDIA_DEVICE_AUDIO_CAPTURE) { |
430 options.audio_type = type; | 423 options.audio_type = type; |
431 } else if (type == MEDIA_DEVICE_VIDEO_CAPTURE) { | 424 } else if (type == MEDIA_DEVICE_VIDEO_CAPTURE) { |
432 options.video_type = type; | 425 options.video_type = type; |
433 } else { | 426 } else { |
434 NOTREACHED(); | 427 NOTREACHED(); |
435 return std::string(); | 428 return std::string(); |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1337 } | 1330 } |
1338 | 1331 |
1339 // Always do enumeration even though some enumeration is in progress, | 1332 // Always do enumeration even though some enumeration is in progress, |
1340 // because those enumeration commands could be sent before these devices | 1333 // because those enumeration commands could be sent before these devices |
1341 // change. | 1334 // change. |
1342 ++active_enumeration_ref_count_[stream_type]; | 1335 ++active_enumeration_ref_count_[stream_type]; |
1343 GetDeviceManager(stream_type)->EnumerateDevices(stream_type); | 1336 GetDeviceManager(stream_type)->EnumerateDevices(stream_type); |
1344 } | 1337 } |
1345 | 1338 |
1346 } // namespace content | 1339 } // namespace content |
OLD | NEW |