| Index: media/audio/win/wavein_input_win.cc
|
| diff --git a/media/audio/win/wavein_input_win.cc b/media/audio/win/wavein_input_win.cc
|
| index 43a356f908534ce20aa73203669ac134ead97c3f..f12bcf244c54c2269c1cb6085618209b065e4f6a 100644
|
| --- a/media/audio/win/wavein_input_win.cc
|
| +++ b/media/audio/win/wavein_input_win.cc
|
| @@ -10,6 +10,7 @@
|
| #include "media/audio/audio_io.h"
|
| #include "media/audio/win/audio_manager_win.h"
|
| #include "media/audio/win/device_enumeration_win.h"
|
| +#include "media/base/audio_bus.h"
|
|
|
| namespace media {
|
|
|
| @@ -20,7 +21,9 @@ static WAVEHDR* GetNextBuffer(WAVEHDR* current) {
|
| }
|
|
|
| PCMWaveInAudioInputStream::PCMWaveInAudioInputStream(
|
| - AudioManagerWin* manager, const AudioParameters& params, int num_buffers,
|
| + AudioManagerWin* manager,
|
| + const AudioParameters& params,
|
| + int num_buffers,
|
| const std::string& device_id)
|
| : state_(kStateEmpty),
|
| manager_(manager),
|
| @@ -29,7 +32,8 @@ PCMWaveInAudioInputStream::PCMWaveInAudioInputStream(
|
| callback_(NULL),
|
| num_buffers_(num_buffers),
|
| buffer_(NULL),
|
| - channels_(params.channels()) {
|
| + channels_(params.channels()),
|
| + audio_bus_(media::AudioBus::Create(params)) {
|
| DCHECK_GT(num_buffers_, 0);
|
| format_.wFormatTag = WAVE_FORMAT_PCM;
|
| format_.nChannels = params.channels() > 2 ? 2 : params.channels();
|
| @@ -290,11 +294,11 @@ void PCMWaveInAudioInputStream::WaveCallback(HWAVEIN hwi, UINT msg,
|
| // there is currently no support for controlling the microphone volume
|
| // level.
|
| WAVEHDR* buffer = reinterpret_cast<WAVEHDR*>(param1);
|
| - obj->callback_->OnData(obj,
|
| - reinterpret_cast<const uint8*>(buffer->lpData),
|
| - buffer->dwBytesRecorded,
|
| - buffer->dwBytesRecorded,
|
| - 0.0);
|
| + obj->audio_bus_->FromInterleaved(reinterpret_cast<uint8*>(buffer->lpData),
|
| + obj->audio_bus_->frames(),
|
| + obj->format_.wBitsPerSample / 8);
|
| + obj->callback_->OnData(
|
| + obj, obj->audio_bus_.get(), buffer->dwBytesRecorded, 0.0);
|
|
|
| // Queue the finished buffer back with the audio driver. Since we are
|
| // reusing the same buffers we can get away without calling
|
|
|