| OLD | NEW |
| 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 15 matching lines...) Expand all Loading... |
| 26 #include <string> | 26 #include <string> |
| 27 | 27 |
| 28 #include "base/compiler_specific.h" | 28 #include "base/compiler_specific.h" |
| 29 #include "base/gtest_prod_util.h" | 29 #include "base/gtest_prod_util.h" |
| 30 #include "base/memory/scoped_ptr.h" | 30 #include "base/memory/scoped_ptr.h" |
| 31 #include "base/memory/weak_ptr.h" | 31 #include "base/memory/weak_ptr.h" |
| 32 #include "base/time.h" | 32 #include "base/time.h" |
| 33 #include "media/audio/audio_io.h" | 33 #include "media/audio/audio_io.h" |
| 34 #include "media/audio/audio_parameters.h" | 34 #include "media/audio/audio_parameters.h" |
| 35 | 35 |
| 36 namespace base { |
| 36 class MessageLoop; | 37 class MessageLoop; |
| 38 } |
| 37 | 39 |
| 38 namespace media { | 40 namespace media { |
| 39 | 41 |
| 40 class AlsaWrapper; | 42 class AlsaWrapper; |
| 41 class AudioManagerLinux; | 43 class AudioManagerLinux; |
| 42 class ChannelMixer; | 44 class ChannelMixer; |
| 43 class SeekableBuffer; | 45 class SeekableBuffer; |
| 44 | 46 |
| 45 class MEDIA_EXPORT AlsaPcmOutputStream : public AudioOutputStream { | 47 class MEDIA_EXPORT AlsaPcmOutputStream : public AudioOutputStream { |
| 46 public: | 48 public: |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 // Wrapper class to invoke all the ALSA functions. | 186 // Wrapper class to invoke all the ALSA functions. |
| 185 AlsaWrapper* wrapper_; | 187 AlsaWrapper* wrapper_; |
| 186 | 188 |
| 187 // Audio manager that created us. Used to report that we've been closed. | 189 // Audio manager that created us. Used to report that we've been closed. |
| 188 AudioManagerLinux* manager_; | 190 AudioManagerLinux* manager_; |
| 189 | 191 |
| 190 // Message loop to use for polling. The object is owned by the AudioManager. | 192 // Message loop to use for polling. The object is owned by the AudioManager. |
| 191 // We hold a reference to the audio thread message loop since | 193 // We hold a reference to the audio thread message loop since |
| 192 // AudioManagerBase::ShutDown() can invalidate the message loop pointer | 194 // AudioManagerBase::ShutDown() can invalidate the message loop pointer |
| 193 // before the stream gets deleted. | 195 // before the stream gets deleted. |
| 194 MessageLoop* message_loop_; | 196 base::MessageLoop* message_loop_; |
| 195 | 197 |
| 196 // Handle to the actual PCM playback device. | 198 // Handle to the actual PCM playback device. |
| 197 snd_pcm_t* playback_handle_; | 199 snd_pcm_t* playback_handle_; |
| 198 | 200 |
| 199 scoped_ptr<media::SeekableBuffer> buffer_; | 201 scoped_ptr<media::SeekableBuffer> buffer_; |
| 200 uint32 frames_per_packet_; | 202 uint32 frames_per_packet_; |
| 201 | 203 |
| 202 // Allows us to run tasks on the AlsaPcmOutputStream instance which are | 204 // Allows us to run tasks on the AlsaPcmOutputStream instance which are |
| 203 // bound by its lifetime. | 205 // bound by its lifetime. |
| 204 base::WeakPtrFactory<AlsaPcmOutputStream> weak_factory_; | 206 base::WeakPtrFactory<AlsaPcmOutputStream> weak_factory_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 217 | 219 |
| 218 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStream); | 220 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStream); |
| 219 }; | 221 }; |
| 220 | 222 |
| 221 MEDIA_EXPORT std::ostream& operator<<(std::ostream& os, | 223 MEDIA_EXPORT std::ostream& operator<<(std::ostream& os, |
| 222 AlsaPcmOutputStream::InternalState); | 224 AlsaPcmOutputStream::InternalState); |
| 223 | 225 |
| 224 }; // namespace media | 226 }; // namespace media |
| 225 | 227 |
| 226 #endif // MEDIA_AUDIO_LINUX_ALSA_OUTPUT_H_ | 228 #endif // MEDIA_AUDIO_LINUX_ALSA_OUTPUT_H_ |
| OLD | NEW |