diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-09 00:01:50 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-09 00:01:50 +0000 |
commit | 88f73bd643e264b2df0b5ec8199263f09b368159 (patch) | |
tree | d3642f3560550829e0a84acc235092dd097fe839 | |
parent | f77fa3681f4e11bdb2650269764b3bd4386be929 (diff) | |
download | chromium_src-88f73bd643e264b2df0b5ec8199263f09b368159.zip chromium_src-88f73bd643e264b2df0b5ec8199263f09b368159.tar.gz chromium_src-88f73bd643e264b2df0b5ec8199263f09b368159.tar.bz2 |
Cast: Improve AV sync slightly
This is an interim solution before we can pass TimeTicks associated with
a video frame to the cast library. We use base::TimeTicks::Now() when
a frame is delivered to the render process as the timestamp of the
frame. This improves AV sync slightly according to the performance test.
Before
*RESULT CastV2Performance_gpu_24fps: av_sync= {15.520811,10.694887} ms
*RESULT CastV2Performance_gpu_30fps: av_sync= {7.877492,14.865763} ms
*RESULT CastV2Performance_gpu_60fps: av_sync= {-15.974133,10.762621} ms
After
*RESULT CastV2Performance_gpu_24fps: av_sync= {9.231218,10.886808} ms
*RESULT CastV2Performance_gpu_30fps: av_sync= {10.161435,10.176140} ms
*RESULT CastV2Performance_gpu_60fps: av_sync= {-10.761692,12.102184} ms
R=hubbe@chromium.org
Review URL: https://codereview.chromium.org/273753003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269112 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/renderer/media/cast_rtp_stream.cc | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/chrome/renderer/media/cast_rtp_stream.cc b/chrome/renderer/media/cast_rtp_stream.cc index 99a8543..5557582 100644 --- a/chrome/renderer/media/cast_rtp_stream.cc +++ b/chrome/renderer/media/cast_rtp_stream.cc @@ -230,24 +230,15 @@ class CastVideoSink : public base::SupportsWeakPtr<CastVideoSink>, return; } - // Capture time is calculated using the time when the first frame - // is delivered. Doing so has less jitter because each frame has - // a TimeDelta from the first frame. However there is a delay between - // capture and delivery here for the first frame. We do not account - // for this delay. - if (first_frame_timestamp_.is_null()) - first_frame_timestamp_ = base::TimeTicks::Now() - frame->timestamp(); + const base::TimeTicks now = base::TimeTicks::Now(); // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc TRACE_EVENT_INSTANT2( "mirroring", "MediaStreamVideoSink::OnVideoFrame", TRACE_EVENT_SCOPE_THREAD, - "timestamp", - (first_frame_timestamp_ + frame->timestamp()).ToInternalValue(), + "timestamp", now.ToInternalValue(), "time_delta", frame->timestamp().ToInternalValue()); - - frame_input_->InsertRawVideoFrame( - frame, first_frame_timestamp_ + frame->timestamp()); + frame_input_->InsertRawVideoFrame(frame, now); } // Attach this sink to a video track represented by |track_|. @@ -267,7 +258,6 @@ class CastVideoSink : public base::SupportsWeakPtr<CastVideoSink>, bool sink_added_; gfx::Size expected_coded_size_; CastRtpStream::ErrorCallback error_callback_; - base::TimeTicks first_frame_timestamp_; DISALLOW_COPY_AND_ASSIGN(CastVideoSink); }; |