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