Commit c49e7c55 authored by dalecurtis's avatar dalecurtis Committed by Commit bot

Don't return wall clock times when time isn't ticking.

The video renderer may request wall clock times before the audio
renderer has notified the renderer that it has underflowed.  We
should refuse to convert wall clock times as soon as an underflow
state is detected, instead of waiting for the renderer to pause
everything on the media thread (which may be backed up for decoding
or other events).

BUG=489503
TEST=modified underflow test.

Review URL: https://codereview.chromium.org/1137323005

Cr-Commit-Position: refs/heads/master@{#330481}
parent 19452ceb
......@@ -170,8 +170,10 @@ bool AudioRendererImpl::GetWallClockTimes(
const std::vector<base::TimeDelta>& media_timestamps,
std::vector<base::TimeTicks>* wall_clock_times) {
base::AutoLock auto_lock(lock_);
if (last_render_ticks_.is_null() || !playback_rate_)
if (last_render_ticks_.is_null() || !playback_rate_ ||
buffering_state_ != BUFFERING_HAVE_ENOUGH || !sink_playing_) {
return false;
}
DCHECK(wall_clock_times->empty());
wall_clock_times->reserve(media_timestamps.size());
......
......@@ -519,6 +519,10 @@ TEST_F(AudioRendererImplTest, Underflow_Flush) {
WaitForPendingRead();
StopTicking();
// After time stops ticking wall clock times should not be returned.
EXPECT_FALSE(
renderer_->GetWallClockTimes(std::vector<base::TimeDelta>(1), nullptr));
// We shouldn't expect another buffering state change when flushing.
FlushDuringPendingRead();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment