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

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

Issue 163343002: Reland 153623004: Remove the unified IO code on the browser (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed the cras bot Created 6 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
« no previous file with comments | « media/audio/audio_manager_base.cc ('k') | media/audio/audio_output_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_OUTPUT_CONTROLLER_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_
6 #define MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_
7 7
8 #include "base/atomic_ref_count.h" 8 #include "base/atomic_ref_count.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // Close this synchronous reader. 100 // Close this synchronous reader.
101 virtual void Close() = 0; 101 virtual void Close() = 0;
102 }; 102 };
103 103
104 // Factory method for creating an AudioOutputController. 104 // Factory method for creating an AudioOutputController.
105 // This also creates and opens an AudioOutputStream on the audio manager 105 // This also creates and opens an AudioOutputStream on the audio manager
106 // thread, and if this is successful, the |event_handler| will receive an 106 // thread, and if this is successful, the |event_handler| will receive an
107 // OnCreated() call from the same audio manager thread. |audio_manager| must 107 // OnCreated() call from the same audio manager thread. |audio_manager| must
108 // outlive AudioOutputController. 108 // outlive AudioOutputController.
109 // The |output_device_id| can be either empty (default device) or specify a 109 // The |output_device_id| can be either empty (default device) or specify a
110 // specific hardware device for audio output. The |input_device_id| is 110 // specific hardware device for audio output.
111 // used only for unified audio when opening up input and output at the same
112 // time (controlled by |params.input_channel_count()|).
113 static scoped_refptr<AudioOutputController> Create( 111 static scoped_refptr<AudioOutputController> Create(
114 AudioManager* audio_manager, EventHandler* event_handler, 112 AudioManager* audio_manager, EventHandler* event_handler,
115 const AudioParameters& params, const std::string& output_device_id, 113 const AudioParameters& params, const std::string& output_device_id,
116 const std::string& input_device_id, SyncReader* sync_reader); 114 SyncReader* sync_reader);
117 115
118 // Methods to control playback of the stream. 116 // Methods to control playback of the stream.
119 117
120 // Starts the playback of this audio output stream. 118 // Starts the playback of this audio output stream.
121 void Play(); 119 void Play();
122 120
123 // Pause this audio output stream. 121 // Pause this audio output stream.
124 void Pause(); 122 void Pause();
125 123
126 // Closes the audio output stream. The state is changed and the resources 124 // Closes the audio output stream. The state is changed and the resources
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 virtual ~AudioOutputController(); 184 virtual ~AudioOutputController();
187 185
188 private: 186 private:
189 // We are polling sync reader if data became available. 187 // We are polling sync reader if data became available.
190 static const int kPollNumAttempts; 188 static const int kPollNumAttempts;
191 static const int kPollPauseInMilliseconds; 189 static const int kPollPauseInMilliseconds;
192 190
193 AudioOutputController(AudioManager* audio_manager, EventHandler* handler, 191 AudioOutputController(AudioManager* audio_manager, EventHandler* handler,
194 const AudioParameters& params, 192 const AudioParameters& params,
195 const std::string& output_device_id, 193 const std::string& output_device_id,
196 const std::string& input_device_id,
197 SyncReader* sync_reader); 194 SyncReader* sync_reader);
198 195
199 // The following methods are executed on the audio manager thread. 196 // The following methods are executed on the audio manager thread.
200 void DoCreate(bool is_for_device_change); 197 void DoCreate(bool is_for_device_change);
201 void DoPlay(); 198 void DoPlay();
202 void DoPause(); 199 void DoPause();
203 void DoClose(); 200 void DoClose();
204 void DoSetVolume(double volume); 201 void DoSetVolume(double volume);
205 std::string DoGetOutputDeviceId() const; 202 std::string DoGetOutputDeviceId() const;
206 void DoSwitchOutputDevice(const std::string& output_device_id); 203 void DoSwitchOutputDevice(const std::string& output_device_id);
(...skipping 20 matching lines...) Expand all
227 void WedgeCheck(); 224 void WedgeCheck();
228 225
229 AudioManager* const audio_manager_; 226 AudioManager* const audio_manager_;
230 const AudioParameters params_; 227 const AudioParameters params_;
231 EventHandler* const handler_; 228 EventHandler* const handler_;
232 229
233 // Specifies the device id of the output device to open or empty for the 230 // Specifies the device id of the output device to open or empty for the
234 // default output device. 231 // default output device.
235 std::string output_device_id_; 232 std::string output_device_id_;
236 233
237 // Used by the unified IO to open the correct input device.
238 const std::string input_device_id_;
239
240 AudioOutputStream* stream_; 234 AudioOutputStream* stream_;
241 235
242 // When non-NULL, audio is being diverted to this stream. 236 // When non-NULL, audio is being diverted to this stream.
243 AudioOutputStream* diverting_to_stream_; 237 AudioOutputStream* diverting_to_stream_;
244 238
245 // The current volume of the audio stream. 239 // The current volume of the audio stream.
246 double volume_; 240 double volume_;
247 241
248 // |state_| is written on the audio manager thread and is read on the 242 // |state_| is written on the audio manager thread and is read on the
249 // hardware audio thread. These operations need to be locked. But lock 243 // hardware audio thread. These operations need to be locked. But lock
(...skipping 24 matching lines...) Expand all
274 // Flags when we've asked for a stream to start but it never did. 268 // Flags when we've asked for a stream to start but it never did.
275 base::AtomicRefCount on_more_io_data_called_; 269 base::AtomicRefCount on_more_io_data_called_;
276 scoped_ptr<base::OneShotTimer<AudioOutputController> > wedge_timer_; 270 scoped_ptr<base::OneShotTimer<AudioOutputController> > wedge_timer_;
277 271
278 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); 272 DISALLOW_COPY_AND_ASSIGN(AudioOutputController);
279 }; 273 };
280 274
281 } // namespace media 275 } // namespace media
282 276
283 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ 277 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_
OLDNEW
« no previous file with comments | « media/audio/audio_manager_base.cc ('k') | media/audio/audio_output_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698