| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_ALSA_ALSA_INPUT_H_ | 5 #ifndef MEDIA_AUDIO_ALSA_ALSA_INPUT_H_ |
| 6 #define MEDIA_AUDIO_ALSA_ALSA_INPUT_H_ | 6 #define MEDIA_AUDIO_ALSA_ALSA_INPUT_H_ |
| 7 | 7 |
| 8 #include <alsa/asoundlib.h> | 8 #include <alsa/asoundlib.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> |
| 11 #include <string> | 12 #include <string> |
| 12 | 13 |
| 13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" | |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "media/audio/agc_audio_stream.h" | 18 #include "media/audio/agc_audio_stream.h" |
| 19 #include "media/audio/audio_io.h" | 19 #include "media/audio/audio_io.h" |
| 20 #include "media/base/audio_parameters.h" | 20 #include "media/base/audio_parameters.h" |
| 21 | 21 |
| 22 namespace media { | 22 namespace media { |
| 23 | 23 |
| 24 class AlsaWrapper; | 24 class AlsaWrapper; |
| 25 class AudioManagerBase; | 25 class AudioManagerBase; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 std::string device_name_; | 76 std::string device_name_; |
| 77 AudioParameters params_; | 77 AudioParameters params_; |
| 78 int bytes_per_buffer_; | 78 int bytes_per_buffer_; |
| 79 AlsaWrapper* wrapper_; | 79 AlsaWrapper* wrapper_; |
| 80 base::TimeDelta buffer_duration_; // Length of each recorded buffer. | 80 base::TimeDelta buffer_duration_; // Length of each recorded buffer. |
| 81 AudioInputCallback* callback_; // Valid during a recording session. | 81 AudioInputCallback* callback_; // Valid during a recording session. |
| 82 base::TimeTicks next_read_time_; // Scheduled time for next read callback. | 82 base::TimeTicks next_read_time_; // Scheduled time for next read callback. |
| 83 snd_pcm_t* device_handle_; // Handle to the ALSA PCM recording device. | 83 snd_pcm_t* device_handle_; // Handle to the ALSA PCM recording device. |
| 84 snd_mixer_t* mixer_handle_; // Handle to the ALSA microphone mixer. | 84 snd_mixer_t* mixer_handle_; // Handle to the ALSA microphone mixer. |
| 85 snd_mixer_elem_t* mixer_element_handle_; // Handle to the capture element. | 85 snd_mixer_elem_t* mixer_element_handle_; // Handle to the capture element. |
| 86 scoped_ptr<uint8_t[]> audio_buffer_; // Buffer used for reading audio data. | 86 // Buffer used for reading audio data. |
| 87 std::unique_ptr<uint8_t[]> audio_buffer_; |
| 87 bool read_callback_behind_schedule_; | 88 bool read_callback_behind_schedule_; |
| 88 scoped_ptr<AudioBus> audio_bus_; | 89 std::unique_ptr<AudioBus> audio_bus_; |
| 89 | 90 |
| 90 // NOTE: Weak pointers must be invalidated before all other member variables. | 91 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 91 base::WeakPtrFactory<AlsaPcmInputStream> weak_factory_; | 92 base::WeakPtrFactory<AlsaPcmInputStream> weak_factory_; |
| 92 | 93 |
| 93 DISALLOW_COPY_AND_ASSIGN(AlsaPcmInputStream); | 94 DISALLOW_COPY_AND_ASSIGN(AlsaPcmInputStream); |
| 94 }; | 95 }; |
| 95 | 96 |
| 96 } // namespace media | 97 } // namespace media |
| 97 | 98 |
| 98 #endif // MEDIA_AUDIO_ALSA_ALSA_INPUT_H_ | 99 #endif // MEDIA_AUDIO_ALSA_ALSA_INPUT_H_ |
| OLD | NEW |