| 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 19 matching lines...) Expand all Loading... |
| 30 #include "content/public/browser/media_device_id.h" | 30 #include "content/public/browser/media_device_id.h" |
| 31 #include "content/public/browser/media_observer.h" | 31 #include "content/public/browser/media_observer.h" |
| 32 #include "content/public/browser/media_request_state.h" | 32 #include "content/public/browser/media_request_state.h" |
| 33 #include "content/public/browser/render_process_host.h" | 33 #include "content/public/browser/render_process_host.h" |
| 34 #include "content/public/common/content_switches.h" | 34 #include "content/public/common/content_switches.h" |
| 35 #include "content/public/common/media_stream_request.h" | 35 #include "content/public/common/media_stream_request.h" |
| 36 #include "media/audio/audio_manager_base.h" | 36 #include "media/audio/audio_manager_base.h" |
| 37 #include "media/audio/audio_parameters.h" | 37 #include "media/audio/audio_parameters.h" |
| 38 #include "media/base/channel_layout.h" | 38 #include "media/base/channel_layout.h" |
| 39 #include "media/base/media_switches.h" | 39 #include "media/base/media_switches.h" |
| 40 #include "media/video/capture/video_capture_device_factory.h" | 40 #include "media/video/capture/fake_video_capture_device_factory.h" |
| 41 #include "media/video/capture/file_video_capture_device_factory.h" |
| 41 #include "url/gurl.h" | 42 #include "url/gurl.h" |
| 42 | 43 |
| 43 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
| 44 #include "base/win/scoped_com_initializer.h" | 45 #include "base/win/scoped_com_initializer.h" |
| 45 #endif | 46 #endif |
| 46 | 47 |
| 47 namespace content { | 48 namespace content { |
| 48 | 49 |
| 49 // Forward declaration of DeviceMonitorMac and its only useable method. | 50 // Forward declaration of DeviceMonitorMac and its only useable method. |
| 50 class DeviceMonitorMac { | 51 class DeviceMonitorMac { |
| (...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 device_task_runner_ = audio_manager_->GetWorkerTaskRunner(); | 1431 device_task_runner_ = audio_manager_->GetWorkerTaskRunner(); |
| 1431 | 1432 |
| 1432 audio_input_device_manager_ = new AudioInputDeviceManager(audio_manager_); | 1433 audio_input_device_manager_ = new AudioInputDeviceManager(audio_manager_); |
| 1433 audio_input_device_manager_->Register(this, device_task_runner_); | 1434 audio_input_device_manager_->Register(this, device_task_runner_); |
| 1434 | 1435 |
| 1435 // We want to be notified of IO message loop destruction to delete the thread | 1436 // We want to be notified of IO message loop destruction to delete the thread |
| 1436 // and the device managers. | 1437 // and the device managers. |
| 1437 io_loop_ = base::MessageLoop::current(); | 1438 io_loop_ = base::MessageLoop::current(); |
| 1438 io_loop_->AddDestructionObserver(this); | 1439 io_loop_->AddDestructionObserver(this); |
| 1439 | 1440 |
| 1441 // Use a Fake Audio Device and Fake/File Video Device Factory if the command |
| 1442 // line flags are present, otherwise use a normal device factory. |
| 1440 if (CommandLine::ForCurrentProcess()->HasSwitch( | 1443 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 1441 switches::kUseFakeDeviceForMediaStream)) { | 1444 switches::kUseFakeDeviceForMediaStream)) { |
| 1445 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 1446 switches::kUseFileForFakeVideoCapture)) { |
| 1447 video_capture_manager_ = new VideoCaptureManager( |
| 1448 scoped_ptr<media::VideoCaptureDeviceFactory>( |
| 1449 new media::FileVideoCaptureDeviceFactory())); |
| 1450 } else { |
| 1451 video_capture_manager_ = new VideoCaptureManager( |
| 1452 scoped_ptr<media::VideoCaptureDeviceFactory>( |
| 1453 new media::FakeVideoCaptureDeviceFactory())); |
| 1454 } |
| 1442 audio_input_device_manager()->UseFakeDevice(); | 1455 audio_input_device_manager()->UseFakeDevice(); |
| 1456 } else { |
| 1457 video_capture_manager_ = new VideoCaptureManager( |
| 1458 scoped_ptr<media::VideoCaptureDeviceFactory>( |
| 1459 new media::VideoCaptureDeviceFactory())); |
| 1443 } | 1460 } |
| 1444 | |
| 1445 video_capture_manager_ = new VideoCaptureManager( | |
| 1446 media::VideoCaptureDeviceFactory::CreateFactory()); | |
| 1447 video_capture_manager_->Register(this, device_task_runner_); | 1461 video_capture_manager_->Register(this, device_task_runner_); |
| 1448 } | 1462 } |
| 1449 | 1463 |
| 1450 void MediaStreamManager::Opened(MediaStreamType stream_type, | 1464 void MediaStreamManager::Opened(MediaStreamType stream_type, |
| 1451 int capture_session_id) { | 1465 int capture_session_id) { |
| 1452 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1466 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 1453 DVLOG(1) << "Opened({stream_type = " << stream_type << "} " | 1467 DVLOG(1) << "Opened({stream_type = " << stream_type << "} " |
| 1454 << "{capture_session_id = " << capture_session_id << "})"; | 1468 << "{capture_session_id = " << capture_session_id << "})"; |
| 1455 // Find the request(s) containing this device and mark it as used. | 1469 // Find the request(s) containing this device and mark it as used. |
| 1456 // It can be used in several requests since the same device can be | 1470 // It can be used in several requests since the same device can be |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1927 if (it->device.type == MEDIA_DESKTOP_VIDEO_CAPTURE) { | 1941 if (it->device.type == MEDIA_DESKTOP_VIDEO_CAPTURE) { |
| 1928 video_capture_manager_->SetDesktopCaptureWindowId(it->session_id, | 1942 video_capture_manager_->SetDesktopCaptureWindowId(it->session_id, |
| 1929 window_id); | 1943 window_id); |
| 1930 break; | 1944 break; |
| 1931 } | 1945 } |
| 1932 } | 1946 } |
| 1933 } | 1947 } |
| 1934 } | 1948 } |
| 1935 | 1949 |
| 1936 } // namespace content | 1950 } // namespace content |
| OLD | NEW |