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

Unified Diff: media/audio/mac/audio_low_latency_input_mac.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: fixed SpeechRecognitionBrowserTest 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/mac/audio_low_latency_input_mac.cc
diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc
index bf93358123aea74cfc97c1f3c2b5019e3b59adec..d7a3430f6d85edfcdf8d9ad9fa9d35effec6fe90 100644
--- a/media/audio/mac/audio_low_latency_input_mac.cc
+++ b/media/audio/mac/audio_low_latency_input_mac.cc
@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "base/mac/mac_logging.h"
#include "media/audio/mac/audio_manager_mac.h"
+#include "media/base/audio_bus.h"
#include "media/base/data_buffer.h"
namespace media {
@@ -31,11 +32,10 @@ static std::ostream& operator<<(std::ostream& os,
// http://developer.apple.com/library/mac/#technotes/tn2091/_index.html
// for more details and background regarding this implementation.
-AUAudioInputStream::AUAudioInputStream(
- AudioManagerMac* manager,
- const AudioParameters& input_params,
- const AudioParameters& output_params,
- AudioDeviceID audio_device_id)
+AUAudioInputStream::AUAudioInputStream(AudioManagerMac* manager,
+ const AudioParameters& input_params,
+ const AudioParameters& output_params,
+ AudioDeviceID audio_device_id)
: manager_(manager),
sink_(NULL),
audio_unit_(0),
@@ -43,7 +43,8 @@ AUAudioInputStream::AUAudioInputStream(
started_(false),
hardware_latency_frames_(0),
fifo_delay_bytes_(0),
- number_of_channels_in_frame_(0) {
+ number_of_channels_in_frame_(0),
+ audio_bus_(media::AudioBus::Create(input_params)) {
DCHECK(manager_);
// Set up the desired (output) format specified by the client.
@@ -542,12 +543,13 @@ OSStatus AUAudioInputStream::Provide(UInt32 number_of_frames,
// Read from FIFO into temporary data buffer.
fifo_->Read(data_->writable_data(), requested_size_bytes_);
+ // Copy captured (and interleaved) data into deinterleaved audio bus.
+ audio_bus_->FromInterleaved(
+ data_->data(), audio_bus_->frames(), format_.mBitsPerChannel / 8);
+
// Deliver data packet, delay estimation and volume level to the user.
- sink_->OnData(this,
- data_->data(),
- requested_size_bytes_,
- capture_delay_bytes,
- normalized_volume);
+ sink_->OnData(
+ this, audio_bus_.get(), capture_delay_bytes, normalized_volume);
}
return noErr;

Powered by Google App Engine
This is Rietveld 408576698