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

Unified Diff: media/audio/android/opensles_input.cc

Issue 15941002: Fix audio capture buffer handling on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/android/opensles_input.cc
===================================================================
--- media/audio/android/opensles_input.cc (revision 201897)
+++ media/audio/android/opensles_input.cc (working copy)
@@ -71,7 +71,7 @@
SLresult err = SL_RESULT_UNKNOWN_ERROR;
// Enqueues |kNumOfQueuesInBuffer| zero buffers to get the ball rolling.
- for (int i = 0; i < kNumOfQueuesInBuffer - 1; ++i) {
+ for (int i = 0; i < kNumOfQueuesInBuffer; ++i) {
err = (*simple_buffer_queue_)->Enqueue(
simple_buffer_queue_,
audio_data_[i],
@@ -187,7 +187,7 @@
// Audio sink configuration.
SLDataLocator_AndroidSimpleBufferQueue buffer_queue = {
- SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, // Locator type.
+ SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, // Locator type.
static_cast<SLuint32>(kNumOfQueuesInBuffer) // Number of buffers.
};
SLDataSink audio_sink = { &buffer_queue, &format_ };
@@ -258,7 +258,14 @@
if (!started_)
return;
- // Get the enqueued buffer from the soundcard.
+ // TODO(xians): Get an accurate delay estimation.
+ callback_->OnData(this,
+ audio_data_[active_queue_],
+ buffer_size_bytes_,
+ buffer_size_bytes_,
+ 0.0);
+
+ // Done with this buffer. Send it to device for recording.
SLresult err = (*simple_buffer_queue_)->Enqueue(
simple_buffer_queue_,
audio_data_[active_queue_],
@@ -266,13 +273,6 @@
if (SL_RESULT_SUCCESS != err)
HandleError(err);
- // TODO(xians): Get an accurate delay estimation.
- callback_->OnData(this,
- audio_data_[active_queue_],
- buffer_size_bytes_,
- buffer_size_bytes_,
- 0.0);
-
active_queue_ = (active_queue_ + 1) % kNumOfQueuesInBuffer;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698