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 void TransportFeedbackAdapter::OnTransportFeedback( | 73 const 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } | 118 } |
119 std::sort(packet_feedback_vector.begin(), packet_feedback_vector.end(), | 119 std::sort(packet_feedback_vector.begin(), packet_feedback_vector.end(), |
120 PacketInfoComparator()); | 120 PacketInfoComparator()); |
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; |
| 129 } |
128 | 130 |
| 131 void TransportFeedbackAdapter::OnTransportFeedback( |
| 132 const rtcp::TransportFeedback& feedback) { |
| 133 const std::vector<PacketInfo> packet_feedback_vector = |
| 134 GetPacketFeedbackVector(feedback); |
129 RTC_DCHECK(bitrate_estimator_.get() != nullptr); | 135 RTC_DCHECK(bitrate_estimator_.get() != nullptr); |
130 bitrate_estimator_->IncomingPacketFeedbackVector(packet_feedback_vector); | 136 bitrate_estimator_->IncomingPacketFeedbackVector(packet_feedback_vector); |
131 } | 137 } |
132 | 138 |
133 void TransportFeedbackAdapter::OnReceiveBitrateChanged( | 139 void TransportFeedbackAdapter::OnReceiveBitrateChanged( |
134 const std::vector<uint32_t>& ssrcs, | 140 const std::vector<uint32_t>& ssrcs, |
135 uint32_t bitrate) { | 141 uint32_t bitrate) { |
136 bitrate_controller_->UpdateDelayBasedEstimate(bitrate); | 142 bitrate_controller_->UpdateDelayBasedEstimate(bitrate); |
137 } | 143 } |
138 | 144 |
139 void TransportFeedbackAdapter::OnRttUpdate(int64_t avg_rtt_ms, | 145 void TransportFeedbackAdapter::OnRttUpdate(int64_t avg_rtt_ms, |
140 int64_t max_rtt_ms) { | 146 int64_t max_rtt_ms) { |
141 RTC_DCHECK(bitrate_estimator_.get() != nullptr); | 147 RTC_DCHECK(bitrate_estimator_.get() != nullptr); |
142 bitrate_estimator_->OnRttUpdate(avg_rtt_ms, max_rtt_ms); | 148 bitrate_estimator_->OnRttUpdate(avg_rtt_ms, max_rtt_ms); |
143 } | 149 } |
144 | 150 |
145 } // namespace webrtc | 151 } // namespace webrtc |
OLD | NEW |