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

Side by Side Diff: media/audio/audio_system.h

Issue 2692203003: Switching AudioOutputAuthorizationHandler from using AudioManager interface to AudioSystem one. (Closed)
Patch Set: AudioSystem comments updated according to discussion with tommi@ Created 3 years, 10 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #ifndef MEDIA_AUDIO_AUDIO_SYSTEM_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_SYSTEM_H_
6 #define MEDIA_AUDIO_AUDIO_SYSTEM_H_ 6 #define MEDIA_AUDIO_AUDIO_SYSTEM_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "media/base/audio_parameters.h" 9 #include "media/base/audio_parameters.h"
10 #include "media/base/media_export.h" 10 #include "media/base/media_export.h"
11 11
12 namespace media { 12 namespace media {
13 class AudioManager; 13 class AudioManager;
14 14
15 // Work in progress: Provides asynchronous interface to AudioManager. All the 15 // Work in progress: Provides asynchronous interface to AudioManager. All the
16 // AudioManager clients will be switched to it, in preparation for moving 16 // AudioManager clients will be switched to it, in preparation for moving
17 // to Mojo audio service. 17 // to Mojo audio service.
18 class MEDIA_EXPORT AudioSystem { 18 class MEDIA_EXPORT AudioSystem {
19 public: 19 public:
20 // Replies are asynchronously sent to the thread the call is issued on. 20 // Replies are asynchronously sent to the thread the call is issued on.
21 using OnAudioParamsCallback = base::Callback<void(const AudioParameters&)>; 21 using OnAudioParamsCallback = base::Callback<void(const AudioParameters&)>;
22 using OnBoolCallback = base::Callback<void(bool)>; 22 using OnBoolCallback = base::Callback<void(bool)>;
23 23
24 static AudioSystem* Get(); 24 static AudioSystem* Get();
25 25
26 virtual ~AudioSystem(); 26 virtual ~AudioSystem();
27 27
28 // Callback will receive invalid parameters if the device is not found. 28 // Callback may receive invalid parameters, it means the specified device is
29 // not found. This is best-effort: valid parameters do not guarantee existance
30 // of the device.
31 // TODO(olka,tommi): fix all AudioManager implementations to return invalid
tommi (sloooow) - chröme 2017/02/16 08:04:12 w00t - I getz todo too! Thanks for updating the c
32 // parameters if the device is not found.
29 virtual void GetInputStreamParameters( 33 virtual void GetInputStreamParameters(
30 const std::string& device_id, 34 const std::string& device_id,
31 OnAudioParamsCallback on_params_cb) const = 0; 35 OnAudioParamsCallback on_params_cb) const = 0;
32 36
37 // If media::AudioDeviceDescription::IsDefaultDevice(device_id) is true,
38 // callback will receive the parameters of the default output device.
39 // Callback may receive invalid parameters, it means the specified device is
40 // not found. This is best-effort: valid parameters do not guarantee existance
41 // of the device.
42 // TODO(olka,tommi): fix all AudioManager implementations to return invalid
43 // parameters if the device is not found.
44 virtual void GetOutputStreamParameters(
45 const std::string& device_id,
46 OnAudioParamsCallback on_params_cb) const = 0;
47
33 virtual void HasInputDevices(OnBoolCallback on_has_devices_cb) const = 0; 48 virtual void HasInputDevices(OnBoolCallback on_has_devices_cb) const = 0;
34 49
35 // Must not be used for anything but stream creation. 50 // Must not be used for anything but stream creation.
36 virtual AudioManager* GetAudioManager() const = 0; 51 virtual AudioManager* GetAudioManager() const = 0;
37 52
38 protected: 53 protected:
39 // Sets the global AudioSystem pointer to the specified non-null value. 54 // Sets the global AudioSystem pointer to the specified non-null value.
40 static void SetInstance(AudioSystem* audio_system); 55 static void SetInstance(AudioSystem* audio_system);
41 56
42 // Sets the global AudioSystem pointer to null if it equals the specified one. 57 // Sets the global AudioSystem pointer to null if it equals the specified one.
43 static void ClearInstance(const AudioSystem* audio_system); 58 static void ClearInstance(const AudioSystem* audio_system);
44 }; 59 };
45 60
46 } // namespace media 61 } // namespace media
47 62
48 #endif // MEDIA_AUDIO_AUDIO_SYSTEM_H_ 63 #endif // MEDIA_AUDIO_AUDIO_SYSTEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698