| OLD | NEW |
| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // AudioManagerBase::ShutDown() can invalidate the message loop pointer | 194 // AudioManagerBase::ShutDown() can invalidate the message loop pointer |
| 195 // before the stream gets deleted. | 195 // before the stream gets deleted. |
| 196 base::MessageLoop* message_loop_; | 196 base::MessageLoop* message_loop_; |
| 197 | 197 |
| 198 // Handle to the actual PCM playback device. | 198 // Handle to the actual PCM playback device. |
| 199 snd_pcm_t* playback_handle_; | 199 snd_pcm_t* playback_handle_; |
| 200 | 200 |
| 201 scoped_ptr<media::SeekableBuffer> buffer_; | 201 scoped_ptr<media::SeekableBuffer> buffer_; |
| 202 uint32 frames_per_packet_; | 202 uint32 frames_per_packet_; |
| 203 | 203 |
| 204 // Allows us to run tasks on the AlsaPcmOutputStream instance which are | |
| 205 // bound by its lifetime. | |
| 206 base::WeakPtrFactory<AlsaPcmOutputStream> weak_factory_; | |
| 207 | |
| 208 InternalState state_; | 204 InternalState state_; |
| 209 float volume_; // Volume level from 0.0 to 1.0. | 205 float volume_; // Volume level from 0.0 to 1.0. |
| 210 | 206 |
| 211 AudioSourceCallback* source_callback_; | 207 AudioSourceCallback* source_callback_; |
| 212 | 208 |
| 213 // Container for retrieving data from AudioSourceCallback::OnMoreData(). | 209 // Container for retrieving data from AudioSourceCallback::OnMoreData(). |
| 214 scoped_ptr<AudioBus> audio_bus_; | 210 scoped_ptr<AudioBus> audio_bus_; |
| 215 | 211 |
| 216 // Channel mixer and temporary bus for the final mixed channel data. | 212 // Channel mixer and temporary bus for the final mixed channel data. |
| 217 scoped_ptr<ChannelMixer> channel_mixer_; | 213 scoped_ptr<ChannelMixer> channel_mixer_; |
| 218 scoped_ptr<AudioBus> mixed_audio_bus_; | 214 scoped_ptr<AudioBus> mixed_audio_bus_; |
| 219 | 215 |
| 216 // NOTE: This must always be last so it's invalidated before other member |
| 217 // variables might be accessed. |
| 218 base::WeakPtrFactory<AlsaPcmOutputStream> weak_factory_; |
| 219 |
| 220 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStream); | 220 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStream); |
| 221 }; | 221 }; |
| 222 | 222 |
| 223 MEDIA_EXPORT std::ostream& operator<<(std::ostream& os, | 223 MEDIA_EXPORT std::ostream& operator<<(std::ostream& os, |
| 224 AlsaPcmOutputStream::InternalState); | 224 AlsaPcmOutputStream::InternalState); |
| 225 | 225 |
| 226 }; // namespace media | 226 }; // namespace media |
| 227 | 227 |
| 228 #endif // MEDIA_AUDIO_ALSA_ALSA_OUTPUT_H_ | 228 #endif // MEDIA_AUDIO_ALSA_ALSA_OUTPUT_H_ |
| OLD | NEW |