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 // MediaStreamManager is used to open media capture devices (video supported | 5 // MediaStreamManager is used to open media capture devices (video supported |
6 // now). Call flow: | 6 // now). Call flow: |
7 // 1. GenerateStream is called when a render process wants to use a capture | 7 // 1. GenerateStream is called when a render process wants to use a capture |
8 // device. | 8 // device. |
9 // 2. MediaStreamManager will ask MediaStreamUIController for permission to | 9 // 2. MediaStreamManager will ask MediaStreamUIController for permission to |
10 // use devices and for which device to use. | 10 // use devices and for which device to use. |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include <string> | 32 #include <string> |
33 #include <utility> | 33 #include <utility> |
34 #include <vector> | 34 #include <vector> |
35 | 35 |
36 #include "base/macros.h" | 36 #include "base/macros.h" |
37 #include "base/memory/ref_counted.h" | 37 #include "base/memory/ref_counted.h" |
38 #include "base/message_loop/message_loop.h" | 38 #include "base/message_loop/message_loop.h" |
39 #include "base/power_monitor/power_observer.h" | 39 #include "base/power_monitor/power_observer.h" |
40 #include "base/threading/thread.h" | 40 #include "base/threading/thread.h" |
41 #include "build/build_config.h" | 41 #include "build/build_config.h" |
| 42 #include "component/arc/video_facing.h" |
42 #include "content/browser/renderer_host/media/media_devices_manager.h" | 43 #include "content/browser/renderer_host/media/media_devices_manager.h" |
43 #include "content/browser/renderer_host/media/media_stream_provider.h" | 44 #include "content/browser/renderer_host/media/media_stream_provider.h" |
44 #include "content/common/content_export.h" | 45 #include "content/common/content_export.h" |
45 #include "content/common/media/media_devices.h" | 46 #include "content/common/media/media_devices.h" |
46 #include "content/common/media/media_stream_options.h" | 47 #include "content/common/media/media_stream_options.h" |
47 #include "content/public/browser/media_request_state.h" | 48 #include "content/public/browser/media_request_state.h" |
48 | 49 |
49 namespace media { | 50 namespace media { |
50 class AudioManager; | 51 class AudioManager; |
51 } | 52 } |
(...skipping 25 matching lines...) Expand all Loading... |
77 | 78 |
78 // Callback for testing. | 79 // Callback for testing. |
79 typedef base::Callback<bool(const StreamControls&)> | 80 typedef base::Callback<bool(const StreamControls&)> |
80 GenerateStreamTestCallback; | 81 GenerateStreamTestCallback; |
81 | 82 |
82 // Adds |message| to native logs for outstanding device requests, for use by | 83 // Adds |message| to native logs for outstanding device requests, for use by |
83 // render processes hosts whose corresponding render processes are requesting | 84 // render processes hosts whose corresponding render processes are requesting |
84 // logging from webrtcLoggingPrivate API. Safe to call from any thread. | 85 // logging from webrtcLoggingPrivate API. Safe to call from any thread. |
85 static void SendMessageToNativeLog(const std::string& message); | 86 static void SendMessageToNativeLog(const std::string& message); |
86 | 87 |
87 explicit MediaStreamManager(media::AudioManager* audio_manager); | 88 explicit MediaStreamManager(media::AudioManager* audio_manager, |
| 89 component::VideoCaptureObserver* capture_observer)
; |
88 | 90 |
89 ~MediaStreamManager() override; | 91 ~MediaStreamManager() override; |
90 | 92 |
91 // Used to access VideoCaptureManager. | 93 // Used to access VideoCaptureManager. |
92 VideoCaptureManager* video_capture_manager(); | 94 VideoCaptureManager* video_capture_manager(); |
93 | 95 |
94 // Used to access AudioInputDeviceManager. | 96 // Used to access AudioInputDeviceManager. |
95 AudioInputDeviceManager* audio_input_device_manager(); | 97 AudioInputDeviceManager* audio_input_device_manager(); |
96 | 98 |
97 // Used to access MediaDevicesManager. | 99 // Used to access MediaDevicesManager. |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 const std::string& label, | 384 const std::string& label, |
383 const MediaDeviceEnumeration& enumeration); | 385 const MediaDeviceEnumeration& enumeration); |
384 | 386 |
385 // Task runner shared by VideoCaptureManager and AudioInputDeviceManager and | 387 // Task runner shared by VideoCaptureManager and AudioInputDeviceManager and |
386 // used for enumerating audio output devices. | 388 // used for enumerating audio output devices. |
387 // Note: Enumeration tasks may take seconds to complete so must never be run | 389 // Note: Enumeration tasks may take seconds to complete so must never be run |
388 // on any of the BrowserThreads (UI, IO, etc). See http://crbug.com/256945. | 390 // on any of the BrowserThreads (UI, IO, etc). See http://crbug.com/256945. |
389 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; | 391 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; |
390 | 392 |
391 media::AudioManager* const audio_manager_; // not owned | 393 media::AudioManager* const audio_manager_; // not owned |
| 394 component::VideoCaptureObserver* const capture_observer_; // not owned |
392 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; | 395 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; |
393 scoped_refptr<VideoCaptureManager> video_capture_manager_; | 396 scoped_refptr<VideoCaptureManager> video_capture_manager_; |
394 #if defined(OS_WIN) | 397 #if defined(OS_WIN) |
395 base::Thread video_capture_thread_; | 398 base::Thread video_capture_thread_; |
396 #endif | 399 #endif |
397 | 400 |
398 std::unique_ptr<MediaDevicesManager> media_devices_manager_; | 401 std::unique_ptr<MediaDevicesManager> media_devices_manager_; |
399 | 402 |
400 // All non-closed request. Must be accessed on IO thread. | 403 // All non-closed request. Must be accessed on IO thread. |
401 DeviceRequests requests_; | 404 DeviceRequests requests_; |
402 | 405 |
403 bool use_fake_ui_; | 406 bool use_fake_ui_; |
404 std::unique_ptr<FakeMediaStreamUIProxy> fake_ui_; | 407 std::unique_ptr<FakeMediaStreamUIProxy> fake_ui_; |
405 | 408 |
406 // Maps render process hosts to log callbacks. Used on the IO thread. | 409 // Maps render process hosts to log callbacks. Used on the IO thread. |
407 std::map<int, base::Callback<void(const std::string&)>> log_callbacks_; | 410 std::map<int, base::Callback<void(const std::string&)>> log_callbacks_; |
408 | 411 |
409 GenerateStreamTestCallback generate_stream_test_callback_; | 412 GenerateStreamTestCallback generate_stream_test_callback_; |
410 | 413 |
411 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); | 414 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); |
412 }; | 415 }; |
413 | 416 |
414 } // namespace content | 417 } // namespace content |
415 | 418 |
416 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 419 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
OLD | NEW |