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

Side by Side Diff: media/audio/linux/alsa_output.h

Issue 10832285: Switch OnMoreData() to use AudioBus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Comments. Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/fake_audio_output_stream.cc ('k') | media/audio/linux/alsa_output.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 // Creates an output stream based on the ALSA PCM interface. 5 // Creates an output stream based on the ALSA PCM interface.
6 // 6 //
7 // On device write failure, the stream will move itself to an invalid state. 7 // On device write failure, the stream will move itself to an invalid state.
8 // No more data will be pulled from the data source, or written to the device. 8 // No more data will be pulled from the data source, or written to the device.
9 // All calls to public API functions will either no-op themselves, or return an 9 // All calls to public API functions will either no-op themselves, or return an
10 // error if possible. Specifically, If the stream is in an error state, Open() 10 // error if possible. Specifically, If the stream is in an error state, Open()
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 bool IsOnAudioThread() const; 145 bool IsOnAudioThread() const;
146 146
147 // API for Proxying calls to the AudioSourceCallback provided during 147 // API for Proxying calls to the AudioSourceCallback provided during
148 // Start(). 148 // Start().
149 // 149 //
150 // TODO(ajwong): This is necessary because the ownership semantics for the 150 // TODO(ajwong): This is necessary because the ownership semantics for the
151 // |source_callback_| object are incorrect in AudioRenderHost. The callback 151 // |source_callback_| object are incorrect in AudioRenderHost. The callback
152 // is passed into the output stream, but ownership is not transfered which 152 // is passed into the output stream, but ownership is not transfered which
153 // requires a synchronization on access of the |source_callback_| to avoid 153 // requires a synchronization on access of the |source_callback_| to avoid
154 // using a deleted callback. 154 // using a deleted callback.
155 uint32 RunDataCallback(uint8* dest, 155 int RunDataCallback(AudioBus* audio_bus, AudioBuffersState buffers_state);
156 uint32 max_size,
157 AudioBuffersState buffers_state);
158 void RunErrorCallback(int code); 156 void RunErrorCallback(int code);
159 157
160 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to 158 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to
161 // release ownership of the currently registered callback. 159 // release ownership of the currently registered callback.
162 void set_source_callback(AudioSourceCallback* callback); 160 void set_source_callback(AudioSourceCallback* callback);
163 161
164 // Configuration constants from the constructor. Referenceable by all threads 162 // Configuration constants from the constructor. Referenceable by all threads
165 // since they are constants. 163 // since they are constants.
166 const std::string requested_device_name_; 164 const std::string requested_device_name_;
167 const snd_pcm_format_t pcm_format_; 165 const snd_pcm_format_t pcm_format_;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // bound by its lifetime. 204 // bound by its lifetime.
207 base::WeakPtrFactory<AlsaPcmOutputStream> weak_factory_; 205 base::WeakPtrFactory<AlsaPcmOutputStream> weak_factory_;
208 206
209 InternalState state_; 207 InternalState state_;
210 float volume_; // Volume level from 0.0 to 1.0. 208 float volume_; // Volume level from 0.0 to 1.0.
211 209
212 AudioSourceCallback* source_callback_; 210 AudioSourceCallback* source_callback_;
213 211
214 base::Time last_fill_time_; // Time for the last OnMoreData() callback. 212 base::Time last_fill_time_; // Time for the last OnMoreData() callback.
215 213
214 // Container for retrieving data from AudioSourceCallback::OnMoreData().
215 scoped_ptr<AudioBus> audio_bus_;
216
216 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStream); 217 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStream);
217 }; 218 };
218 219
219 MEDIA_EXPORT std::ostream& operator<<(std::ostream& os, 220 MEDIA_EXPORT std::ostream& operator<<(std::ostream& os,
220 AlsaPcmOutputStream::InternalState); 221 AlsaPcmOutputStream::InternalState);
221 222
222 }; // namespace media 223 }; // namespace media
223 224
224 #endif // MEDIA_AUDIO_LINUX_ALSA_OUTPUT_H_ 225 #endif // MEDIA_AUDIO_LINUX_ALSA_OUTPUT_H_
OLDNEW
« no previous file with comments | « media/audio/fake_audio_output_stream.cc ('k') | media/audio/linux/alsa_output.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698