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

Unified Diff: media/filters/video_renderer_base.cc

Issue 10829200: Fix VideoRendererBase end of stream logic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address more CR comments. Created 8 years, 4 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_base.h ('k') | media/filters/video_renderer_base_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/video_renderer_base.cc
diff --git a/media/filters/video_renderer_base.cc b/media/filters/video_renderer_base.cc
index e4d90c78d2fe70e6fccb40691f393122791d533e..929ac82268712ff99552128b4dd481d8b42dd917 100644
--- a/media/filters/video_renderer_base.cc
+++ b/media/filters/video_renderer_base.cc
@@ -15,6 +15,10 @@
namespace media {
+base::TimeDelta VideoRendererBase::kMaxLastFrameDuration() {
+ return base::TimeDelta::FromMilliseconds(250);
+}
+
VideoRendererBase::VideoRendererBase(const base::Closure& paint_cb,
const SetOpaqueCB& set_opaque_cb,
bool drop_frames)
@@ -484,13 +488,30 @@ void VideoRendererBase::AddReadyFrame(const scoped_refptr<VideoFrame>& frame) {
// frame rate. Another way for this to happen is for the container to state a
// smaller duration than the largest packet timestamp.
base::TimeDelta duration = get_duration_cb_.Run();
- if (frame->GetTimestamp() > duration || frame->IsEndOfStream()) {
+ if (frame->IsEndOfStream()) {
+ base::TimeDelta end_timestamp = kNoTimestamp();
+ if (!ready_frames_.empty()) {
+ end_timestamp = std::min(
+ duration,
+ ready_frames_.back()->GetTimestamp() + kMaxLastFrameDuration());
+ } else if (current_frame_) {
+ end_timestamp =
+ std::min(duration,
+ current_frame_->GetTimestamp() + kMaxLastFrameDuration());
+ }
+ frame->SetTimestamp(end_timestamp);
+ } else if (frame->GetTimestamp() > duration) {
frame->SetTimestamp(duration);
}
ready_frames_.push_back(frame);
DCHECK_LE(NumFrames_Locked(), limits::kMaxVideoFrames);
- time_cb_.Run(frame->GetTimestamp());
+
+ base::TimeDelta maxClockTime =
scherkus (not reviewing) 2012/08/07 23:03:19 unix_hacker
+ frame->IsEndOfStream() ? duration : frame->GetTimestamp();
+ DCHECK(maxClockTime != kNoTimestamp());
+ time_cb_.Run(maxClockTime);
scherkus (not reviewing) 2012/08/07 22:01:00 wait a tick -- what is this time_cb_ used for agai
scherkus (not reviewing) 2012/08/07 23:03:19 Discussed offline -- this is really a max_time_cb_
+
frame_available_.Signal();
}
« no previous file with comments | « media/filters/video_renderer_base.h ('k') | media/filters/video_renderer_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698