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. |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 class PulseAudioOutputStream : public AudioOutputStream { | 38 class PulseAudioOutputStream : public AudioOutputStream { |
39 public: | 39 public: |
40 PulseAudioOutputStream(const AudioParameters& params, | 40 PulseAudioOutputStream(const AudioParameters& params, |
41 const std::string& device_id, | 41 const std::string& device_id, |
42 AudioManagerBase* manager); | 42 AudioManagerBase* manager); |
43 | 43 |
44 virtual ~PulseAudioOutputStream(); | 44 virtual ~PulseAudioOutputStream(); |
45 | 45 |
46 // Implementation of AudioOutputStream. | 46 // Implementation of AudioOutputStream. |
47 virtual bool Open() OVERRIDE; | 47 virtual bool Open() override; |
48 virtual void Close() OVERRIDE; | 48 virtual void Close() override; |
49 virtual void Start(AudioSourceCallback* callback) OVERRIDE; | 49 virtual void Start(AudioSourceCallback* callback) override; |
50 virtual void Stop() OVERRIDE; | 50 virtual void Stop() override; |
51 virtual void SetVolume(double volume) OVERRIDE; | 51 virtual void SetVolume(double volume) override; |
52 virtual void GetVolume(double* volume) OVERRIDE; | 52 virtual void GetVolume(double* volume) override; |
53 | 53 |
54 private: | 54 private: |
55 // Called by PulseAudio when |pa_stream_| change state. If an unexpected | 55 // Called by PulseAudio when |pa_stream_| change state. If an unexpected |
56 // failure state change happens and |source_callback_| is set | 56 // failure state change happens and |source_callback_| is set |
57 // this method will forward the error via OnError(). | 57 // this method will forward the error via OnError(). |
58 static void StreamNotifyCallback(pa_stream* s, void* p_this); | 58 static void StreamNotifyCallback(pa_stream* s, void* p_this); |
59 | 59 |
60 // Called by PulseAudio when it needs more audio data. | 60 // Called by PulseAudio when it needs more audio data. |
61 static void StreamRequestCallback(pa_stream* s, size_t len, void* p_this); | 61 static void StreamRequestCallback(pa_stream* s, size_t len, void* p_this); |
62 | 62 |
(...skipping 29 matching lines...) Expand all Loading... |
92 scoped_ptr<AudioBus> audio_bus_; | 92 scoped_ptr<AudioBus> audio_bus_; |
93 | 93 |
94 base::ThreadChecker thread_checker_; | 94 base::ThreadChecker thread_checker_; |
95 | 95 |
96 DISALLOW_COPY_AND_ASSIGN(PulseAudioOutputStream); | 96 DISALLOW_COPY_AND_ASSIGN(PulseAudioOutputStream); |
97 }; | 97 }; |
98 | 98 |
99 } // namespace media | 99 } // namespace media |
100 | 100 |
101 #endif // MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ | 101 #endif // MEDIA_AUDIO_PULSE_PULSE_OUTPUT_H_ |
OLD | NEW |