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

Side by Side Diff: media/filters/video_renderer_base.cc

Issue 6259012: Fix frame-exact seeking again to stay within duration as opposed to rounding to the closest frame. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | media/filters/video_renderer_base_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/callback.h" 5 #include "base/callback.h"
6 #include "base/threading/platform_thread.h" 6 #include "base/threading/platform_thread.h"
7 #include "media/base/buffers.h" 7 #include "media/base/buffers.h"
8 #include "media/base/callback.h" 8 #include "media/base/callback.h"
9 #include "media/base/filter_host.h" 9 #include "media/base/filter_host.h"
10 #include "media/base/limits.h" 10 #include "media/base/limits.h"
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 // transfer out-bounding buffer. We do not flush buffer when Compositor 401 // transfer out-bounding buffer. We do not flush buffer when Compositor
402 // hold reference to our video frame either. 402 // hold reference to our video frame either.
403 if (state_ == kFlushing && pending_paint_ == false) 403 if (state_ == kFlushing && pending_paint_ == false)
404 FlushBuffers(); 404 FlushBuffers();
405 405
406 return; 406 return;
407 } 407 }
408 408
409 // Discard frames until we reach our desired seek timestamp. 409 // Discard frames until we reach our desired seek timestamp.
410 if (state_ == kSeeking && !frame->IsEndOfStream() && 410 if (state_ == kSeeking && !frame->IsEndOfStream() &&
411 (frame->GetTimestamp() + frame->GetDuration() / 2) < seek_timestamp_) { 411 (frame->GetTimestamp() + frame->GetDuration()) <= seek_timestamp_) {
412 frames_queue_done_.push_back(frame); 412 frames_queue_done_.push_back(frame);
413 ScheduleRead_Locked(); 413 ScheduleRead_Locked();
414 } else { 414 } else {
415 frames_queue_ready_.push_back(frame); 415 frames_queue_ready_.push_back(frame);
416 DCHECK_LE(frames_queue_ready_.size(), 416 DCHECK_LE(frames_queue_ready_.size(),
417 static_cast<size_t>(Limits::kMaxVideoFrames)); 417 static_cast<size_t>(Limits::kMaxVideoFrames));
418 frame_available_.Signal(); 418 frame_available_.Signal();
419 } 419 }
420 420
421 // Check for our preroll complete condition. 421 // Check for our preroll complete condition.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 previous_time_ = now; 541 previous_time_ = now;
542 } 542 }
543 543
544 // Scale our sleep based on the playback rate. 544 // Scale our sleep based on the playback rate.
545 // TODO(scherkus): floating point badness and degrade gracefully. 545 // TODO(scherkus): floating point badness and degrade gracefully.
546 return base::TimeDelta::FromMicroseconds( 546 return base::TimeDelta::FromMicroseconds(
547 static_cast<int64>(sleep.InMicroseconds() / playback_rate)); 547 static_cast<int64>(sleep.InMicroseconds() / playback_rate));
548 } 548 }
549 549
550 } // namespace media 550 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/filters/video_renderer_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698