| Index: media/audio/alsa/alsa_input.cc
|
| diff --git a/media/audio/alsa/alsa_input.cc b/media/audio/alsa/alsa_input.cc
|
| index be414868ad91a7ac44eda71ef9b8f1577b471b0c..305d38950dd1936d42ba43c98fb2414ac961e102 100644
|
| --- a/media/audio/alsa/alsa_input.cc
|
| +++ b/media/audio/alsa/alsa_input.cc
|
| @@ -200,8 +200,8 @@ void AlsaPcmInputStream::ReadAudio() {
|
| }
|
|
|
| int num_buffers = frames / params_.frames_per_buffer();
|
| - uint32_t hardware_delay_bytes =
|
| - static_cast<uint32_t>(GetCurrentDelay() * params_.GetBytesPerFrame());
|
| + base::TimeDelta hardware_delay = base::TimeDelta::FromSecondsD(
|
| + GetCurrentDelay() / static_cast<double>(params_.sample_rate()));
|
| double normalized_volume = 0.0;
|
|
|
| // Update the AGC volume level once every second. Note that, |volume| is
|
| @@ -213,11 +213,10 @@ void AlsaPcmInputStream::ReadAudio() {
|
| int frames_read = wrapper_->PcmReadi(device_handle_, audio_buffer_.get(),
|
| params_.frames_per_buffer());
|
| if (frames_read == params_.frames_per_buffer()) {
|
| - audio_bus_->FromInterleaved(audio_buffer_.get(),
|
| - audio_bus_->frames(),
|
| + 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);
|
| + callback_->OnData(this, audio_bus_.get(), hardware_delay,
|
| + base::TimeTicks::Now(), normalized_volume);
|
| } else {
|
| LOG(WARNING) << "PcmReadi returning less than expected frames: "
|
| << frames_read << " vs. " << params_.frames_per_buffer()
|
|
|