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