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

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

Issue 344583002: Modifies AudioInputCallback::OnData and use media::AudioBus instead of plain byte vector (Relanding) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added extra non-pure OnData API Created 6 years, 6 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 | « media/audio/android/opensles_input.h ('k') | media/audio/audio_input_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/android/opensles_input.cc
diff --git a/media/audio/android/opensles_input.cc b/media/audio/android/opensles_input.cc
index b927edb6f7ddb49b23eb73f72a635adfb7799b99..1ef3aaca5ef917379ce0b8da5f9fdfbd961a4dcc 100644
--- a/media/audio/android/opensles_input.cc
+++ b/media/audio/android/opensles_input.cc
@@ -7,6 +7,7 @@
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "media/audio/android/audio_manager_android.h"
+#include "media/base/audio_bus.h"
#define LOG_ON_FAILURE_AND_RETURN(op, ...) \
do { \
@@ -27,7 +28,8 @@ OpenSLESInputStream::OpenSLESInputStream(AudioManagerAndroid* audio_manager,
simple_buffer_queue_(NULL),
active_buffer_index_(0),
buffer_size_bytes_(0),
- started_(false) {
+ started_(false),
+ audio_bus_(media::AudioBus::Create(params)) {
DVLOG(2) << __PRETTY_FUNCTION__;
format_.formatType = SL_DATAFORMAT_PCM;
format_.numChannels = static_cast<SLuint32>(params.channels());
@@ -295,13 +297,14 @@ void OpenSLESInputStream::ReadBufferQueue() {
TRACE_EVENT0("audio", "OpenSLESOutputStream::ReadBufferQueue");
+ // Convert from interleaved format to deinterleaved audio bus format.
+ audio_bus_->FromInterleaved(audio_data_[active_buffer_index_],
+ audio_bus_->frames(),
+ format_.bitsPerSample / 8);
+
// TODO(henrika): Investigate if it is possible to get an accurate
// delay estimation.
- callback_->OnData(this,
- audio_data_[active_buffer_index_],
- buffer_size_bytes_,
- buffer_size_bytes_,
- 0.0);
+ callback_->OnData(this, audio_bus_.get(), buffer_size_bytes_, 0.0);
// Done with this buffer. Send it to device for recording.
SLresult err =
« no previous file with comments | « media/audio/android/opensles_input.h ('k') | media/audio/audio_input_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698