| Index: trunk/src/media/cast/video_receiver/video_receiver.cc
|
| ===================================================================
|
| --- trunk/src/media/cast/video_receiver/video_receiver.cc (revision 255172)
|
| +++ trunk/src/media/cast/video_receiver/video_receiver.cc (working copy)
|
| @@ -18,8 +18,8 @@
|
| namespace {
|
|
|
| static const int64 kMinSchedulingDelayMs = 1;
|
| -static const int64 kMinTimeBetweenOffsetUpdatesMs = 1000;
|
| -static const int kTimeOffsetMaxCounter = 10;
|
| +static const int64 kMinTimeBetweenOffsetUpdatesMs = 2000;
|
| +static const int kTimeOffsetFilter = 8;
|
| static const int64_t kMinProcessIntervalMs = 5;
|
|
|
| } // namespace
|
| @@ -107,7 +107,6 @@
|
| incoming_payload_callback_.get()),
|
| rtp_video_receiver_statistics_(
|
| new LocalRtpReceiverStatistics(&rtp_receiver_)),
|
| - time_offset_counter_(0),
|
| decryptor_(),
|
| time_incoming_packet_updated_(false),
|
| incoming_rtp_timestamp_(0),
|
| @@ -357,7 +356,7 @@
|
| base::TimeTicks rtp_timestamp_in_ticks;
|
|
|
| // Compute the time offset_in_ticks based on the incoming_rtp_timestamp_.
|
| - if (time_offset_counter_ == 0) {
|
| + if (time_offset_.InMilliseconds() == 0) {
|
| if (!rtcp_->RtpTimestampInSenderTime(kVideoFrequency,
|
| incoming_rtp_timestamp_,
|
| &rtp_timestamp_in_ticks)) {
|
| @@ -365,8 +364,7 @@
|
| // possible.
|
| return now;
|
| }
|
| - ++time_offset_counter_;
|
| - return now;
|
| + time_offset_ = time_incoming_packet_ - rtp_timestamp_in_ticks;
|
| } else if (time_incoming_packet_updated_) {
|
| if (rtcp_->RtpTimestampInSenderTime(kVideoFrequency,
|
| incoming_rtp_timestamp_,
|
| @@ -374,16 +372,8 @@
|
| // Time to update the time_offset.
|
| base::TimeDelta time_offset =
|
| time_incoming_packet_ - rtp_timestamp_in_ticks;
|
| - // Taking the minimum of the first kTimeOffsetMaxCounter values. We are
|
| - // assuming that we are looking for the minimum offset, which will occur
|
| - // when network conditions are the best. This should occur at least once
|
| - // within the first kTimeOffsetMaxCounter samples. Any drift should be
|
| - // very slow, and negligible for this use case.
|
| - if (time_offset_counter_ == 1)
|
| - time_offset_ = time_offset;
|
| - else if (time_offset_counter_ < kTimeOffsetMaxCounter)
|
| - time_offset_ = std::min(time_offset_, time_offset);
|
| - ++time_offset_counter_;
|
| + time_offset_ = ((kTimeOffsetFilter - 1) * time_offset_ + time_offset) /
|
| + kTimeOffsetFilter;
|
| }
|
| }
|
| // Reset |time_incoming_packet_updated_| to enable a future measurement.
|
|
|