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

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

Issue 1186293003: Implement HasInputDevices in CrasAudioManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address the comments and add unittest Created 5 years, 6 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 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
6 #define MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ 6 #define MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 30 matching lines...) Expand all
41 // AudioInputStream will be capturing audio currently being played on the 41 // AudioInputStream will be capturing audio currently being played on the
42 // default playback device. At the moment this feature is supported only on 42 // default playback device. At the moment this feature is supported only on
43 // some platforms. AudioInputStream::Intialize() will return an error on 43 // some platforms. AudioInputStream::Intialize() will return an error on
44 // platforms that don't support it. GetInputStreamParameters() must be used 44 // platforms that don't support it. GetInputStreamParameters() must be used
45 // to get the parameters of the loopback device before creating a loopback 45 // to get the parameters of the loopback device before creating a loopback
46 // stream, otherwise stream initialization may fail. 46 // stream, otherwise stream initialization may fail.
47 static const char kLoopbackInputDeviceId[]; 47 static const char kLoopbackInputDeviceId[];
48 48
49 ~AudioManagerBase() override; 49 ~AudioManagerBase() override;
50 50
51 // AudioManager:
51 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override; 52 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override;
52 scoped_refptr<base::SingleThreadTaskRunner> GetWorkerTaskRunner() override; 53 scoped_refptr<base::SingleThreadTaskRunner> GetWorkerTaskRunner() override;
53
54 base::string16 GetAudioInputDeviceModel() override; 54 base::string16 GetAudioInputDeviceModel() override;
55
56 void ShowAudioInputSettings() override; 55 void ShowAudioInputSettings() override;
57
58 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; 56 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
59
60 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; 57 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
61
62 AudioOutputStream* MakeAudioOutputStream( 58 AudioOutputStream* MakeAudioOutputStream(
63 const AudioParameters& params, 59 const AudioParameters& params,
64 const std::string& device_id) override; 60 const std::string& device_id) override;
65
66 AudioInputStream* MakeAudioInputStream(const AudioParameters& params, 61 AudioInputStream* MakeAudioInputStream(const AudioParameters& params,
67 const std::string& device_id) override; 62 const std::string& device_id) override;
68
69 AudioOutputStream* MakeAudioOutputStreamProxy( 63 AudioOutputStream* MakeAudioOutputStreamProxy(
70 const AudioParameters& params, 64 const AudioParameters& params,
71 const std::string& device_id) override; 65 const std::string& device_id) override;
72 66
67 // Listeners will be notified on the GetTaskRunner() task runner.
68 void AddOutputDeviceChangeListener(AudioDeviceListener* listener) override;
69 void RemoveOutputDeviceChangeListener(AudioDeviceListener* listener) override;
70
71 AudioParameters GetDefaultOutputStreamParameters() override;
72 AudioParameters GetOutputStreamParameters(
73 const std::string& device_id) override;
74 AudioParameters GetInputStreamParameters(
75 const std::string& device_id) override;
76 std::string GetAssociatedOutputDeviceID(
77 const std::string& input_device_id) override;
78 scoped_ptr<AudioLog> CreateAudioLog(
79 AudioLogFactory::AudioComponent component) override;
80 void SetHasKeyboardMic() override;
81 void SetHasInputDevices(bool has_input_devices) override;
82
83 // AudioManagerBase:
84
73 // Called internally by the audio stream when it has been closed. 85 // Called internally by the audio stream when it has been closed.
74 virtual void ReleaseOutputStream(AudioOutputStream* stream); 86 virtual void ReleaseOutputStream(AudioOutputStream* stream);
75 virtual void ReleaseInputStream(AudioInputStream* stream); 87 virtual void ReleaseInputStream(AudioInputStream* stream);
76 88
77 // Creates the output stream for the |AUDIO_PCM_LINEAR| format. The legacy 89 // Creates the output stream for the |AUDIO_PCM_LINEAR| format. The legacy
78 // name is also from |AUDIO_PCM_LINEAR|. 90 // name is also from |AUDIO_PCM_LINEAR|.
79 virtual AudioOutputStream* MakeLinearOutputStream( 91 virtual AudioOutputStream* MakeLinearOutputStream(
80 const AudioParameters& params) = 0; 92 const AudioParameters& params) = 0;
81 93
82 // Creates the output stream for the |AUDIO_PCM_LOW_LATENCY| format. 94 // Creates the output stream for the |AUDIO_PCM_LOW_LATENCY| format.
83 virtual AudioOutputStream* MakeLowLatencyOutputStream( 95 virtual AudioOutputStream* MakeLowLatencyOutputStream(
84 const AudioParameters& params, 96 const AudioParameters& params,
85 const std::string& device_id) = 0; 97 const std::string& device_id) = 0;
86 98
87 // Creates the input stream for the |AUDIO_PCM_LINEAR| format. The legacy 99 // Creates the input stream for the |AUDIO_PCM_LINEAR| format. The legacy
88 // name is also from |AUDIO_PCM_LINEAR|. 100 // name is also from |AUDIO_PCM_LINEAR|.
89 virtual AudioInputStream* MakeLinearInputStream( 101 virtual AudioInputStream* MakeLinearInputStream(
90 const AudioParameters& params, const std::string& device_id) = 0; 102 const AudioParameters& params, const std::string& device_id) = 0;
91 103
92 // Creates the input stream for the |AUDIO_PCM_LOW_LATENCY| format. 104 // Creates the input stream for the |AUDIO_PCM_LOW_LATENCY| format.
93 virtual AudioInputStream* MakeLowLatencyInputStream( 105 virtual AudioInputStream* MakeLowLatencyInputStream(
94 const AudioParameters& params, const std::string& device_id) = 0; 106 const AudioParameters& params, const std::string& device_id) = 0;
95 107
96 // Listeners will be notified on the GetTaskRunner() task runner.
97 void AddOutputDeviceChangeListener(AudioDeviceListener* listener) override;
98 void RemoveOutputDeviceChangeListener(AudioDeviceListener* listener) override;
99
100 AudioParameters GetDefaultOutputStreamParameters() override;
101 AudioParameters GetOutputStreamParameters(
102 const std::string& device_id) override;
103
104 AudioParameters GetInputStreamParameters(
105 const std::string& device_id) override;
106
107 std::string GetAssociatedOutputDeviceID(
108 const std::string& input_device_id) override;
109
110 scoped_ptr<AudioLog> CreateAudioLog(
111 AudioLogFactory::AudioComponent component) override;
112
113 void SetHasKeyboardMic() override;
114
115 // Get number of input or output streams. 108 // Get number of input or output streams.
116 int input_stream_count() const { return num_input_streams_; } 109 int input_stream_count() const { return num_input_streams_; }
117 int output_stream_count() const { return num_output_streams_; } 110 int output_stream_count() const { return num_output_streams_; }
118 111
119 protected: 112 protected:
120 AudioManagerBase(AudioLogFactory* audio_log_factory); 113 AudioManagerBase(AudioLogFactory* audio_log_factory);
121 114
122 // Shuts down the audio thread and releases all the audio output dispatchers 115 // Shuts down the audio thread and releases all the audio output dispatchers
123 // on the audio thread. All audio streams should be freed before Shutdown() 116 // on the audio thread. All audio streams should be freed before Shutdown()
124 // is called. This must be called in the destructor of every AudioManagerBase 117 // is called. This must be called in the destructor of every AudioManagerBase
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 183
191 // Proxy for creating AudioLog objects. 184 // Proxy for creating AudioLog objects.
192 AudioLogFactory* const audio_log_factory_; 185 AudioLogFactory* const audio_log_factory_;
193 186
194 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); 187 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase);
195 }; 188 };
196 189
197 } // namespace media 190 } // namespace media
198 191
199 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ 192 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698