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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 void TransportFeedbackAdapter::OnTransportFeedback( |
132 const rtcp::TransportFeedback& feedback) { | 132 const rtcp::TransportFeedback& feedback) { |
133 const std::vector<PacketInfo> packet_feedback_vector = | 133 last_packet_feedback_vector_ = GetPacketFeedbackVector(feedback); |
134 GetPacketFeedbackVector(feedback); | 134 if (bitrate_estimator_.get()) |
135 RTC_DCHECK(bitrate_estimator_.get() != nullptr); | 135 bitrate_estimator_->IncomingPacketFeedbackVector( |
136 bitrate_estimator_->IncomingPacketFeedbackVector(packet_feedback_vector); | 136 last_packet_feedback_vector_); |
| 137 } |
| 138 |
| 139 std::vector<PacketInfo> TransportFeedbackAdapter::GetTransportFeedbackVector() |
| 140 const { |
| 141 return last_packet_feedback_vector_; |
137 } | 142 } |
138 | 143 |
139 void TransportFeedbackAdapter::OnReceiveBitrateChanged( | 144 void TransportFeedbackAdapter::OnReceiveBitrateChanged( |
140 const std::vector<uint32_t>& ssrcs, | 145 const std::vector<uint32_t>& ssrcs, |
141 uint32_t bitrate) { | 146 uint32_t bitrate) { |
142 bitrate_controller_->UpdateDelayBasedEstimate(bitrate); | 147 bitrate_controller_->UpdateDelayBasedEstimate(bitrate); |
143 } | 148 } |
144 | 149 |
145 void TransportFeedbackAdapter::OnProbeBitrate(uint32_t bitrate) { | 150 void TransportFeedbackAdapter::OnProbeBitrate(uint32_t bitrate) { |
146 bitrate_controller_->UpdateProbeBitrate(bitrate); | 151 bitrate_controller_->UpdateProbeBitrate(bitrate); |
147 } | 152 } |
148 | 153 |
149 void TransportFeedbackAdapter::OnRttUpdate(int64_t avg_rtt_ms, | 154 void TransportFeedbackAdapter::OnRttUpdate(int64_t avg_rtt_ms, |
150 int64_t max_rtt_ms) { | 155 int64_t max_rtt_ms) { |
151 RTC_DCHECK(bitrate_estimator_.get() != nullptr); | 156 RTC_DCHECK(bitrate_estimator_.get() != nullptr); |
152 bitrate_estimator_->OnRttUpdate(avg_rtt_ms, max_rtt_ms); | 157 bitrate_estimator_->OnRttUpdate(avg_rtt_ms, max_rtt_ms); |
153 } | 158 } |
154 | 159 |
155 } // namespace webrtc | 160 } // namespace webrtc |
OLD | NEW |