| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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. The current | 5 // Creates an output stream based on the ALSA PCM interface. The current |
| 6 // implementation creates one thread per ALSA playback handle that is | 6 // implementation creates one thread per ALSA playback handle that is |
| 7 // responsible for synchronously pulling data from the audio data source. | 7 // responsible for synchronously pulling data from the audio data source. |
| 8 // | 8 // |
| 9 // This output stream buffers in two places: | 9 // This output stream buffers in two places: |
| 10 // (1) In the ALSA device | 10 // (1) In the ALSA device |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "base/scoped_ptr.h" | 36 #include "base/scoped_ptr.h" |
| 37 #include "base/thread.h" | 37 #include "base/thread.h" |
| 38 #include "media/audio/audio_output.h" | 38 #include "media/audio/audio_output.h" |
| 39 | 39 |
| 40 class Thread; | 40 class Thread; |
| 41 | 41 |
| 42 class AlsaPCMOutputStream : | 42 class AlsaPCMOutputStream : |
| 43 public AudioOutputStream, | 43 public AudioOutputStream, |
| 44 public base::RefCountedThreadSafe<AlsaPCMOutputStream> { | 44 public base::RefCountedThreadSafe<AlsaPCMOutputStream> { |
| 45 public: | 45 public: |
| 46 // Set to "plug:default" which should allow ALSA to do whatever is | 46 // Set to "default" which should avoid locking the sound device and allow |
| 47 // necessary to simulate an audio device capable of handling our PCMs. | 47 // ALSA to multiplex sound from different processes that want to write PCM |
| 48 // data. |
| 48 static const char* kDefaultDevice; | 49 static const char* kDefaultDevice; |
| 49 | 50 |
| 50 // Create a PCM Output stream for the ALSA device identified by | 51 // Create a PCM Output stream for the ALSA device identified by |
| 51 // |device_name|. If unsure of hte device_name, use kDefaultDevice. | 52 // |device_name|. If unsure of hte device_name, use kDefaultDevice. |
| 52 AlsaPCMOutputStream(const std::string& device_name, | 53 AlsaPCMOutputStream(const std::string& device_name, |
| 53 int min_buffer_ms, | 54 int min_buffer_ms, |
| 54 AudioManager::Format format, | 55 AudioManager::Format format, |
| 55 int channels, | 56 int channels, |
| 56 int sample_rate, | 57 int sample_rate, |
| 57 char bits_per_sample); | 58 char bits_per_sample); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // FillAlsaDeviceBuffer() methods. | 157 // FillAlsaDeviceBuffer() methods. |
| 157 bool device_write_suspended_; | 158 bool device_write_suspended_; |
| 158 | 159 |
| 159 // Flag indicating that the resources are already cleaned. | 160 // Flag indicating that the resources are already cleaned. |
| 160 bool resources_released_; | 161 bool resources_released_; |
| 161 | 162 |
| 162 DISALLOW_COPY_AND_ASSIGN(AlsaPCMOutputStream); | 163 DISALLOW_COPY_AND_ASSIGN(AlsaPCMOutputStream); |
| 163 }; | 164 }; |
| 164 | 165 |
| 165 #endif // MEDIA_AUDIO_LINUX_ALSA_OUTPUT_H_ | 166 #endif // MEDIA_AUDIO_LINUX_ALSA_OUTPUT_H_ |
| OLD | NEW |