summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwjia@chromium.org <wjia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-27 22:25:26 +0000
committerwjia@chromium.org <wjia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-27 22:25:26 +0000
commitaeff803571b1bed52b2f5edcb033e56dfdb3b464 (patch)
treed791c6ed7ecce93f0f7deb30b78733ac2e9f7ba1
parentb93e6c48d52b830e843398b44831a11e58e0c378 (diff)
downloadchromium_src-aeff803571b1bed52b2f5edcb033e56dfdb3b464.zip
chromium_src-aeff803571b1bed52b2f5edcb033e56dfdb3b464.tar.gz
chromium_src-aeff803571b1bed52b2f5edcb033e56dfdb3b464.tar.bz2
adjust start_time_ for video capture decoder so that the preroll in video renderer is correctly compensated.
Since video renderer prerolls, the start_time_ is set a bit earlier (at seek state). This results in mismatching between host time and clock for captured video frames. The clock for captured video frames starts earlier than host time. Then video renderer sleep too long to flip next frame, which also results in delay of read request to CaptureVideoDecoder, which leads to frame dropping in CaptureVideoDecoder. Review URL: https://chromiumcodereview.appspot.com/9234050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119503 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/renderer/media/capture_video_decoder.cc6
-rw-r--r--content/renderer/media/capture_video_decoder.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/content/renderer/media/capture_video_decoder.cc b/content/renderer/media/capture_video_decoder.cc
index 03b0289..c1049a0 100644
--- a/content/renderer/media/capture_video_decoder.cc
+++ b/content/renderer/media/capture_video_decoder.cc
@@ -222,6 +222,11 @@ void CaptureVideoDecoder::OnBufferReadyOnDecoderThread(
DCHECK(message_loop_proxy_->BelongsToCurrentThread());
if (read_cb_.is_null() || kNormal != state_) {
+ // TODO(wjia): revisit TS adjustment when crbug.com/111672 is resolved.
+ if (got_first_frame_) {
+ start_time_ += buf->timestamp - last_frame_timestamp_;
+ }
+ last_frame_timestamp_ = buf->timestamp;
capture->FeedBuffer(buf);
return;
}
@@ -251,6 +256,7 @@ void CaptureVideoDecoder::OnBufferReadyOnDecoderThread(
buf->timestamp - start_time_,
base::TimeDelta::FromMilliseconds(0));
+ last_frame_timestamp_ = buf->timestamp;
uint8* buffer = buf->memory_pointer;
// Assume YV12 format. Note that camera gives YUV and media pipeline video
diff --git a/content/renderer/media/capture_video_decoder.h b/content/renderer/media/capture_video_decoder.h
index af89349..8f46b00 100644
--- a/content/renderer/media/capture_video_decoder.h
+++ b/content/renderer/media/capture_video_decoder.h
@@ -106,6 +106,7 @@ class CONTENT_EXPORT CaptureVideoDecoder
media::VideoCaptureSessionId video_stream_id_;
media::VideoCapture* capture_engine_;
+ base::Time last_frame_timestamp_;
base::Time start_time_;
DISALLOW_COPY_AND_ASSIGN(CaptureVideoDecoder);