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 audio output stream based on the PulseAudio asynchronous API. | 5 // Creates an audio output stream based on the PulseAudio asynchronous API. |
6 // | 6 // |
7 // If the stream is successfully opened, Close() must be called before the | 7 // If the stream is successfully opened, Close() must be called before the |
8 // stream is deleted as Close() is responsible for ensuring resource cleanup | 8 // stream is deleted as Close() is responsible for ensuring resource cleanup |
9 // occurs. | 9 // occurs. |
10 // | 10 // |
11 // This object is designed so that all AudioOutputStream methods will be called | 11 // This object is designed so that all AudioOutputStream methods will be called |
12 // on the same thread that created the object. | 12 // on the same thread that created the object. |
13 // | 13 // |
14 // WARNING: This object blocks on internal PulseAudio calls in Open() while | 14 // WARNING: This object blocks on internal PulseAudio calls in Open() while |
15 // waiting for PulseAudio's context structure to be ready. It also blocks in | 15 // waiting for PulseAudio's context structure to be ready. It also blocks in |
16 // inside PulseAudio in Start() and repeated during playback, waiting for | 16 // inside PulseAudio in Start() and repeated during playback, waiting for |
17 // PulseAudio write callbacks to occur. | 17 // PulseAudio write callbacks to occur. |
18 | 18 |
19 #ifndef MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ | 19 #ifndef MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ |
20 #define MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ | 20 #define MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ |
21 | 21 |
22 #include <pulse/pulseaudio.h> | 22 #include <pulse/pulseaudio.h> |
23 | 23 |
24 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
25 #include "base/memory/weak_ptr.h" | 25 #include "base/memory/weak_ptr.h" |
26 #include "media/audio/audio_io.h" | 26 #include "media/audio/audio_io.h" |
27 #include "media/base/channel_layout.h" | 27 #include "media/base/channel_layout.h" |
28 | 28 |
29 namespace media { | 29 namespace media { |
| 30 |
30 class SeekableBuffer; | 31 class SeekableBuffer; |
31 } | |
32 | 32 |
33 #if defined(OS_LINUX) | 33 #if defined(OS_LINUX) |
34 class AudioManagerLinux; | 34 class AudioManagerLinux; |
35 typedef AudioManagerLinux AudioManagerPulse; | 35 typedef AudioManagerLinux AudioManagerPulse; |
36 #elif defined(OS_OPENBSD) | 36 #elif defined(OS_OPENBSD) |
37 class AudioManagerOpenBSD; | 37 class AudioManagerOpenBSD; |
38 typedef AudioManagerOpenBSD AudioManagerPulse; | 38 typedef AudioManagerOpenBSD AudioManagerPulse; |
39 #else | 39 #else |
40 #error Unsupported platform | 40 #error Unsupported platform |
41 #endif | 41 #endif |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // Allows us to run tasks on the PulseAudioOutputStream instance which are | 123 // Allows us to run tasks on the PulseAudioOutputStream instance which are |
124 // bound by its lifetime. | 124 // bound by its lifetime. |
125 base::WeakPtrFactory<PulseAudioOutputStream> weak_factory_; | 125 base::WeakPtrFactory<PulseAudioOutputStream> weak_factory_; |
126 | 126 |
127 // Callback to audio data source. | 127 // Callback to audio data source. |
128 AudioSourceCallback* source_callback_; | 128 AudioSourceCallback* source_callback_; |
129 | 129 |
130 DISALLOW_COPY_AND_ASSIGN(PulseAudioOutputStream); | 130 DISALLOW_COPY_AND_ASSIGN(PulseAudioOutputStream); |
131 }; | 131 }; |
132 | 132 |
| 133 } // namespace media |
| 134 |
133 #endif // MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ | 135 #endif // MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ |
OLD | NEW |