Chromium Code Reviews| Index: media/audio/audio_low_latency_input_output_unittest.cc |
| diff --git a/media/audio/audio_low_latency_input_output_unittest.cc b/media/audio/audio_low_latency_input_output_unittest.cc |
| index f943963ccfe532eef76efd2dd8bf5c3fc751debc..1b727077eada9f45f3b863f0fc6e1cd63dac5775 100644 |
| --- a/media/audio/audio_low_latency_input_output_unittest.cc |
| +++ b/media/audio/audio_low_latency_input_output_unittest.cc |
| @@ -223,16 +223,18 @@ class FullDuplexAudioSinkSource |
| void OnError(AudioInputStream* stream) override {} |
| // AudioOutputStream::AudioSourceCallback. |
| - int OnMoreData(AudioBus* audio_bus, |
| - uint32_t total_bytes_delay, |
| - uint32_t frames_skipped) override { |
| + int OnMoreData(base::TimeTicks target_playout_time, |
| + int /* prior_frames_skipped */, |
| + AudioBus* dest) override { |
| base::AutoLock lock(lock_); |
| + base::TimeDelta output_delay = target_playout_time - base::TimeTicks::Now(); |
|
chcunningham
2016/07/29 01:21:09
Guard against negative?
jameswest
2016/08/26 02:08:47
Done.
|
| + |
| // Update one component in the AudioDelayState for the packet |
| // which is about to be played out. |
| if (output_elements_to_write_ < kMaxDelayMeasurements) { |
| delay_states_[output_elements_to_write_].output_delay_ms = |
| - BytesToMilliseconds(total_bytes_delay); |
| + output_delay.InMilliseconds(); |
| ++output_elements_to_write_; |
| } |
| @@ -241,11 +243,11 @@ class FullDuplexAudioSinkSource |
| // Read the data from the seekable media buffer which contains |
| // captured data at the same size and sample rate as the output side. |
| if (buffer_->GetCurrentChunk(&source, &size) && size > 0) { |
| - EXPECT_EQ(channels_, audio_bus->channels()); |
| - size = std::min(audio_bus->frames() * frame_size_, size); |
| - EXPECT_EQ(static_cast<size_t>(size) % sizeof(*audio_bus->channel(0)), 0U); |
| - audio_bus->FromInterleaved( |
| - source, size / frame_size_, frame_size_ / channels_); |
| + EXPECT_EQ(channels_, dest->channels()); |
| + size = std::min(dest->frames() * frame_size_, size); |
| + EXPECT_EQ(static_cast<size_t>(size) % sizeof(*dest->channel(0)), 0U); |
| + dest->FromInterleaved(source, size / frame_size_, |
| + frame_size_ / channels_); |
| buffer_->Seek(size); |
| return size / frame_size_; |
| } |