| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 // Utility functions for talking with the ALSA API. | 140 // Utility functions for talking with the ALSA API. |
| 141 static uint32 FramesToMicros(uint32 frames, uint32 sample_rate); | 141 static uint32 FramesToMicros(uint32 frames, uint32 sample_rate); |
| 142 static uint32 FramesToMillis(uint32 frames, uint32 sample_rate); | 142 static uint32 FramesToMillis(uint32 frames, uint32 sample_rate); |
| 143 std::string FindDeviceForChannels(uint32 channels); | 143 std::string FindDeviceForChannels(uint32 channels); |
| 144 snd_pcm_t* OpenDevice(const std::string& device_name, | 144 snd_pcm_t* OpenDevice(const std::string& device_name, |
| 145 uint32 channels, | 145 uint32 channels, |
| 146 uint32 latency); | 146 uint32 latency); |
| 147 bool CloseDevice(snd_pcm_t* handle); | 147 bool CloseDevice(snd_pcm_t* handle); |
| 148 snd_pcm_sframes_t GetAvailableFrames(); | 148 snd_pcm_sframes_t GetAvailableFrames(); |
| 149 snd_pcm_sframes_t GetCurrentDelay(); | |
| 150 | 149 |
| 151 // Attempts to find the best matching linux audio device for the given number | 150 // Attempts to find the best matching linux audio device for the given number |
| 152 // of channels. This function will set |device_name_| and |should_downmix_|. | 151 // of channels. This function will set |device_name_| and |should_downmix_|. |
| 153 snd_pcm_t* AutoSelectDevice(uint32 latency); | 152 snd_pcm_t* AutoSelectDevice(uint32 latency); |
| 154 | 153 |
| 155 // Thread-asserting accessors for member variables. | 154 // Thread-asserting accessors for member variables. |
| 156 AudioManagerLinux* manager(); | 155 AudioManagerLinux* manager(); |
| 157 | 156 |
| 158 // Struct holding all mutable the data that must be shared by the | 157 // Struct holding all mutable the data that must be shared by the |
| 159 // message_loop() and the thread that created the object. | 158 // message_loop() and the thread that created the object. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 MessageLoop* client_thread_loop_; | 242 MessageLoop* client_thread_loop_; |
| 244 | 243 |
| 245 // The message loop responsible for querying the data source, and writing to | 244 // The message loop responsible for querying the data source, and writing to |
| 246 // the output device. | 245 // the output device. |
| 247 MessageLoop* message_loop_; | 246 MessageLoop* message_loop_; |
| 248 | 247 |
| 249 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStream); | 248 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStream); |
| 250 }; | 249 }; |
| 251 | 250 |
| 252 #endif // MEDIA_AUDIO_LINUX_ALSA_OUTPUT_H_ | 251 #endif // MEDIA_AUDIO_LINUX_ALSA_OUTPUT_H_ |
| OLD | NEW |