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..4212dfb1ef249f201a0603d4274485237eff51ae 100644 |
--- a/media/audio/android/opensles_output.cc |
+++ b/media/audio/android/opensles_output.cc |
@@ -6,6 +6,7 @@ |
#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" |
@@ -340,16 +341,15 @@ 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 = |
+ const base::TimeTicks target_playout_time = |
err == SL_RESULT_SUCCESS |
- ? -delay_calculator_.GetFramesToTarget( |
- base::TimeDelta::FromMilliseconds(position_in_ms)) * |
- bytes_per_frame_ |
- : 0; |
- DCHECK_GE(delay, 0); |
+ ? base::TimeTicks::Now() - |
chcunningham
2016/07/29 01:21:09
I don't follow your math here. I think what you wa
jameswest
2016/08/26 02:08:47
Done.
|
+ base::TimeDelta::FromMilliseconds(position_in_ms) |
+ : base::TimeTicks(); |
chcunningham
2016/07/29 01:21:09
I don't think you want 0 ticks here. I think you w
jameswest
2016/08/26 02:08:47
Done.
|
+ DCHECK_GE(target_playout_time, base::TimeTicks()); |
chcunningham
2016/07/29 01:21:09
Still use this to check delay >= 0 if you take my
jameswest
2016/08/26 02:08:47
Done.
|
// 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, 0, audio_bus_.get()); |
if (frames_filled <= 0) { |
// Audio source is shutting down, or halted on error. |
return; |