| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 rtc::CritScope cs(&lock_); | 63 rtc::CritScope cs(&lock_); |
| 64 send_time_history_.AddAndRemoveOld(sequence_number, length, probe_cluster_id); | 64 send_time_history_.AddAndRemoveOld(sequence_number, length, probe_cluster_id); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void TransportFeedbackAdapter::OnSentPacket(uint16_t sequence_number, | 67 void TransportFeedbackAdapter::OnSentPacket(uint16_t sequence_number, |
| 68 int64_t send_time_ms) { | 68 int64_t send_time_ms) { |
| 69 rtc::CritScope cs(&lock_); | 69 rtc::CritScope cs(&lock_); |
| 70 send_time_history_.OnSentPacket(sequence_number, send_time_ms); | 70 send_time_history_.OnSentPacket(sequence_number, send_time_ms); |
| 71 } | 71 } |
| 72 | 72 |
| 73 const std::vector<PacketInfo> TransportFeedbackAdapter::GetPacketFeedbackVector( | 73 std::vector<PacketInfo> TransportFeedbackAdapter::GetPacketFeedbackVector( |
| 74 const rtcp::TransportFeedback& feedback) { | 74 const rtcp::TransportFeedback& feedback) { |
| 75 int64_t timestamp_us = feedback.GetBaseTimeUs(); | 75 int64_t timestamp_us = feedback.GetBaseTimeUs(); |
| 76 // Add timestamp deltas to a local time base selected on first packet arrival. | 76 // Add timestamp deltas to a local time base selected on first packet arrival. |
| 77 // This won't be the true time base, but makes it easier to manually inspect | 77 // This won't be the true time base, but makes it easier to manually inspect |
| 78 // time stamps. | 78 // time stamps. |
| 79 if (last_timestamp_us_ == kNoTimestamp) { | 79 if (last_timestamp_us_ == kNoTimestamp) { |
| 80 current_offset_ms_ = clock_->TimeInMilliseconds(); | 80 current_offset_ms_ = clock_->TimeInMilliseconds(); |
| 81 } else { | 81 } else { |
| 82 int64_t delta = timestamp_us - last_timestamp_us_; | 82 int64_t delta = timestamp_us - last_timestamp_us_; |
| 83 | 83 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 RTC_DCHECK(delta_it == delta_vec.end()); | 121 RTC_DCHECK(delta_it == delta_vec.end()); |
| 122 if (failed_lookups > 0) { | 122 if (failed_lookups > 0) { |
| 123 LOG(LS_WARNING) << "Failed to lookup send time for " << failed_lookups | 123 LOG(LS_WARNING) << "Failed to lookup send time for " << failed_lookups |
| 124 << " packet" << (failed_lookups > 1 ? "s" : "") | 124 << " packet" << (failed_lookups > 1 ? "s" : "") |
| 125 << ". Send time history too small?"; | 125 << ". Send time history too small?"; |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 return packet_feedback_vector; | 128 return packet_feedback_vector; |
| 129 } | 129 } |
| 130 | 130 |
| 131 void TransportFeedbackAdapter::OnTransportFeedback( | 131 std::vector<PacketInfo> TransportFeedbackAdapter::OnTransportFeedback( |
| 132 const rtcp::TransportFeedback& feedback) { | 132 const rtcp::TransportFeedback& feedback) { |
| 133 const std::vector<PacketInfo> packet_feedback_vector = | 133 const std::vector<PacketInfo> packet_feedback_vector = |
| 134 GetPacketFeedbackVector(feedback); | 134 GetPacketFeedbackVector(feedback); |
| 135 RTC_DCHECK(bitrate_estimator_.get() != nullptr); | 135 if (bitrate_estimator_.get()) |
| 136 bitrate_estimator_->IncomingPacketFeedbackVector(packet_feedback_vector); | 136 bitrate_estimator_->IncomingPacketFeedbackVector(packet_feedback_vector); |
| 137 return packet_feedback_vector; |
| 137 } | 138 } |
| 138 | 139 |
| 139 void TransportFeedbackAdapter::OnReceiveBitrateChanged( | 140 void TransportFeedbackAdapter::OnReceiveBitrateChanged( |
| 140 const std::vector<uint32_t>& ssrcs, | 141 const std::vector<uint32_t>& ssrcs, |
| 141 uint32_t bitrate) { | 142 uint32_t bitrate) { |
| 142 bitrate_controller_->UpdateDelayBasedEstimate(bitrate); | 143 bitrate_controller_->UpdateDelayBasedEstimate(bitrate); |
| 143 } | 144 } |
| 144 | 145 |
| 145 void TransportFeedbackAdapter::OnProbeBitrate(uint32_t bitrate) { | 146 void TransportFeedbackAdapter::OnProbeBitrate(uint32_t bitrate) { |
| 146 bitrate_controller_->UpdateProbeBitrate(bitrate); | 147 bitrate_controller_->UpdateProbeBitrate(bitrate); |
| 147 } | 148 } |
| 148 | 149 |
| 149 void TransportFeedbackAdapter::OnRttUpdate(int64_t avg_rtt_ms, | 150 void TransportFeedbackAdapter::OnRttUpdate(int64_t avg_rtt_ms, |
| 150 int64_t max_rtt_ms) { | 151 int64_t max_rtt_ms) { |
| 151 RTC_DCHECK(bitrate_estimator_.get() != nullptr); | 152 RTC_DCHECK(bitrate_estimator_.get() != nullptr); |
| 152 bitrate_estimator_->OnRttUpdate(avg_rtt_ms, max_rtt_ms); | 153 bitrate_estimator_->OnRttUpdate(avg_rtt_ms, max_rtt_ms); |
| 153 } | 154 } |
| 154 | 155 |
| 155 } // namespace webrtc | 156 } // namespace webrtc |
| OLD | NEW |