| 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_ANDROID_OPENSLES_INPUT_H_ | 5 #ifndef MEDIA_AUDIO_ANDROID_OPENSLES_INPUT_H_ |
| 6 #define MEDIA_AUDIO_ANDROID_OPENSLES_INPUT_H_ | 6 #define MEDIA_AUDIO_ANDROID_OPENSLES_INPUT_H_ |
| 7 | 7 |
| 8 #include <SLES/OpenSLES.h> | 8 #include <SLES/OpenSLES.h> |
| 9 #include <SLES/OpenSLES_Android.h> | 9 #include <SLES/OpenSLES_Android.h> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
| 14 #include "media/audio/android/opensles_util.h" | 14 #include "media/audio/android/opensles_util.h" |
| 15 #include "media/audio/audio_io.h" | 15 #include "media/audio/audio_io.h" |
| 16 #include "media/audio/audio_parameters.h" | 16 #include "media/audio/audio_parameters.h" |
| 17 | 17 |
| 18 namespace media { | 18 namespace media { |
| 19 | 19 |
| 20 class AudioBus; |
| 20 class AudioManagerAndroid; | 21 class AudioManagerAndroid; |
| 21 | 22 |
| 22 // Implements PCM audio input support for Android using the OpenSLES API. | 23 // Implements PCM audio input support for Android using the OpenSLES API. |
| 23 // This class is created and lives on the Audio Manager thread but recorded | 24 // This class is created and lives on the Audio Manager thread but recorded |
| 24 // audio buffers are delivered on an internal OpenSLES audio thread. All public | 25 // audio buffers are delivered on an internal OpenSLES audio thread. All public |
| 25 // methods should be called on the Audio Manager thread. | 26 // methods should be called on the Audio Manager thread. |
| 26 class OpenSLESInputStream : public AudioInputStream { | 27 class OpenSLESInputStream : public AudioInputStream { |
| 27 public: | 28 public: |
| 28 static const int kMaxNumOfBuffersInQueue = 2; | 29 static const int kMaxNumOfBuffersInQueue = 2; |
| 29 | 30 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 88 |
| 88 // Audio buffers that are allocated in the constructor based on | 89 // Audio buffers that are allocated in the constructor based on |
| 89 // info from audio parameters. | 90 // info from audio parameters. |
| 90 uint8* audio_data_[kMaxNumOfBuffersInQueue]; | 91 uint8* audio_data_[kMaxNumOfBuffersInQueue]; |
| 91 | 92 |
| 92 int active_buffer_index_; | 93 int active_buffer_index_; |
| 93 int buffer_size_bytes_; | 94 int buffer_size_bytes_; |
| 94 | 95 |
| 95 bool started_; | 96 bool started_; |
| 96 | 97 |
| 98 scoped_ptr<media::AudioBus> audio_bus_; |
| 99 |
| 97 DISALLOW_COPY_AND_ASSIGN(OpenSLESInputStream); | 100 DISALLOW_COPY_AND_ASSIGN(OpenSLESInputStream); |
| 98 }; | 101 }; |
| 99 | 102 |
| 100 } // namespace media | 103 } // namespace media |
| 101 | 104 |
| 102 #endif // MEDIA_AUDIO_ANDROID_OPENSLES_INPUT_H_ | 105 #endif // MEDIA_AUDIO_ANDROID_OPENSLES_INPUT_H_ |
| OLD | NEW |