Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: webrtc/modules/audio_device/android/opensles_player.cc

Issue 2894873002: Improved audio buffer handling for iOS (Closed)
Patch Set: rebased Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/modules/audio_device/android/opensles_recorder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_device/android/opensles_player.cc
diff --git a/webrtc/modules/audio_device/android/opensles_player.cc b/webrtc/modules/audio_device/android/opensles_player.cc
index 2d305f0ff7406ae67d1aeb1feee2185c80f025dd..f79f4f6ee7b6813d97ea78fb703e48e48fc40b05 100644
--- a/webrtc/modules/audio_device/android/opensles_player.cc
+++ b/webrtc/modules/audio_device/android/opensles_player.cc
@@ -12,6 +12,7 @@
#include <android/log.h>
+#include "webrtc/base/array_view.h"
#include "webrtc/base/arraysize.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/format_macros.h"
@@ -209,9 +210,9 @@ void OpenSLESPlayer::AllocateDataBuffers() {
ALOGD("native buffer size: %" PRIuS, buffer_size_in_bytes);
ALOGD("native buffer size in ms: %.2f",
audio_parameters_.GetBufferSizeInMilliseconds());
- fine_audio_buffer_.reset(
- new FineAudioBuffer(audio_device_buffer_, buffer_size_in_bytes,
- audio_parameters_.sample_rate()));
+ fine_audio_buffer_.reset(new FineAudioBuffer(audio_device_buffer_,
+ audio_parameters_.sample_rate(),
+ 2 * buffer_size_in_bytes));
// Allocated memory for audio buffers.
for (int i = 0; i < kNumOfOpenSLESBuffers; ++i) {
audio_buffers_[i].reset(new SLint8[buffer_size_in_bytes]);
@@ -398,7 +399,8 @@ void OpenSLESPlayer::EnqueuePlayoutData(bool silence) {
// Read audio data from the WebRTC source using the FineAudioBuffer object
// to adjust for differences in buffer size between WebRTC (10ms) and native
// OpenSL ES.
- fine_audio_buffer_->GetPlayoutData(audio_ptr);
+ fine_audio_buffer_->GetPlayoutData(rtc::ArrayView<SLint8>(
+ audio_ptr, audio_parameters_.GetBytesPerBuffer()));
}
// Enqueue the decoded audio buffer for playback.
SLresult err = (*simple_buffer_queue_)
« no previous file with comments | « no previous file | webrtc/modules/audio_device/android/opensles_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698