| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "media/cast/sender/frame_sender.h" | 5 #include "media/cast/sender/frame_sender.h" |
| 6 | 6 |
| 7 namespace media { | 7 namespace media { |
| 8 namespace cast { | 8 namespace cast { |
| 9 namespace { | 9 namespace { |
| 10 const int kMinSchedulingDelayMs = 1; | 10 const int kMinSchedulingDelayMs = 1; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 FROM_HERE, | 44 FROM_HERE, |
| 45 base::Bind(&FrameSender::SendRtcpReport, weak_factory_.GetWeakPtr(), | 45 base::Bind(&FrameSender::SendRtcpReport, weak_factory_.GetWeakPtr(), |
| 46 true), | 46 true), |
| 47 time_to_next); | 47 time_to_next); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void FrameSender::SendRtcpReport(bool schedule_future_reports) { | 50 void FrameSender::SendRtcpReport(bool schedule_future_reports) { |
| 51 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 51 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 52 const base::TimeTicks now = cast_environment_->Clock()->NowTicks(); | 52 const base::TimeTicks now = cast_environment_->Clock()->NowTicks(); |
| 53 uint32 now_as_rtp_timestamp = 0; | 53 uint32 now_as_rtp_timestamp = 0; |
| 54 if (rtp_timestamp_helper_.GetCurrentTimeAsRtpTimestamp( | 54 if (rtp_timestamp_helper_.EstimateRtpTimestamp(now, &now_as_rtp_timestamp)) { |
| 55 now, &now_as_rtp_timestamp)) { | |
| 56 transport_sender_->SendSenderReport(ssrc_, now, now_as_rtp_timestamp); | 55 transport_sender_->SendSenderReport(ssrc_, now, now_as_rtp_timestamp); |
| 57 } else { | 56 } else { |
| 58 // |rtp_timestamp_helper_| should have stored a mapping by this point. | 57 // |rtp_timestamp_helper_| should have stored a mapping by this point. |
| 59 NOTREACHED(); | 58 NOTREACHED(); |
| 60 } | 59 } |
| 61 if (schedule_future_reports) | 60 if (schedule_future_reports) |
| 62 ScheduleNextRtcpReport(); | 61 ScheduleNextRtcpReport(); |
| 63 } | 62 } |
| 64 | 63 |
| 65 void FrameSender::OnReceivedRtt(base::TimeDelta rtt, | 64 void FrameSender::OnReceivedRtt(base::TimeDelta rtt, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 79 max_unacked_frames_ = | 78 max_unacked_frames_ = |
| 80 std::min(kMaxUnackedFrames, | 79 std::min(kMaxUnackedFrames, |
| 81 1 + static_cast<int>(target_playout_delay_ * | 80 1 + static_cast<int>(target_playout_delay_ * |
| 82 max_frame_rate_ / | 81 max_frame_rate_ / |
| 83 base::TimeDelta::FromSeconds(1))); | 82 base::TimeDelta::FromSeconds(1))); |
| 84 send_target_playout_delay_ = true; | 83 send_target_playout_delay_ = true; |
| 85 } | 84 } |
| 86 | 85 |
| 87 } // namespace cast | 86 } // namespace cast |
| 88 } // namespace media | 87 } // namespace media |
| OLD | NEW |