Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1483)

Unified Diff: media/filters/video_renderer_impl.cc

Issue 384943002: Remove media::VideoRenderer::SetPlaybackRate(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/video_renderer_impl.h ('k') | media/filters/video_renderer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/video_renderer_impl.cc
diff --git a/media/filters/video_renderer_impl.cc b/media/filters/video_renderer_impl.cc
index 8735a0a96f2ae2ec6424c453673495e9e163fd51..28d9966386df77daf0d0022d1cd750d9e6812b53 100644
--- a/media/filters/video_renderer_impl.cc
+++ b/media/filters/video_renderer_impl.cc
@@ -34,7 +34,6 @@ VideoRendererImpl::VideoRendererImpl(
thread_(),
pending_read_(false),
drop_frames_(drop_frames),
- playback_rate_(0),
buffering_state_(BUFFERING_HAVE_NOTHING),
paint_cb_(paint_cb),
last_timestamp_(kNoTimestamp()),
@@ -106,12 +105,6 @@ void VideoRendererImpl::Stop(const base::Closure& callback) {
video_frame_stream_.Stop(callback);
}
-void VideoRendererImpl::SetPlaybackRate(float playback_rate) {
- DCHECK(task_runner_->BelongsToCurrentThread());
- base::AutoLock auto_lock(lock_);
- playback_rate_ = playback_rate;
-}
-
void VideoRendererImpl::StartPlayingFrom(base::TimeDelta timestamp) {
DCHECK(task_runner_->BelongsToCurrentThread());
base::AutoLock auto_lock(lock_);
@@ -221,8 +214,7 @@ void VideoRendererImpl::ThreadMain() {
return;
// Remain idle as long as we're not playing.
- if (state_ != kPlaying || playback_rate_ == 0 ||
- buffering_state_ != BUFFERING_HAVE_ENOUGH) {
+ if (state_ != kPlaying || buffering_state_ != BUFFERING_HAVE_ENOUGH) {
UpdateStatsAndWait_Locked(kIdleTimeDelta);
continue;
}
@@ -238,8 +230,9 @@ void VideoRendererImpl::ThreadMain() {
continue;
}
- base::TimeDelta remaining_time =
- CalculateSleepDuration(ready_frames_.front(), playback_rate_);
+ // Determine the current and next presentation timestamps.
+ base::TimeDelta now = get_time_cb_.Run();
+ base::TimeDelta remaining_time = ready_frames_.front()->timestamp() - now;
// Sleep up to a maximum of our idle time until we're within the time to
// render the next frame.
@@ -261,7 +254,6 @@ void VideoRendererImpl::ThreadMain() {
// TODO(scherkus): This can be vastly improved. Use a histogram to measure
// the accuracy of our frame timing code. http://crbug.com/149829
if (drop_frames_ && last_timestamp_ != kNoTimestamp()) {
- base::TimeDelta now = get_time_cb_.Run();
base::TimeDelta deadline = ready_frames_.front()->timestamp() +
(ready_frames_.front()->timestamp() - last_timestamp_) / 2;
@@ -477,19 +469,6 @@ void VideoRendererImpl::OnVideoFrameStreamResetDone() {
base::ResetAndReturn(&flush_cb_).Run();
}
-base::TimeDelta VideoRendererImpl::CalculateSleepDuration(
- const scoped_refptr<VideoFrame>& next_frame,
- float playback_rate) {
- // Determine the current and next presentation timestamps.
- base::TimeDelta now = get_time_cb_.Run();
- base::TimeDelta next_pts = next_frame->timestamp();
-
- // Scale our sleep based on the playback rate.
- base::TimeDelta sleep = next_pts - now;
- return base::TimeDelta::FromMicroseconds(
- static_cast<int64>(sleep.InMicroseconds() / playback_rate));
-}
-
void VideoRendererImpl::DoStopOrError_Locked() {
lock_.AssertAcquired();
last_timestamp_ = kNoTimestamp();
« no previous file with comments | « media/filters/video_renderer_impl.h ('k') | media/filters/video_renderer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698