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 // specifically using the pa_threaded_mainloop model. | 6 // specifically using the pa_threaded_mainloop model. |
7 // | 7 // |
8 // If the stream is successfully opened, Close() must be called before the | 8 // If the stream is successfully opened, Close() must be called before the |
9 // stream is deleted as Close() is responsible for ensuring resource cleanup | 9 // stream is deleted as Close() is responsible for ensuring resource cleanup |
10 // occurs. | 10 // occurs. |
11 // | 11 // |
12 // This object is designed so that all AudioOutputStream methods will be called | 12 // This object is designed so that all AudioOutputStream methods will be called |
13 // on the same thread that created the object. | 13 // on the same thread that created the object. |
14 // | 14 // |
15 // WARNING: This object blocks on internal PulseAudio calls in Open() while | 15 // WARNING: This object blocks on internal PulseAudio calls in Open() while |
16 // waiting for PulseAudio's context structure to be ready. It also blocks in | 16 // waiting for PulseAudio's context structure to be ready. It also blocks in |
17 // inside PulseAudio in Start() and repeated during playback, waiting for | 17 // inside PulseAudio in Start() and repeated during playback, waiting for |
18 // PulseAudio write callbacks to occur. | 18 // PulseAudio write callbacks to occur. |
19 | 19 |
20 #ifndef MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ | 20 #ifndef MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ |
21 #define MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ | 21 #define MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ |
22 | 22 |
23 #include <string> | 23 #include <string> |
24 | 24 |
25 #include "base/memory/scoped_ptr.h" | 25 #include "base/memory/scoped_ptr.h" |
26 #include "base/threading/thread_checker.h" | |
27 #include "media/audio/audio_io.h" | 26 #include "media/audio/audio_io.h" |
28 #include "media/audio/audio_parameters.h" | 27 #include "media/audio/audio_parameters.h" |
29 | 28 |
30 struct pa_context; | 29 struct pa_context; |
31 struct pa_operation; | 30 struct pa_operation; |
32 struct pa_stream; | 31 struct pa_stream; |
33 struct pa_threaded_mainloop; | 32 struct pa_threaded_mainloop; |
34 | 33 |
35 namespace media { | 34 namespace media { |
36 class AudioManagerBase; | 35 class AudioManagerBase; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // Float representation of volume from 0.0 to 1.0. | 83 // Float representation of volume from 0.0 to 1.0. |
85 float volume_; | 84 float volume_; |
86 | 85 |
87 // Callback to audio data source. Must only be modified while holding a lock | 86 // Callback to audio data source. Must only be modified while holding a lock |
88 // on |pa_mainloop_| via pa_threaded_mainloop_lock(). | 87 // on |pa_mainloop_| via pa_threaded_mainloop_lock(). |
89 AudioSourceCallback* source_callback_; | 88 AudioSourceCallback* source_callback_; |
90 | 89 |
91 // Container for retrieving data from AudioSourceCallback::OnMoreData(). | 90 // Container for retrieving data from AudioSourceCallback::OnMoreData(). |
92 scoped_ptr<AudioBus> audio_bus_; | 91 scoped_ptr<AudioBus> audio_bus_; |
93 | 92 |
94 base::ThreadChecker thread_checker_; | |
95 | |
96 DISALLOW_COPY_AND_ASSIGN(PulseAudioOutputStream); | 93 DISALLOW_COPY_AND_ASSIGN(PulseAudioOutputStream); |
97 }; | 94 }; |
98 | 95 |
99 } // namespace media | 96 } // namespace media |
100 | 97 |
101 #endif // MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ | 98 #endif // MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ |
OLD | NEW |