| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // garbage collection pauses and it supports reduced audio output latency. | 45 // garbage collection pauses and it supports reduced audio output latency. |
| 46 // If the device doesn't claim this feature but supports API level 9 (Android | 46 // If the device doesn't claim this feature but supports API level 9 (Android |
| 47 // platform version 2.3) or later, then we can still use the OpenSL ES APIs but | 47 // platform version 2.3) or later, then we can still use the OpenSL ES APIs but |
| 48 // the output latency may be higher. | 48 // the output latency may be higher. |
| 49 class OpenSLESPlayer { | 49 class OpenSLESPlayer { |
| 50 public: | 50 public: |
| 51 // The lower output latency path is used only if the application requests a | 51 // The lower output latency path is used only if the application requests a |
| 52 // buffer count of 2 or more, and a buffer size and sample rate that are | 52 // buffer count of 2 or more, and a buffer size and sample rate that are |
| 53 // compatible with the device's native output configuration provided via the | 53 // compatible with the device's native output configuration provided via the |
| 54 // audio manager at construction. | 54 // audio manager at construction. |
| 55 static const int kNumOfOpenSLESBuffers = 2; | 55 static const int kNumOfOpenSLESBuffers = 4; |
| 56 | 56 |
| 57 // There is no need for this class to use JNI. | 57 // There is no need for this class to use JNI. |
| 58 static int32_t SetAndroidAudioDeviceObjects(void* javaVM, void* context) { | 58 static int32_t SetAndroidAudioDeviceObjects(void* javaVM, void* context) { |
| 59 return 0; | 59 return 0; |
| 60 } | 60 } |
| 61 static void ClearAndroidAudioDeviceObjects() {} | 61 static void ClearAndroidAudioDeviceObjects() {} |
| 62 | 62 |
| 63 explicit OpenSLESPlayer(AudioManager* audio_manager); | 63 explicit OpenSLESPlayer(AudioManager* audio_manager); |
| 64 ~OpenSLESPlayer(); | 64 ~OpenSLESPlayer(); |
| 65 | 65 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 SLPlayItf player_; | 188 SLPlayItf player_; |
| 189 | 189 |
| 190 // The Android Simple Buffer Queue interface is supported on the audio player | 190 // The Android Simple Buffer Queue interface is supported on the audio player |
| 191 // and it provides methods to send audio data from the source to the audio | 191 // and it provides methods to send audio data from the source to the audio |
| 192 // player for rendering. | 192 // player for rendering. |
| 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 |
| 199 // Last time the OpenSL ES layer asked for audio data to play out. |
| 200 uint32_t last_play_time_; |
| 198 }; | 201 }; |
| 199 | 202 |
| 200 } // namespace webrtc | 203 } // namespace webrtc |
| 201 | 204 |
| 202 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_PLAYER_H_ | 205 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_PLAYER_H_ |
| OLD | NEW |