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

Unified Diff: webrtc/modules/audio_device/android/opensles_recorder.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
Index: webrtc/modules/audio_device/android/opensles_recorder.cc
diff --git a/webrtc/modules/audio_device/android/opensles_recorder.cc b/webrtc/modules/audio_device/android/opensles_recorder.cc
index 5178d2c149449267c57f6534203a9cca3c978959..9f5de2077426f8152e1fb2fd846c6d7c515aaf9d 100644
--- a/webrtc/modules/audio_device/android/opensles_recorder.cc
+++ b/webrtc/modules/audio_device/android/opensles_recorder.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"
@@ -335,9 +336,9 @@ void OpenSLESRecorder::AllocateDataBuffers() {
audio_parameters_.GetBytesPerBuffer());
ALOGD("native sample rate: %d", audio_parameters_.sample_rate());
RTC_DCHECK(audio_device_buffer_);
- fine_audio_buffer_.reset(new FineAudioBuffer(
- audio_device_buffer_, audio_parameters_.GetBytesPerBuffer(),
- audio_parameters_.sample_rate()));
+ fine_audio_buffer_.reset(
+ new FineAudioBuffer(audio_device_buffer_, audio_parameters_.sample_rate(),
+ 2 * audio_parameters_.GetBytesPerBuffer()));
// Allocate queue of audio buffers that stores recorded audio samples.
const int data_size_bytes = audio_parameters_.GetBytesPerBuffer();
audio_buffers_.reset(new std::unique_ptr<SLint8[]>[kNumOfOpenSLESBuffers]);
@@ -371,7 +372,8 @@ void OpenSLESRecorder::ReadBufferQueue() {
static_cast<size_t>(audio_parameters_.GetBytesPerBuffer());
const int8_t* data =
static_cast<const int8_t*>(audio_buffers_[buffer_index_].get());
- fine_audio_buffer_->DeliverRecordedData(data, size_in_bytes, 25, 25);
+ fine_audio_buffer_->DeliverRecordedData(
+ rtc::ArrayView<const int8_t>(data, size_in_bytes), 25, 25);
// Enqueue the utilized audio buffer and use if for recording again.
EnqueueAudioBuffer();
}
« no previous file with comments | « webrtc/modules/audio_device/android/opensles_player.cc ('k') | webrtc/modules/audio_device/fine_audio_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698