Chromium Code Reviews| Index: media/audio/audio_manager.h |
| diff --git a/media/audio/audio_manager.h b/media/audio/audio_manager.h |
| index cd91b399d6d4595ce60faf0131baa65f9cfd8bca..2060e9f510ea8ec569d181d3eb313fc151c4927d 100644 |
| --- a/media/audio/audio_manager.h |
| +++ b/media/audio/audio_manager.h |
| @@ -95,43 +95,6 @@ class MEDIA_EXPORT AudioManager { |
| // like src/chrome. |
| static AudioManager* Get(); |
| - // Returns true if the OS reports existence of audio devices. This does not |
| - // guarantee that the existing devices support all formats and sample rates. |
| - virtual bool HasAudioOutputDevices() = 0; |
| - |
| - // Returns true if the OS reports existence of audio recording devices. This |
| - // does not guarantee that the existing devices support all formats and |
| - // sample rates. |
| - virtual bool HasAudioInputDevices() = 0; |
| - |
| - // Returns a human readable string for the model/make of the active audio |
| - // input device for this computer. |
| - virtual base::string16 GetAudioInputDeviceModel() = 0; |
| - |
| - // Opens the platform default audio input settings UI. |
| - // Note: This could invoke an external application/preferences pane, so |
| - // ideally must not be called from the UI thread or other time sensitive |
| - // threads to avoid blocking the rest of the application. |
| - virtual void ShowAudioInputSettings() = 0; |
| - |
| - // Appends a list of available input devices to |device_descriptions|, |
| - // which must initially be empty. It is not guaranteed that all the |
| - // devices in the list support all formats and sample rates for |
| - // recording. |
| - // |
| - // Not threadsafe; in production this should only be called from the |
| - // Audio worker thread (see GetTaskRunner()). |
| - virtual void GetAudioInputDeviceDescriptions( |
| - AudioDeviceDescriptions* device_descriptions) = 0; |
| - |
| - // Appends a list of available output devices to |device_descriptions|, |
| - // which must initially be empty. |
| - // |
| - // Not threadsafe; in production this should only be called from the |
| - // Audio worker thread (see GetTaskRunner()). |
| - virtual void GetAudioOutputDeviceDescriptions( |
| - AudioDeviceDescriptions* device_descriptions) = 0; |
| - |
| // Log callback used for sending log messages from a stream to the object |
| // that manages the stream. |
| using LogCallback = base::Callback<void(const std::string&)>; |
| @@ -213,33 +176,6 @@ class MEDIA_EXPORT AudioManager { |
| virtual void RemoveOutputDeviceChangeListener( |
| AudioDeviceListener* listener) = 0; |
| - // Returns the default output hardware audio parameters for opening output |
| - // streams. It is a convenience interface to |
| - // AudioManagerBase::GetPreferredOutputStreamParameters and each AudioManager |
| - // does not need their own implementation to this interface. |
| - // TODO(tommi): Remove this method and use GetOutputStreamParameteres instead. |
| - virtual AudioParameters GetDefaultOutputStreamParameters() = 0; |
| - |
| - // Returns the output hardware audio parameters for a specific output device. |
| - virtual AudioParameters GetOutputStreamParameters( |
| - const std::string& device_id) = 0; |
| - |
| - // Returns the input hardware audio parameters of the specific device |
| - // for opening input streams. Each AudioManager needs to implement their own |
| - // version of this interface. |
| - virtual AudioParameters GetInputStreamParameters( |
| - const std::string& device_id) = 0; |
| - |
| - // Returns the device id of an output device that belongs to the same hardware |
| - // as the specified input device. |
| - // If the hardware has only an input device (e.g. a webcam), the return value |
| - // will be empty (which the caller can then interpret to be the default output |
| - // device). Implementations that don't yet support this feature, must return |
| - // an empty string. Must be called on the audio worker thread (see |
| - // GetTaskRunner()). |
| - virtual std::string GetAssociatedOutputDeviceID( |
| - const std::string& input_device_id) = 0; |
| - |
| // Create a new AudioLog object for tracking the behavior for one or more |
| // instances of the given component. See AudioLogFactory for more details. |
| virtual std::unique_ptr<AudioLog> CreateAudioLog( |
| @@ -262,6 +198,7 @@ class MEDIA_EXPORT AudioManager { |
| protected: |
|
Max Morin
2017/04/11 07:57:43
Maybe add a comment to warn against adding new fri
|
| FRIEND_TEST_ALL_PREFIXES(AudioManagerTest, AudioDebugRecording); |
| + friend class AudioDeviceInfoAccessorForTests; |
| AudioManager(scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner); |
| @@ -272,9 +209,74 @@ class MEDIA_EXPORT AudioManager { |
| virtual void InitializeOutputDebugRecording( |
| scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) = 0; |
| + // Returns true if the OS reports existence of audio devices. This does not |
| + // guarantee that the existing devices support all formats and sample rates. |
| + virtual bool HasAudioOutputDevices() = 0; |
| + |
| + // Returns true if the OS reports existence of audio recording devices. This |
| + // does not guarantee that the existing devices support all formats and |
| + // sample rates. |
| + virtual bool HasAudioInputDevices() = 0; |
| + |
| + // Returns a human readable string for the model/make of the active audio |
| + // input device for this computer. |
| + virtual base::string16 GetAudioInputDeviceModel() = 0; |
| + |
| + // Opens the platform default audio input settings UI. |
| + // Note: This could invoke an external application/preferences pane, so |
| + // ideally must not be called from the UI thread or other time sensitive |
| + // threads to avoid blocking the rest of the application. |
| + virtual void ShowAudioInputSettings() = 0; |
| + |
| + // Appends a list of available input devices to |device_descriptions|, |
| + // which must initially be empty. It is not guaranteed that all the |
| + // devices in the list support all formats and sample rates for |
| + // recording. |
| + // |
| + // Not threadsafe; in production this should only be called from the |
| + // Audio worker thread (see GetTaskRunner()). |
| + virtual void GetAudioInputDeviceDescriptions( |
| + AudioDeviceDescriptions* device_descriptions) = 0; |
| + |
| + // Appends a list of available output devices to |device_descriptions|, |
| + // which must initially be empty. |
| + // |
| + // Not threadsafe; in production this should only be called from the |
| + // Audio worker thread (see GetTaskRunner()). |
| + virtual void GetAudioOutputDeviceDescriptions( |
| + AudioDeviceDescriptions* device_descriptions) = 0; |
| + |
| + // Returns the default output hardware audio parameters for opening output |
| + // streams. It is a convenience interface to |
| + // AudioManagerBase::GetPreferredOutputStreamParameters and each AudioManager |
| + // does not need their own implementation to this interface. |
| + // TODO(tommi): Remove this method and use GetOutputStreamParameteres instead. |
| + virtual AudioParameters GetDefaultOutputStreamParameters() = 0; |
| + |
| + // Returns the output hardware audio parameters for a specific output device. |
| + virtual AudioParameters GetOutputStreamParameters( |
| + const std::string& device_id) = 0; |
| + |
| + // Returns the input hardware audio parameters of the specific device |
| + // for opening input streams. Each AudioManager needs to implement their own |
| + // version of this interface. |
| + virtual AudioParameters GetInputStreamParameters( |
| + const std::string& device_id) = 0; |
| + |
| + // Returns the device id of an output device that belongs to the same hardware |
| + // as the specified input device. |
| + // If the hardware has only an input device (e.g. a webcam), the return value |
| + // will be empty (which the caller can then interpret to be the default output |
| + // device). Implementations that don't yet support this feature, must return |
| + // an empty string. Must be called on the audio worker thread (see |
| + // GetTaskRunner()). |
| + virtual std::string GetAssociatedOutputDeviceID( |
| + const std::string& input_device_id) = 0; |
| + |
| private: |
| friend class base::DeleteHelper<AudioManager>; |
| friend class AudioManagerDeleter; |
| + friend class AudioSystemImpl; |
| scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner_; |