| 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 15 matching lines...) Expand all Loading... |
| 26 #include "base/threading/thread.h" | 26 #include "base/threading/thread.h" |
| 27 #include "base/threading/thread_local.h" | 27 #include "base/threading/thread_local.h" |
| 28 #include "build/build_config.h" | 28 #include "build/build_config.h" |
| 29 #include "content/browser/child_process_security_policy_impl.h" | 29 #include "content/browser/child_process_security_policy_impl.h" |
| 30 #include "content/browser/renderer_host/media/audio_input_device_manager.h" | 30 #include "content/browser/renderer_host/media/audio_input_device_manager.h" |
| 31 #include "content/browser/renderer_host/media/in_process_video_capture_provider.
h" | 31 #include "content/browser/renderer_host/media/in_process_video_capture_provider.
h" |
| 32 #include "content/browser/renderer_host/media/media_capture_devices_impl.h" | 32 #include "content/browser/renderer_host/media/media_capture_devices_impl.h" |
| 33 #include "content/browser/renderer_host/media/media_devices_manager.h" | 33 #include "content/browser/renderer_host/media/media_devices_manager.h" |
| 34 #include "content/browser/renderer_host/media/media_stream_requester.h" | 34 #include "content/browser/renderer_host/media/media_stream_requester.h" |
| 35 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" | 35 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" |
| 36 #include "content/browser/renderer_host/media/service_video_capture_provider.h" | |
| 37 #include "content/browser/renderer_host/media/video_capture_manager.h" | 36 #include "content/browser/renderer_host/media/video_capture_manager.h" |
| 38 #include "content/browser/renderer_host/media/video_capture_provider_switcher.h" | |
| 39 #include "content/browser/renderer_host/render_process_host_impl.h" | 37 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 40 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
| 41 #include "content/public/browser/content_browser_client.h" | 39 #include "content/public/browser/content_browser_client.h" |
| 42 #include "content/public/browser/desktop_media_id.h" | 40 #include "content/public/browser/desktop_media_id.h" |
| 43 #include "content/public/browser/media_observer.h" | 41 #include "content/public/browser/media_observer.h" |
| 44 #include "content/public/browser/render_process_host.h" | 42 #include "content/public/browser/render_process_host.h" |
| 45 #include "content/public/browser/web_contents_media_capture_id.h" | 43 #include "content/public/browser/web_contents_media_capture_id.h" |
| 46 #include "content/public/common/content_client.h" | 44 #include "content/public/common/content_client.h" |
| 47 #include "content/public/common/content_switches.h" | 45 #include "content/public/common/content_switches.h" |
| 48 #include "content/public/common/media_stream_request.h" | 46 #include "content/public/common/media_stream_request.h" |
| 49 #include "crypto/hmac.h" | 47 #include "crypto/hmac.h" |
| 50 #include "media/audio/audio_device_description.h" | 48 #include "media/audio/audio_device_description.h" |
| 51 #include "media/audio/audio_system.h" | 49 #include "media/audio/audio_system.h" |
| 52 #include "media/base/audio_parameters.h" | 50 #include "media/base/audio_parameters.h" |
| 53 #include "media/base/channel_layout.h" | 51 #include "media/base/channel_layout.h" |
| 54 #include "media/base/media_switches.h" | 52 #include "media/base/media_switches.h" |
| 55 #include "media/capture/video/video_capture_device_factory.h" | 53 #include "media/capture/video/video_capture_device_factory.h" |
| 56 #include "media/capture/video/video_capture_system_impl.h" | 54 #include "media/capture/video/video_capture_system_impl.h" |
| 57 #include "services/video_capture/public/cpp/constants.h" | |
| 58 #include "url/gurl.h" | 55 #include "url/gurl.h" |
| 59 #include "url/origin.h" | 56 #include "url/origin.h" |
| 60 | 57 |
| 61 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
| 62 #include "base/win/scoped_com_initializer.h" | 59 #include "base/win/scoped_com_initializer.h" |
| 63 #endif | 60 #endif |
| 64 | 61 |
| 65 #if defined(OS_CHROMEOS) | 62 #if defined(OS_CHROMEOS) |
| 66 #include "chromeos/audio/cras_audio_handler.h" | 63 #include "chromeos/audio/cras_audio_handler.h" |
| 67 #endif | 64 #endif |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 // buggy third party Direct Show modules, http://crbug.com/428958. | 417 // buggy third party Direct Show modules, http://crbug.com/428958. |
| 421 video_capture_thread_.init_com_with_mta(false); | 418 video_capture_thread_.init_com_with_mta(false); |
| 422 CHECK(video_capture_thread_.Start()); | 419 CHECK(video_capture_thread_.Start()); |
| 423 device_task_runner = video_capture_thread_.task_runner(); | 420 device_task_runner = video_capture_thread_.task_runner(); |
| 424 #endif | 421 #endif |
| 425 video_capture_provider = base::MakeUnique<InProcessVideoCaptureProvider>( | 422 video_capture_provider = base::MakeUnique<InProcessVideoCaptureProvider>( |
| 426 base::MakeUnique<media::VideoCaptureSystemImpl>( | 423 base::MakeUnique<media::VideoCaptureSystemImpl>( |
| 427 media::VideoCaptureDeviceFactory::CreateFactory( | 424 media::VideoCaptureDeviceFactory::CreateFactory( |
| 428 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))), | 425 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))), |
| 429 std::move(device_task_runner)); | 426 std::move(device_task_runner)); |
| 430 if (base::FeatureList::IsEnabled(video_capture::kMojoVideoCapture)) { | |
| 431 video_capture_provider = base::MakeUnique<VideoCaptureProviderSwitcher>( | |
| 432 base::MakeUnique<ServiceVideoCaptureProvider>(), | |
| 433 std::move(video_capture_provider)); | |
| 434 } | |
| 435 } | 427 } |
| 436 InitializeMaybeAsync(std::move(video_capture_provider)); | 428 InitializeMaybeAsync(std::move(video_capture_provider)); |
| 437 | 429 |
| 438 base::PowerMonitor* power_monitor = base::PowerMonitor::Get(); | 430 base::PowerMonitor* power_monitor = base::PowerMonitor::Get(); |
| 439 // BrowserMainLoop always creates the PowerMonitor instance before creating | 431 // BrowserMainLoop always creates the PowerMonitor instance before creating |
| 440 // MediaStreamManager, but power_monitor may be NULL in unit tests. | 432 // MediaStreamManager, but power_monitor may be NULL in unit tests. |
| 441 if (power_monitor) | 433 if (power_monitor) |
| 442 power_monitor->AddObserver(this); | 434 power_monitor->AddObserver(this); |
| 443 } | 435 } |
| 444 | 436 |
| (...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 request->ui_proxy->OnStarted( | 1778 request->ui_proxy->OnStarted( |
| 1787 base::BindOnce(&MediaStreamManager::StopMediaStreamFromBrowser, | 1779 base::BindOnce(&MediaStreamManager::StopMediaStreamFromBrowser, |
| 1788 base::Unretained(this), label), | 1780 base::Unretained(this), label), |
| 1789 base::BindOnce(&MediaStreamManager::OnMediaStreamUIWindowId, | 1781 base::BindOnce(&MediaStreamManager::OnMediaStreamUIWindowId, |
| 1790 base::Unretained(this), request->video_type(), | 1782 base::Unretained(this), request->video_type(), |
| 1791 request->devices)); | 1783 request->devices)); |
| 1792 } | 1784 } |
| 1793 } | 1785 } |
| 1794 | 1786 |
| 1795 } // namespace content | 1787 } // namespace content |
| OLD | NEW |