Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Don't return wall clock times when time isn't ticking.
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
dalecurtis authored and Commit bot committed May 19, 2015
1 parent 19452ce commit c49e7c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion media/renderers/audio_renderer_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
4 changes: 4 additions & 0 deletions media/renderers/audio_renderer_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit c49e7c5

Please sign in to comment.