Chromium Code Reviews| Index: media/audio/audio_input_device.cc |
| diff --git a/media/audio/audio_input_device.cc b/media/audio/audio_input_device.cc |
| index f57284c187f7af16f1b0167a404dca3e4bc9c4c1..d56204bc7f726a8f3aff668c17b7859e9e555e71 100644 |
| --- a/media/audio/audio_input_device.cc |
| +++ b/media/audio/audio_input_device.cc |
| @@ -297,21 +297,18 @@ void AudioInputDevice::AudioThreadCallback::Process(int pending_data) { |
| double volume = buffer->params.volume; |
| bool key_pressed = buffer->params.key_pressed; |
| - int audio_delay_milliseconds = pending_data / bytes_per_ms_; |
| - int16* memory = reinterpret_cast<int16*>(&buffer->audio[0]); |
| - const int bytes_per_sample = sizeof(memory[0]); |
| - |
| - if (++current_segment_id_ >= total_segments_) |
| - current_segment_id_ = 0; |
| - |
| - // Deinterleave each channel and convert to 32-bit floating-point |
| - // with nominal range -1.0 -> +1.0. |
| - audio_bus_->FromInterleaved(memory, audio_bus_->frames(), bytes_per_sample); |
| + // Create audio bus wrapping existing block of shared memory. |
|
henrika (OOO until Aug 14)
2014/06/04 11:58:50
...and here.
|
| + scoped_ptr<AudioBus> audio_bus = |
| + AudioBus::WrapMemory(audio_parameters_, &buffer->audio[0]); |
| // Deliver captured data to the client in floating point format |
| // and update the audio-delay measurement. |
| + int audio_delay_milliseconds = pending_data / bytes_per_ms_; |
| capture_callback_->Capture( |
| - audio_bus_.get(), audio_delay_milliseconds, volume, key_pressed); |
| + audio_bus.get(), audio_delay_milliseconds, volume, key_pressed); |
| + |
| + if (++current_segment_id_ >= total_segments_) |
| + current_segment_id_ = 0; |
| } |
| } // namespace media |