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 21 matching lines...) Expand all Loading... | |
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/fake_video_capture_device_factory.h" |
41 #include "media/video/capture/file_video_capture_device_factory.h" | 41 #include "media/video/capture/file_video_capture_device_factory.h" |
42 #include "media/video/capture/video_capture_device_factory.h" | |
42 #include "url/gurl.h" | 43 #include "url/gurl.h" |
43 | 44 |
44 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
45 #include "base/win/scoped_com_initializer.h" | 46 #include "base/win/scoped_com_initializer.h" |
46 #endif | 47 #endif |
47 | 48 |
48 namespace content { | 49 namespace content { |
49 | 50 |
50 // Forward declaration of DeviceMonitorMac and its only useable method. | 51 // Forward declaration of DeviceMonitorMac and its only useable method. |
51 class DeviceMonitorMac { | 52 class DeviceMonitorMac { |
(...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1433 audio_input_device_manager_ = new AudioInputDeviceManager(audio_manager_); | 1434 audio_input_device_manager_ = new AudioInputDeviceManager(audio_manager_); |
1434 audio_input_device_manager_->Register(this, device_task_runner_); | 1435 audio_input_device_manager_->Register(this, device_task_runner_); |
1435 | 1436 |
1436 // We want to be notified of IO message loop destruction to delete the thread | 1437 // We want to be notified of IO message loop destruction to delete the thread |
1437 // and the device managers. | 1438 // and the device managers. |
1438 io_loop_ = base::MessageLoop::current(); | 1439 io_loop_ = base::MessageLoop::current(); |
1439 io_loop_->AddDestructionObserver(this); | 1440 io_loop_->AddDestructionObserver(this); |
1440 | 1441 |
1441 // Use a Fake Audio Device and Fake/File Video Device Factory if the command | 1442 // 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 // line flags are present, otherwise use a normal device factory. |
1443 if (CommandLine::ForCurrentProcess()->HasSwitch( | 1444 if (CommandLine::ForCurrentProcess()->HasSwitch( |
perkj_chrome
2014/05/06 06:44:46
You can move this too into your Create method.- ie
mcasas
2014/05/06 07:26:30
Great idea. Done so, and with it I moved the flag
| |
1444 switches::kUseFakeDeviceForMediaStream)) { | 1445 switches::kUseFakeDeviceForMediaStream)) { |
1445 if (CommandLine::ForCurrentProcess()->HasSwitch( | 1446 if (CommandLine::ForCurrentProcess()->HasSwitch( |
1446 switches::kUseFileForFakeVideoCapture)) { | 1447 switches::kUseFileForFakeVideoCapture)) { |
1447 video_capture_manager_ = new VideoCaptureManager( | 1448 video_capture_manager_ = new VideoCaptureManager( |
1448 scoped_ptr<media::VideoCaptureDeviceFactory>( | 1449 scoped_ptr<media::VideoCaptureDeviceFactory>( |
1449 new media::FileVideoCaptureDeviceFactory())); | 1450 new media::FileVideoCaptureDeviceFactory())); |
1450 } else { | 1451 } else { |
1451 video_capture_manager_ = new VideoCaptureManager( | 1452 video_capture_manager_ = new VideoCaptureManager( |
1452 scoped_ptr<media::VideoCaptureDeviceFactory>( | 1453 scoped_ptr<media::VideoCaptureDeviceFactory>( |
1453 new media::FakeVideoCaptureDeviceFactory())); | 1454 new media::FakeVideoCaptureDeviceFactory())); |
1454 } | 1455 } |
1455 audio_input_device_manager()->UseFakeDevice(); | 1456 audio_input_device_manager()->UseFakeDevice(); |
1456 } else { | 1457 } else { |
1457 video_capture_manager_ = new VideoCaptureManager( | 1458 scoped_ptr<media::VideoCaptureDeviceFactory> video_capture_device_factory = |
1458 scoped_ptr<media::VideoCaptureDeviceFactory>( | 1459 media::VideoCaptureDeviceFactory::Create(); |
1459 new media::VideoCaptureDeviceFactory())); | 1460 video_capture_manager_ = new |
1461 VideoCaptureManager(video_capture_device_factory.Pass()); | |
1460 } | 1462 } |
1461 video_capture_manager_->Register(this, device_task_runner_); | 1463 video_capture_manager_->Register(this, device_task_runner_); |
1462 } | 1464 } |
1463 | 1465 |
1464 void MediaStreamManager::Opened(MediaStreamType stream_type, | 1466 void MediaStreamManager::Opened(MediaStreamType stream_type, |
1465 int capture_session_id) { | 1467 int capture_session_id) { |
1466 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1468 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1467 DVLOG(1) << "Opened({stream_type = " << stream_type << "} " | 1469 DVLOG(1) << "Opened({stream_type = " << stream_type << "} " |
1468 << "{capture_session_id = " << capture_session_id << "})"; | 1470 << "{capture_session_id = " << capture_session_id << "})"; |
1469 // Find the request(s) containing this device and mark it as used. | 1471 // Find the request(s) containing this device and mark it as used. |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1941 if (it->device.type == MEDIA_DESKTOP_VIDEO_CAPTURE) { | 1943 if (it->device.type == MEDIA_DESKTOP_VIDEO_CAPTURE) { |
1942 video_capture_manager_->SetDesktopCaptureWindowId(it->session_id, | 1944 video_capture_manager_->SetDesktopCaptureWindowId(it->session_id, |
1943 window_id); | 1945 window_id); |
1944 break; | 1946 break; |
1945 } | 1947 } |
1946 } | 1948 } |
1947 } | 1949 } |
1948 } | 1950 } |
1949 | 1951 |
1950 } // namespace content | 1952 } // namespace content |
OLD | NEW |