Index: media/audio/audio_system.h |
diff --git a/media/audio/audio_system.h b/media/audio/audio_system.h |
index 66dc622db267575d189e74adc5fb4729c6fbc6c7..ecbd7b60ec183cdb7975229fea95cc545a26f436 100644 |
--- a/media/audio/audio_system.h |
+++ b/media/audio/audio_system.h |
@@ -6,6 +6,7 @@ |
#define MEDIA_AUDIO_AUDIO_SYSTEM_H_ |
#include "base/callback.h" |
+#include "base/memory/weak_ptr.h" |
#include "media/audio/audio_device_description.h" |
#include "media/base/audio_parameters.h" |
#include "media/base/media_export.h" |
@@ -23,13 +24,18 @@ class AudioManager; |
class MEDIA_EXPORT AudioSystem { |
public: |
// Replies are asynchronously sent from audio system thread to the thread the |
- // call is issued on. Attention! Since audio system thread may outlive all the |
- // others, callbacks must always be bound to weak pointers! |
+ // call is issued on. Attention! Audio system thread may outlive the client |
+ // objects; bind callbacks with care. |
using OnAudioParamsCallback = base::Callback<void(const AudioParameters&)>; |
using OnBoolCallback = base::Callback<void(bool)>; |
using OnDeviceDescriptionsCallback = |
base::Callback<void(AudioDeviceDescriptions)>; |
+ using OnDeviceIdCallback = base::Callback<void(const std::string&)>; |
+ using OnInputDeviceInfoCallback = base::Callback< |
+ void(const AudioParameters&, const AudioParameters&, const std::string&)>; |
+ // Must not be called on audio system thread if it differs from the one |
+ // AudioSystem is destroyed on. |
o1ka
2017/03/28 16:40:16
See also this comment https://cs.chromium.org/chro
DaleCurtis
2017/03/28 18:22:11
This comment will need resolution and removal befo
o1ka
2017/03/30 15:11:53
Agree. This is a problem shared between AM and AS.
|
static AudioSystem* Get(); |
virtual ~AudioSystem(); |
@@ -59,9 +65,21 @@ class MEDIA_EXPORT AudioSystem { |
// Replies with device descriptions of input audio devices if |for_input| is |
// true, and of output audio devices otherwise. |
virtual void GetDeviceDescriptions( |
- OnDeviceDescriptionsCallback on_descriptions_cp, |
+ OnDeviceDescriptionsCallback on_descriptions_cb, |
bool for_input) = 0; |
+ // Replies with an empty string if there is no associated output device found. |
+ virtual void GetAssociatedOutputDeviceID( |
+ const std::string& input_device_id, |
+ OnDeviceIdCallback on_device_id_cb) = 0; |
o1ka
2017/03/28 16:40:16
This method will be used by WebRTC private API as
|
+ |
+ // Replies with audio parameters for the specified input device and audio |
+ // parameters and device ID of the associated output device, if any (otherwise |
+ // it's AudioParameters() and an empty string). |
+ virtual void GetInputDeviceInfo( |
+ const std::string& input_device_id, |
+ OnInputDeviceInfoCallback on_input_device_info_cb) = 0; |
o1ka
2017/03/28 16:40:16
I do not really like it because it's basically a c
DaleCurtis
2017/03/28 18:22:11
I guess it depends on how callers end up using thi
o1ka
2017/03/30 15:11:53
Each of the operations has multiple users.
AudioIn
|
+ |
virtual base::SingleThreadTaskRunner* GetTaskRunner() const = 0; |
// Must not be used for anything but stream creation. |