| Index: media/audio/android/opensles_output.cc
 | 
| diff --git a/media/audio/android/opensles_output.cc b/media/audio/android/opensles_output.cc
 | 
| index 5dc916ae03a565994736814dfee7d47ba2fc332d..a49a9302588f140aa46a2e01744c55ae49b9f41d 100644
 | 
| --- a/media/audio/android/opensles_output.cc
 | 
| +++ b/media/audio/android/opensles_output.cc
 | 
| @@ -6,8 +6,10 @@
 | 
|  
 | 
|  #include "base/logging.h"
 | 
|  #include "base/macros.h"
 | 
| +#include "base/time/time.h"
 | 
|  #include "base/trace_event/trace_event.h"
 | 
|  #include "media/audio/android/audio_manager_android.h"
 | 
| +#include "media/base/audio_timestamp_helper.h"
 | 
|  
 | 
|  #define LOG_ON_FAILURE_AND_RETURN(op, ...)      \
 | 
|    do {                                          \
 | 
| @@ -340,16 +342,25 @@ void OpenSLESOutputStream::FillBufferQueueNoLock() {
 | 
|    // Calculate the position relative to the number of frames written.
 | 
|    uint32_t position_in_ms = 0;
 | 
|    SLresult err = (*player_)->GetPosition(player_, &position_in_ms);
 | 
| -  const int delay =
 | 
| +  // Given the position of the playback head, compute the approximate number of
 | 
| +  // frames that have been queued to the buffer but not yet played out.
 | 
| +  // Note that the value returned by GetFramesToTarget() is negative because
 | 
| +  // more frames have been added to |delay_calculator_| than have been played
 | 
| +  // out and thus the target timestamp is earlier than the current timestamp of
 | 
| +  // |delay_calculator_|.
 | 
| +  const int delay_frames =
 | 
|        err == SL_RESULT_SUCCESS
 | 
|            ? -delay_calculator_.GetFramesToTarget(
 | 
| -                base::TimeDelta::FromMilliseconds(position_in_ms)) *
 | 
| -                bytes_per_frame_
 | 
| +                base::TimeDelta::FromMilliseconds(position_in_ms))
 | 
|            : 0;
 | 
| -  DCHECK_GE(delay, 0);
 | 
| +  DCHECK_GE(delay_frames, 0);
 | 
| +
 | 
| +  const base::TimeDelta delay =
 | 
| +      AudioTimestampHelper::FramesToTime(delay_frames, format_.samplesPerSec);
 | 
|  
 | 
|    // Read data from the registered client source.
 | 
| -  const int frames_filled = callback_->OnMoreData(audio_bus_.get(), delay, 0);
 | 
| +  const int frames_filled =
 | 
| +      callback_->OnMoreData(delay, base::TimeTicks::Now(), 0, audio_bus_.get());
 | 
|    if (frames_filled <= 0) {
 | 
|      // Audio source is shutting down, or halted on error.
 | 
|      return;
 | 
| 
 |