Skip to content

Commit

Permalink
BufferingState::SetMaxRenderingTime was never being called.
Browse files Browse the repository at this point in the history
Also added a cap to reported max rendering time to prevent
interpolation too far ahead.

Bug=408189

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

Cr-Commit-Position: refs/heads/master@{#307350}
  • Loading branch information
halliwell authored and Commit bot committed Dec 8, 2014
1 parent 7f0248f commit a38a63a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions chromecast/media/cma/pipeline/av_pipeline_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ void AvPipelineImpl::ProcessPendingBuffer() {
}
}

if (!pending_buffer_->end_of_stream() && buffering_state_.get()) {
base::TimeDelta timestamp = pending_buffer_->timestamp();
if (timestamp != ::media::kNoTimestamp())
buffering_state_->SetMaxRenderingTime(timestamp);
}

MediaComponentDevice::FrameStatus status = media_component_device_->PushFrame(
decrypt_context,
pending_buffer_,
Expand Down
6 changes: 6 additions & 0 deletions chromecast/media/cma/pipeline/media_pipeline_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,16 @@ void MediaPipelineImpl::UpdateMediaTime() {
if (buffering_controller_) {
buffering_controller_->SetMediaTime(media_time);

// Receiving the same time twice in a row means playback isn't moving,
// so don't interpolate ahead.
if (media_time != last_media_time_) {
max_rendering_time = buffering_controller_->GetMaxRenderingTime();
if (max_rendering_time == ::media::kNoTimestamp())
max_rendering_time = media_time;

// Cap interpolation time to avoid interpolating too far ahead.
max_rendering_time =
std::min(max_rendering_time, media_time + 2 * kTimeUpdateInterval);
}
}

Expand Down

0 comments on commit a38a63a

Please sign in to comment.