| Index: media/audio/alsa/alsa_output.cc
|
| diff --git a/media/audio/alsa/alsa_output.cc b/media/audio/alsa/alsa_output.cc
|
| index 27ab0d1fd2002cd7d38ba86de355a1f8abd6f1f2..d3b2ccee873678e2ce5efaaee2785dc39affd1f8 100644
|
| --- a/media/audio/alsa/alsa_output.cc
|
| +++ b/media/audio/alsa/alsa_output.cc
|
| @@ -125,7 +125,7 @@ std::ostream& operator<<(std::ostream& os,
|
| case AlsaPcmOutputStream::kIsClosed:
|
| os << "kIsClosed";
|
| break;
|
| - };
|
| + }
|
| return os;
|
| }
|
|
|
| @@ -361,13 +361,14 @@ void AlsaPcmOutputStream::BufferPacket(bool* source_exhausted) {
|
| // WritePacket() consumes only the current chunk of data.
|
| if (!buffer_->forward_bytes()) {
|
| // Before making a request to source for data we need to determine the
|
| - // delay (in bytes) for the requested data to be played.
|
| - const uint32_t hardware_delay = GetCurrentDelay() * bytes_per_frame_;
|
| + // time when the requested data will be played.
|
| + const base::TimeTicks target_playout_time =
|
| + base::TimeTicks::Now() +
|
| + FramesToTimeDelta(GetCurrentDelay(), sample_rate_);
|
|
|
| scoped_refptr<media::DataBuffer> packet =
|
| new media::DataBuffer(packet_size_);
|
| - int frames_filled = RunDataCallback(
|
| - audio_bus_.get(), hardware_delay);
|
| + int frames_filled = RunDataCallback(target_playout_time, audio_bus_.get());
|
|
|
| size_t packet_size = frames_filled * bytes_per_frame_;
|
| DCHECK_LE(packet_size, packet_size_);
|
| @@ -777,12 +778,12 @@ AlsaPcmOutputStream::InternalState AlsaPcmOutputStream::state() {
|
| return state_;
|
| }
|
|
|
| -int AlsaPcmOutputStream::RunDataCallback(AudioBus* audio_bus,
|
| - uint32_t total_bytes_delay) {
|
| +int AlsaPcmOutputStream::RunDataCallback(base::TimeTicks target_playout_time,
|
| + AudioBus* audio_bus) {
|
| TRACE_EVENT0("audio", "AlsaPcmOutputStream::RunDataCallback");
|
|
|
| if (source_callback_)
|
| - return source_callback_->OnMoreData(audio_bus, total_bytes_delay, 0);
|
| + return source_callback_->OnMoreData(target_playout_time, 0, audio_bus);
|
|
|
| return 0;
|
| }
|
|
|