Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: content/browser/renderer_host/media/media_stream_manager.h

Issue 2697033006: Switching MediaStreamManager from using AudioManager to AudioSystem (Closed)
Patch Set: weak pointers removed Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 30 matching lines...) Expand all
41 #include "build/build_config.h" 41 #include "build/build_config.h"
42 #include "content/browser/renderer_host/media/media_devices_manager.h" 42 #include "content/browser/renderer_host/media/media_devices_manager.h"
43 #include "content/browser/renderer_host/media/media_stream_provider.h" 43 #include "content/browser/renderer_host/media/media_stream_provider.h"
44 #include "content/common/content_export.h" 44 #include "content/common/content_export.h"
45 #include "content/common/media/media_devices.h" 45 #include "content/common/media/media_devices.h"
46 #include "content/common/media/media_stream_options.h" 46 #include "content/common/media/media_stream_options.h"
47 #include "content/public/browser/media_request_state.h" 47 #include "content/public/browser/media_request_state.h"
48 #include "media/base/video_facing.h" 48 #include "media/base/video_facing.h"
49 49
50 namespace media { 50 namespace media {
51 class AudioManager; 51 class AudioSystem;
52 } 52 }
53 53
54 namespace url { 54 namespace url {
55 class Origin; 55 class Origin;
56 } 56 }
57 57
58 namespace content { 58 namespace content {
59 59
60 class AudioInputDeviceManager; 60 class AudioInputDeviceManager;
61 class FakeMediaStreamUIProxy; 61 class FakeMediaStreamUIProxy;
(...skipping 16 matching lines...) Expand all
78 78
79 // Callback for testing. 79 // Callback for testing.
80 typedef base::Callback<bool(const StreamControls&)> 80 typedef base::Callback<bool(const StreamControls&)>
81 GenerateStreamTestCallback; 81 GenerateStreamTestCallback;
82 82
83 // 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
84 // render processes hosts whose corresponding render processes are requesting 84 // render processes hosts whose corresponding render processes are requesting
85 // logging from webrtcLoggingPrivate API. Safe to call from any thread. 85 // logging from webrtcLoggingPrivate API. Safe to call from any thread.
86 static void SendMessageToNativeLog(const std::string& message); 86 static void SendMessageToNativeLog(const std::string& message);
87 87
88 explicit MediaStreamManager(media::AudioManager* audio_manager); 88 explicit MediaStreamManager(media::AudioSystem* audio_system);
89 89
90 ~MediaStreamManager() override; 90 ~MediaStreamManager() override;
91 91
92 // Used to access VideoCaptureManager. 92 // Used to access VideoCaptureManager.
93 VideoCaptureManager* video_capture_manager(); 93 VideoCaptureManager* video_capture_manager();
94 94
95 // Used to access AudioInputDeviceManager. 95 // Used to access AudioInputDeviceManager.
96 AudioInputDeviceManager* audio_input_device_manager(); 96 AudioInputDeviceManager* audio_input_device_manager();
97 97
98 // Used to access MediaDevicesManager. 98 // Used to access MediaDevicesManager.
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 const std::string& label, 396 const std::string& label,
397 const MediaDeviceEnumeration& enumeration); 397 const MediaDeviceEnumeration& enumeration);
398 398
399 // Creates MediaStreamDevices for |devices_infos| of |stream_type|. For video 399 // Creates MediaStreamDevices for |devices_infos| of |stream_type|. For video
400 // capture device it also uses cached content from |video_capture_manager_| to 400 // capture device it also uses cached content from |video_capture_manager_| to
401 // set the MediaStreamDevice fields. 401 // set the MediaStreamDevice fields.
402 MediaStreamDevices ConvertToMediaStreamDevices( 402 MediaStreamDevices ConvertToMediaStreamDevices(
403 MediaStreamType stream_type, 403 MediaStreamType stream_type,
404 const MediaDeviceInfoArray& device_infos); 404 const MediaDeviceInfoArray& device_infos);
405 405
406 // Task runner shared by VideoCaptureManager and AudioInputDeviceManager and 406 media::AudioSystem* const audio_system_; // not owned
407 // used for enumerating audio output devices.
408 // Note: Enumeration tasks may take seconds to complete so must never be run
409 // on any of the BrowserThreads (UI, IO, etc). See http://crbug.com/256945.
410 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_;
411
412 media::AudioManager* const audio_manager_; // not owned
413 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; 407 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_;
414 scoped_refptr<VideoCaptureManager> video_capture_manager_; 408 scoped_refptr<VideoCaptureManager> video_capture_manager_;
415 #if defined(OS_WIN) 409 #if defined(OS_WIN)
416 base::Thread video_capture_thread_; 410 base::Thread video_capture_thread_;
417 #endif 411 #endif
418 412
419 std::unique_ptr<MediaDevicesManager> media_devices_manager_; 413 std::unique_ptr<MediaDevicesManager> media_devices_manager_;
420 414
421 // All non-closed request. Must be accessed on IO thread. 415 // All non-closed request. Must be accessed on IO thread.
422 DeviceRequests requests_; 416 DeviceRequests requests_;
423 417
424 bool use_fake_ui_; 418 bool use_fake_ui_;
425 std::unique_ptr<FakeMediaStreamUIProxy> fake_ui_; 419 std::unique_ptr<FakeMediaStreamUIProxy> fake_ui_;
426 420
427 // Maps render process hosts to log callbacks. Used on the IO thread. 421 // Maps render process hosts to log callbacks. Used on the IO thread.
428 std::map<int, base::Callback<void(const std::string&)>> log_callbacks_; 422 std::map<int, base::Callback<void(const std::string&)>> log_callbacks_;
429 423
430 GenerateStreamTestCallback generate_stream_test_callback_; 424 GenerateStreamTestCallback generate_stream_test_callback_;
431 425
432 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); 426 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager);
433 }; 427 };
434 428
435 } // namespace content 429 } // namespace content
436 430
437 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ 431 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698