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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 | 396 |
397 MediaStreamManager* msm = g_media_stream_manager_tls_ptr.Pointer()->Get(); | 397 MediaStreamManager* msm = g_media_stream_manager_tls_ptr.Pointer()->Get(); |
398 if (!msm) { | 398 if (!msm) { |
399 DLOG(ERROR) << "No MediaStreamManager on the IO thread. " << message; | 399 DLOG(ERROR) << "No MediaStreamManager on the IO thread. " << message; |
400 return; | 400 return; |
401 } | 401 } |
402 | 402 |
403 msm->AddLogMessageOnIOThread(message); | 403 msm->AddLogMessageOnIOThread(message); |
404 } | 404 } |
405 | 405 |
406 MediaStreamManager::MediaStreamManager(media::AudioManager* audio_manager) | 406 MediaStreamManager::MediaStreamManager(media::AudioManager* audio_manager, |
| 407 component::VideoCaptureObserver* capture_
observer) |
407 : audio_manager_(audio_manager), | 408 : audio_manager_(audio_manager), |
| 409 capture_observer_(capture_observer), |
408 #if defined(OS_WIN) | 410 #if defined(OS_WIN) |
409 video_capture_thread_("VideoCaptureThread"), | 411 video_capture_thread_("VideoCaptureThread"), |
410 #endif | 412 #endif |
411 use_fake_ui_(base::CommandLine::ForCurrentProcess()->HasSwitch( | 413 use_fake_ui_(base::CommandLine::ForCurrentProcess()->HasSwitch( |
412 switches::kUseFakeUIForMediaStream)) { | 414 switches::kUseFakeUIForMediaStream)) { |
413 DCHECK(audio_manager_); | 415 DCHECK(audio_manager_); |
414 | 416 |
415 // Some unit tests create the MSM in the IO thread and assumes the | 417 // Some unit tests create the MSM in the IO thread and assumes the |
416 // initialization is done synchronously. | 418 // initialization is done synchronously. |
417 if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 419 if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 // and the device managers. | 1252 // and the device managers. |
1251 base::MessageLoop::current()->AddDestructionObserver(this); | 1253 base::MessageLoop::current()->AddDestructionObserver(this); |
1252 | 1254 |
1253 // TODO(dalecurtis): Remove ScopedTracker below once crbug.com/457525 is | 1255 // TODO(dalecurtis): Remove ScopedTracker below once crbug.com/457525 is |
1254 // fixed. | 1256 // fixed. |
1255 tracked_objects::ScopedTracker tracking_profile4( | 1257 tracked_objects::ScopedTracker tracking_profile4( |
1256 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 1258 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
1257 "457525 MediaStreamManager::InitializeDeviceManagersOnIOThread 4")); | 1259 "457525 MediaStreamManager::InitializeDeviceManagersOnIOThread 4")); |
1258 video_capture_manager_ = | 1260 video_capture_manager_ = |
1259 new VideoCaptureManager(media::VideoCaptureDeviceFactory::CreateFactory( | 1261 new VideoCaptureManager(media::VideoCaptureDeviceFactory::CreateFactory( |
1260 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))); | 1262 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)), |
| 1263 capture_observer_); |
1261 #if defined(OS_WIN) | 1264 #if defined(OS_WIN) |
1262 // Use an STA Video Capture Thread to try to avoid crashes on enumeration of | 1265 // Use an STA Video Capture Thread to try to avoid crashes on enumeration of |
1263 // buggy third party Direct Show modules, http://crbug.com/428958. | 1266 // buggy third party Direct Show modules, http://crbug.com/428958. |
1264 video_capture_thread_.init_com_with_mta(false); | 1267 video_capture_thread_.init_com_with_mta(false); |
1265 CHECK(video_capture_thread_.Start()); | 1268 CHECK(video_capture_thread_.Start()); |
1266 video_capture_manager_->Register(this, video_capture_thread_.task_runner()); | 1269 video_capture_manager_->Register(this, video_capture_thread_.task_runner()); |
1267 #else | 1270 #else |
1268 video_capture_manager_->Register(this, device_task_runner_); | 1271 video_capture_manager_->Register(this, device_task_runner_); |
1269 #endif | 1272 #endif |
1270 | 1273 |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 generate_stream_test_callback_ = test_callback; | 1746 generate_stream_test_callback_ = test_callback; |
1744 } | 1747 } |
1745 | 1748 |
1746 #if defined(OS_WIN) | 1749 #if defined(OS_WIN) |
1747 void MediaStreamManager::FlushVideoCaptureThreadForTesting() { | 1750 void MediaStreamManager::FlushVideoCaptureThreadForTesting() { |
1748 video_capture_thread_.FlushForTesting(); | 1751 video_capture_thread_.FlushForTesting(); |
1749 } | 1752 } |
1750 #endif | 1753 #endif |
1751 | 1754 |
1752 } // namespace content | 1755 } // namespace content |
OLD | NEW |