| 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 #ifndef MEDIA_AUDIO_PULSE_PULSE_INPUT_H_ | 5 #ifndef MEDIA_AUDIO_PULSE_PULSE_INPUT_H_ |
| 6 #define MEDIA_AUDIO_PULSE_PULSE_INPUT_H_ | 6 #define MEDIA_AUDIO_PULSE_PULSE_INPUT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
| 11 #include "media/audio/agc_audio_stream.h" | 11 #include "media/audio/agc_audio_stream.h" |
| 12 #include "media/audio/audio_device_name.h" | 12 #include "media/audio/audio_device_name.h" |
| 13 #include "media/audio/audio_io.h" | 13 #include "media/audio/audio_io.h" |
| 14 #include "media/audio/audio_parameters.h" | 14 #include "media/audio/audio_parameters.h" |
| 15 | 15 |
| 16 struct pa_context; | 16 struct pa_context; |
| 17 struct pa_source_info; | 17 struct pa_source_info; |
| 18 struct pa_stream; | 18 struct pa_stream; |
| 19 struct pa_threaded_mainloop; | 19 struct pa_threaded_mainloop; |
| 20 | 20 |
| 21 namespace media { | 21 namespace media { |
| 22 | 22 |
| 23 class AudioBlockFifo; |
| 23 class AudioManagerPulse; | 24 class AudioManagerPulse; |
| 24 class SeekableBuffer; | |
| 25 | 25 |
| 26 class PulseAudioInputStream : public AgcAudioStream<AudioInputStream> { | 26 class PulseAudioInputStream : public AgcAudioStream<AudioInputStream> { |
| 27 public: | 27 public: |
| 28 PulseAudioInputStream(AudioManagerPulse* audio_manager, | 28 PulseAudioInputStream(AudioManagerPulse* audio_manager, |
| 29 const std::string& device_name, | 29 const std::string& device_name, |
| 30 const AudioParameters& params, | 30 const AudioParameters& params, |
| 31 pa_threaded_mainloop* mainloop, | 31 pa_threaded_mainloop* mainloop, |
| 32 pa_context* context); | 32 pa_context* context); |
| 33 | 33 |
| 34 virtual ~PulseAudioInputStream(); | 34 virtual ~PulseAudioInputStream(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 54 | 54 |
| 55 AudioManagerPulse* audio_manager_; | 55 AudioManagerPulse* audio_manager_; |
| 56 AudioInputCallback* callback_; | 56 AudioInputCallback* callback_; |
| 57 std::string device_name_; | 57 std::string device_name_; |
| 58 AudioParameters params_; | 58 AudioParameters params_; |
| 59 int channels_; | 59 int channels_; |
| 60 double volume_; | 60 double volume_; |
| 61 bool stream_started_; | 61 bool stream_started_; |
| 62 | 62 |
| 63 // Holds the data from the OS. | 63 // Holds the data from the OS. |
| 64 scoped_ptr<media::SeekableBuffer> buffer_; | 64 scoped_ptr<AudioBlockFifo> fifo_; |
| 65 | |
| 66 // Temporary storage for recorded data. It gets a packet of data from | |
| 67 // |buffer_| and deliver the data to OnData() callback. | |
| 68 scoped_ptr<uint8[]> audio_data_buffer_; | |
| 69 | 65 |
| 70 // PulseAudio API structs. | 66 // PulseAudio API structs. |
| 71 pa_threaded_mainloop* pa_mainloop_; // Weak. | 67 pa_threaded_mainloop* pa_mainloop_; // Weak. |
| 72 pa_context* pa_context_; // Weak. | 68 pa_context* pa_context_; // Weak. |
| 73 pa_stream* handle_; | 69 pa_stream* handle_; |
| 74 | 70 |
| 75 // Flag indicating the state of the context has been changed. | 71 // Flag indicating the state of the context has been changed. |
| 76 bool context_state_changed_; | 72 bool context_state_changed_; |
| 77 | 73 |
| 78 scoped_ptr<AudioBus> audio_bus_; | |
| 79 | |
| 80 base::ThreadChecker thread_checker_; | 74 base::ThreadChecker thread_checker_; |
| 81 | 75 |
| 82 DISALLOW_COPY_AND_ASSIGN(PulseAudioInputStream); | 76 DISALLOW_COPY_AND_ASSIGN(PulseAudioInputStream); |
| 83 }; | 77 }; |
| 84 | 78 |
| 85 } // namespace media | 79 } // namespace media |
| 86 | 80 |
| 87 #endif // MEDIA_AUDIO_PULSE_PULSE_INPUT_H_ | 81 #endif // MEDIA_AUDIO_PULSE_PULSE_INPUT_H_ |
| OLD | NEW |