| Index: media/audio/android/opensles_output.cc
|
| diff --git a/media/audio/android/opensles_output.cc b/media/audio/android/opensles_output.cc
|
| index 87daa9c6f8fbb690a8b20bc443c11cc272147b1f..5dc916ae03a565994736814dfee7d47ba2fc332d 100644
|
| --- a/media/audio/android/opensles_output.cc
|
| +++ b/media/audio/android/opensles_output.cc
|
| @@ -87,13 +87,11 @@ void OpenSLESOutputStream::Start(AudioSourceCallback* callback) {
|
| base::AutoLock lock(lock_);
|
| DCHECK(!callback_);
|
| callback_ = callback;
|
| - delay_calculator_.SetBaseTimestamp(base::TimeDelta());
|
|
|
| // Fill audio data with silence to avoid start-up glitches. Don't use
|
| // FillBufferQueueNoLock() since it can trigger recursive entry if an error
|
| // occurs while writing into the stream. See http://crbug.com/624877.
|
| memset(audio_data_[active_buffer_index_], 0, buffer_size_bytes_);
|
| - delay_calculator_.AddFrames(audio_bus_->frames());
|
| LOG_ON_FAILURE_AND_RETURN((*simple_buffer_queue_)
|
| ->Enqueue(simple_buffer_queue_,
|
| audio_data_[active_buffer_index_],
|
| @@ -106,6 +104,15 @@ void OpenSLESOutputStream::Start(AudioSourceCallback* callback) {
|
| LOG_ON_FAILURE_AND_RETURN(
|
| (*player_)->SetPlayState(player_, SL_PLAYSTATE_PLAYING));
|
|
|
| + // On older version of Android, the position may not be reset even though we
|
| + // call Clear() during Stop(), in this case the best we can do is assume that
|
| + // we're continuing on from this previous position.
|
| + uint32_t position_in_ms = 0;
|
| + LOG_ON_FAILURE_AND_RETURN((*player_)->GetPosition(player_, &position_in_ms));
|
| + delay_calculator_.SetBaseTimestamp(
|
| + base::TimeDelta::FromMilliseconds(position_in_ms));
|
| + delay_calculator_.AddFrames(audio_bus_->frames());
|
| +
|
| started_ = true;
|
| }
|
|
|
|
|