OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 RemoteBitrateObserver* observer, | 90 RemoteBitrateObserver* observer, |
91 Clock* clock, | 91 Clock* clock, |
92 uint32_t min_bitrate_bps) | 92 uint32_t min_bitrate_bps) |
93 : crit_sect_(CriticalSectionWrapper::CreateCriticalSection()), | 93 : crit_sect_(CriticalSectionWrapper::CreateCriticalSection()), |
94 observer_(observer), | 94 observer_(observer), |
95 clock_(clock), | 95 clock_(clock), |
96 ssrcs_(), | 96 ssrcs_(), |
97 inter_arrival_(), | 97 inter_arrival_(), |
98 estimator_(OverUseDetectorOptions()), | 98 estimator_(OverUseDetectorOptions()), |
99 detector_(OverUseDetectorOptions()), | 99 detector_(OverUseDetectorOptions()), |
100 incoming_bitrate_(1000, 8000), | 100 incoming_bitrate_(kBitrateWindowMs, 8000), |
101 remote_rate_(min_bitrate_bps), | 101 remote_rate_(min_bitrate_bps), |
102 last_process_time_(-1), | 102 last_process_time_(-1), |
103 process_interval_ms_(kProcessIntervalMs), | 103 process_interval_ms_(kProcessIntervalMs), |
104 total_propagation_delta_ms_(0), | 104 total_propagation_delta_ms_(0), |
105 total_probes_received_(0), | 105 total_probes_received_(0), |
106 first_packet_time_ms_(-1) { | 106 first_packet_time_ms_(-1) { |
107 assert(observer_); | 107 assert(observer_); |
108 assert(clock_); | 108 assert(clock_); |
109 LOG(LS_INFO) << "RemoteBitrateEstimatorAbsSendTime: Instantiating."; | 109 LOG(LS_INFO) << "RemoteBitrateEstimatorAbsSendTime: Instantiating."; |
110 } | 110 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // we will remove the oldest one. | 181 // we will remove the oldest one. |
182 if (probes_.size() >= kMaxProbePackets) | 182 if (probes_.size() >= kMaxProbePackets) |
183 probes_.pop_front(); | 183 probes_.pop_front(); |
184 return; | 184 return; |
185 } | 185 } |
186 | 186 |
187 std::list<Cluster>::const_iterator best_it = FindBestProbe(clusters); | 187 std::list<Cluster>::const_iterator best_it = FindBestProbe(clusters); |
188 if (best_it != clusters.end()) { | 188 if (best_it != clusters.end()) { |
189 int probe_bitrate_bps = | 189 int probe_bitrate_bps = |
190 std::min(best_it->GetSendBitrateBps(), best_it->GetRecvBitrateBps()); | 190 std::min(best_it->GetSendBitrateBps(), best_it->GetRecvBitrateBps()); |
191 if (IsBitrateImproving(probe_bitrate_bps)) { | 191 // Make sure that a probe sent on a lower bitrate than our estimate can't |
| 192 // reduce the estimate. |
| 193 if (IsBitrateImproving(probe_bitrate_bps) && |
| 194 probe_bitrate_bps > static_cast<int>(incoming_bitrate_.Rate(now_ms))) { |
192 LOG(LS_INFO) << "Probe successful, sent at " | 195 LOG(LS_INFO) << "Probe successful, sent at " |
193 << best_it->GetSendBitrateBps() << " bps, received at " | 196 << best_it->GetSendBitrateBps() << " bps, received at " |
194 << best_it->GetRecvBitrateBps() | 197 << best_it->GetRecvBitrateBps() |
195 << " bps. Mean send delta: " << best_it->send_mean_ms | 198 << " bps. Mean send delta: " << best_it->send_mean_ms |
196 << " ms, mean recv delta: " << best_it->recv_mean_ms | 199 << " ms, mean recv delta: " << best_it->recv_mean_ms |
197 << " ms, num probes: " << best_it->count; | 200 << " ms, num probes: " << best_it->count; |
198 remote_rate_.SetEstimate(probe_bitrate_bps, now_ms); | 201 remote_rate_.SetEstimate(probe_bitrate_bps, now_ms); |
199 } | 202 } |
200 } | 203 } |
201 | 204 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 426 |
424 RemoveStaleEntries( | 427 RemoveStaleEntries( |
425 &recent_update_time_ms_, | 428 &recent_update_time_ms_, |
426 &recent_propagation_delta_ms_, | 429 &recent_propagation_delta_ms_, |
427 now_ms - kPropagationDeltaQueueMaxTimeMs); | 430 now_ms - kPropagationDeltaQueueMaxTimeMs); |
428 | 431 |
429 total_propagation_delta_ms_ = | 432 total_propagation_delta_ms_ = |
430 std::max(total_propagation_delta_ms_ + propagation_delta_ms, 0); | 433 std::max(total_propagation_delta_ms_ + propagation_delta_ms, 0); |
431 } | 434 } |
432 } // namespace webrtc | 435 } // namespace webrtc |
OLD | NEW |