| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 void* context); | 89 void* context); |
| 90 void FillBufferQueue(); | 90 void FillBufferQueue(); |
| 91 // Reads audio data in PCM format using the AudioDeviceBuffer. | 91 // Reads audio data in PCM format using the AudioDeviceBuffer. |
| 92 // Can be called both on the main thread (during Start()) and from the | 92 // Can be called both on the main thread (during Start()) and from the |
| 93 // internal audio thread while output streaming is active. | 93 // internal audio thread while output streaming is active. |
| 94 void EnqueuePlayoutData(); | 94 void EnqueuePlayoutData(); |
| 95 | 95 |
| 96 // Configures the SL_DATAFORMAT_PCM structure. | 96 // Configures the SL_DATAFORMAT_PCM structure. |
| 97 SLDataFormat_PCM CreatePCMConfiguration(int channels, | 97 SLDataFormat_PCM CreatePCMConfiguration(int channels, |
| 98 int sample_rate, | 98 int sample_rate, |
| 99 int bits_per_sample); | 99 size_t bits_per_sample); |
| 100 | 100 |
| 101 // Allocate memory for audio buffers which will be used to render audio | 101 // Allocate memory for audio buffers which will be used to render audio |
| 102 // via the SLAndroidSimpleBufferQueueItf interface. | 102 // via the SLAndroidSimpleBufferQueueItf interface. |
| 103 void AllocateDataBuffers(); | 103 void AllocateDataBuffers(); |
| 104 | 104 |
| 105 // Creates/destroys the main engine object and the SLEngineItf interface. | 105 // Creates/destroys the main engine object and the SLEngineItf interface. |
| 106 bool CreateEngine(); | 106 bool CreateEngine(); |
| 107 void DestroyEngine(); | 107 void DestroyEngine(); |
| 108 | 108 |
| 109 // Creates/destroys the output mix object. | 109 // Creates/destroys the output mix object. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 138 bool playing_; | 138 bool playing_; |
| 139 | 139 |
| 140 // PCM-type format definition. | 140 // PCM-type format definition. |
| 141 // TODO(henrika): add support for SLAndroidDataFormat_PCM_EX (android-21) if | 141 // TODO(henrika): add support for SLAndroidDataFormat_PCM_EX (android-21) if |
| 142 // 32-bit float representation is needed. | 142 // 32-bit float representation is needed. |
| 143 SLDataFormat_PCM pcm_format_; | 143 SLDataFormat_PCM pcm_format_; |
| 144 | 144 |
| 145 // Number of bytes per audio buffer in each |audio_buffers_[i]|. | 145 // Number of bytes per audio buffer in each |audio_buffers_[i]|. |
| 146 // Typical sizes are 480 or 512 bytes corresponding to native output buffer | 146 // Typical sizes are 480 or 512 bytes corresponding to native output buffer |
| 147 // sizes of 240 or 256 audio frames respectively. | 147 // sizes of 240 or 256 audio frames respectively. |
| 148 int bytes_per_buffer_; | 148 size_t bytes_per_buffer_; |
| 149 | 149 |
| 150 // Queue of audio buffers to be used by the player object for rendering | 150 // Queue of audio buffers to be used by the player object for rendering |
| 151 // audio. They will be used in a Round-robin way and the size of each buffer | 151 // audio. They will be used in a Round-robin way and the size of each buffer |
| 152 // is given by FineAudioBuffer::RequiredBufferSizeBytes(). | 152 // is given by FineAudioBuffer::RequiredBufferSizeBytes(). |
| 153 rtc::scoped_ptr<SLint8[]> audio_buffers_[kNumOfOpenSLESBuffers]; | 153 rtc::scoped_ptr<SLint8[]> audio_buffers_[kNumOfOpenSLESBuffers]; |
| 154 | 154 |
| 155 // FineAudioBuffer takes an AudioDeviceBuffer which delivers audio data | 155 // FineAudioBuffer takes an AudioDeviceBuffer which delivers audio data |
| 156 // in chunks of 10ms. It then allows for this data to be pulled in | 156 // in chunks of 10ms. It then allows for this data to be pulled in |
| 157 // a finer or coarser granularity. I.e. interacting with this class instead | 157 // a finer or coarser granularity. I.e. interacting with this class instead |
| 158 // of directly with the AudioDeviceBuffer one can ask for any number of | 158 // of directly with the AudioDeviceBuffer one can ask for any number of |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 SLAndroidSimpleBufferQueueItf simple_buffer_queue_; | 193 SLAndroidSimpleBufferQueueItf simple_buffer_queue_; |
| 194 | 194 |
| 195 // This interface exposes controls for manipulating the object’s audio volume | 195 // This interface exposes controls for manipulating the object’s audio volume |
| 196 // properties. This interface is supported on the Audio Player object. | 196 // properties. This interface is supported on the Audio Player object. |
| 197 SLVolumeItf volume_; | 197 SLVolumeItf volume_; |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 } // namespace webrtc | 200 } // namespace webrtc |
| 201 | 201 |
| 202 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_PLAYER_H_ | 202 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_PLAYER_H_ |
| OLD | NEW |