OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 20 matching lines...) Expand all Loading... |
31 // on the sender side as well as the receive side. | 31 // on the sender side as well as the receive side. |
32 constexpr int kMaxProbeIntervalMs = 1000; | 32 constexpr int kMaxProbeIntervalMs = 1000; |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 namespace webrtc { | 35 namespace webrtc { |
36 | 36 |
37 ProbeBitrateEstimator::ProbeBitrateEstimator() {} | 37 ProbeBitrateEstimator::ProbeBitrateEstimator() {} |
38 | 38 |
39 int ProbeBitrateEstimator::HandleProbeAndEstimateBitrate( | 39 int ProbeBitrateEstimator::HandleProbeAndEstimateBitrate( |
40 const PacketInfo& packet_info) { | 40 const PacketInfo& packet_info) { |
41 RTC_DCHECK_NE(packet_info.probe_cluster_id, PacketInfo::kNotAProbe); | 41 RTC_DCHECK_NE(packet_info.probe_cluster_id, PacedPacketInfo::kNotAProbe); |
42 | 42 |
43 EraseOldClusters(packet_info.arrival_time_ms - kMaxClusterHistoryMs); | 43 EraseOldClusters(packet_info.arrival_time_ms - kMaxClusterHistoryMs); |
44 | 44 |
45 int payload_size_bits = packet_info.payload_size * 8; | 45 int payload_size_bits = packet_info.payload_size * 8; |
46 AggregatedCluster* cluster = &clusters_[packet_info.probe_cluster_id]; | 46 AggregatedCluster* cluster = &clusters_[packet_info.probe_cluster_id]; |
47 | 47 |
48 if (packet_info.send_time_ms < cluster->first_send_ms) { | 48 if (packet_info.send_time_ms < cluster->first_send_ms) { |
49 cluster->first_send_ms = packet_info.send_time_ms; | 49 cluster->first_send_ms = packet_info.send_time_ms; |
50 } | 50 } |
51 if (packet_info.send_time_ms > cluster->last_send_ms) { | 51 if (packet_info.send_time_ms > cluster->last_send_ms) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 void ProbeBitrateEstimator::EraseOldClusters(int64_t timestamp_ms) { | 118 void ProbeBitrateEstimator::EraseOldClusters(int64_t timestamp_ms) { |
119 for (auto it = clusters_.begin(); it != clusters_.end();) { | 119 for (auto it = clusters_.begin(); it != clusters_.end();) { |
120 if (it->second.last_receive_ms < timestamp_ms) { | 120 if (it->second.last_receive_ms < timestamp_ms) { |
121 it = clusters_.erase(it); | 121 it = clusters_.erase(it); |
122 } else { | 122 } else { |
123 ++it; | 123 ++it; |
124 } | 124 } |
125 } | 125 } |
126 } | 126 } |
127 } // namespace webrtc | 127 } // namespace webrtc |
OLD | NEW |