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

Unified Diff: media/audio/alsa/alsa_input.cc

Issue 314713002: Modifies AudioInputCallback::OnData and use media::AudioBus instead of plain byte vector (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: xians@ 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
Index: media/audio/alsa/alsa_input.cc
diff --git a/media/audio/alsa/alsa_input.cc b/media/audio/alsa/alsa_input.cc
index 9cde236b59154f221b5242483aa130956692a6c1..0bc9f314d45e260a37d81c8238507c78edc79f46 100644
--- a/media/audio/alsa/alsa_input.cc
+++ b/media/audio/alsa/alsa_input.cc
@@ -43,7 +43,9 @@ AlsaPcmInputStream::AlsaPcmInputStream(AudioManagerBase* audio_manager,
mixer_handle_(NULL),
mixer_element_handle_(NULL),
read_callback_behind_schedule_(false),
- weak_factory_(this) {}
+ audio_bus_(AudioBus::Create(params)),
+ weak_factory_(this) {
+}
AlsaPcmInputStream::~AlsaPcmInputStream() {}
@@ -208,8 +210,11 @@ void AlsaPcmInputStream::ReadAudio() {
int frames_read = wrapper_->PcmReadi(device_handle_, audio_buffer_.get(),
params_.frames_per_buffer());
if (frames_read == params_.frames_per_buffer()) {
- callback_->OnData(this, audio_buffer_.get(), bytes_per_buffer_,
- hardware_delay_bytes, normalized_volume);
+ audio_bus_->FromInterleaved(audio_buffer_.get(),
+ audio_bus_->frames(),
+ params_.bits_per_sample() / 8);
+ callback_->OnData(
+ this, audio_bus_.get(), hardware_delay_bytes, normalized_volume);
} else {
LOG(WARNING) << "PcmReadi returning less than expected frames: "
<< frames_read << " vs. " << params_.frames_per_buffer()

Powered by Google App Engine
This is Rietveld 408576698