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

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

Issue 2060833002: Implementation of 'AudioContext.getOutputTimestamp' method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added implementation for ALSA. Created 4 years, 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 199
200 // Handle to the actual PCM playback device. 200 // Handle to the actual PCM playback device.
201 snd_pcm_t* playback_handle_; 201 snd_pcm_t* playback_handle_;
202 202
203 std::unique_ptr<media::SeekableBuffer> buffer_; 203 std::unique_ptr<media::SeekableBuffer> buffer_;
204 uint32_t frames_per_packet_; 204 uint32_t frames_per_packet_;
205 205
206 InternalState state_; 206 InternalState state_;
207 float volume_; // Volume level from 0.0 to 1.0. 207 float volume_; // Volume level from 0.0 to 1.0.
208 208
209 // Total amount of the frames written from the playback start.
210 snd_pcm_sframes_t elapsed_written_frames_;
211
209 AudioSourceCallback* source_callback_; 212 AudioSourceCallback* source_callback_;
210 213
211 // Container for retrieving data from AudioSourceCallback::OnMoreData(). 214 // Container for retrieving data from AudioSourceCallback::OnMoreData().
212 std::unique_ptr<AudioBus> audio_bus_; 215 std::unique_ptr<AudioBus> audio_bus_;
213 216
214 // Channel mixer and temporary bus for the final mixed channel data. 217 // Channel mixer and temporary bus for the final mixed channel data.
215 std::unique_ptr<ChannelMixer> channel_mixer_; 218 std::unique_ptr<ChannelMixer> channel_mixer_;
216 std::unique_ptr<AudioBus> mixed_audio_bus_; 219 std::unique_ptr<AudioBus> mixed_audio_bus_;
217 220
218 // Allows us to run tasks on the AlsaPcmOutputStream instance which are 221 // Allows us to run tasks on the AlsaPcmOutputStream instance which are
219 // bound by its lifetime. 222 // bound by its lifetime.
220 // NOTE: Weak pointers must be invalidated before all other member variables. 223 // NOTE: Weak pointers must be invalidated before all other member variables.
221 base::WeakPtrFactory<AlsaPcmOutputStream> weak_factory_; 224 base::WeakPtrFactory<AlsaPcmOutputStream> weak_factory_;
222 225
223 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStream); 226 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStream);
224 }; 227 };
225 228
226 MEDIA_EXPORT std::ostream& operator<<(std::ostream& os, 229 MEDIA_EXPORT std::ostream& operator<<(std::ostream& os,
227 AlsaPcmOutputStream::InternalState); 230 AlsaPcmOutputStream::InternalState);
228 231
229 }; // namespace media 232 }; // namespace media
230 233
231 #endif // MEDIA_AUDIO_ALSA_ALSA_OUTPUT_H_ 234 #endif // MEDIA_AUDIO_ALSA_ALSA_OUTPUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698