Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1295)

Side by Side Diff: webrtc/modules/congestion_controller/probe_bitrate_estimator.cc

Issue 2254733005: Only use payload size within the receive/send interval for bitrate probing. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 30 matching lines...) Expand all
41 ProbingResult ProbeBitrateEstimator::PacketFeedback( 41 ProbingResult ProbeBitrateEstimator::PacketFeedback(
42 const PacketInfo& packet_info) { 42 const PacketInfo& packet_info) {
43 // If this is not a probing packet or if this probing packet 43 // If this is not a probing packet or if this probing packet
44 // belongs to an old cluster, do nothing. 44 // belongs to an old cluster, do nothing.
45 if (packet_info.probe_cluster_id == PacketInfo::kNotAProbe || 45 if (packet_info.probe_cluster_id == PacketInfo::kNotAProbe ||
46 packet_info.probe_cluster_id < last_valid_cluster_id_) { 46 packet_info.probe_cluster_id < last_valid_cluster_id_) {
47 return ProbingResult(); 47 return ProbingResult();
48 } 48 }
49 49
50 AggregatedCluster* cluster = &clusters_[packet_info.probe_cluster_id]; 50 AggregatedCluster* cluster = &clusters_[packet_info.probe_cluster_id];
51 if (cluster->sequence_numbers.count(packet_info.sequence_number) == 1) {
danilchap 2016/08/18 19:29:08 may be better compare with 0: .count(seq_number) >
52 LOG(LS_INFO) << "Probing packet with sequence number "
53 << packet_info.sequence_number
54 << " already inserted into cluster with id "
55 << packet_info.probe_cluster_id << ".";
56 return ProbingResult();
57 }
58
51 cluster->first_send_ms = 59 cluster->first_send_ms =
52 std::min(cluster->first_send_ms, packet_info.send_time_ms); 60 std::min(cluster->first_send_ms, packet_info.send_time_ms);
53 cluster->last_send_ms = 61 cluster->last_send_ms =
54 std::max(cluster->last_send_ms, packet_info.send_time_ms); 62 std::max(cluster->last_send_ms, packet_info.send_time_ms);
55 cluster->first_receive_ms = 63 cluster->first_receive_ms =
56 std::min(cluster->first_receive_ms, packet_info.arrival_time_ms); 64 std::min(cluster->first_receive_ms, packet_info.arrival_time_ms);
57 cluster->last_receive_ms = 65 cluster->last_receive_ms =
58 std::max(cluster->last_receive_ms, packet_info.arrival_time_ms); 66 std::max(cluster->last_receive_ms, packet_info.arrival_time_ms);
59 cluster->size += packet_info.payload_size * 8; 67 cluster->size += packet_info.payload_size * 8;
60 cluster->num_probes += 1; 68 cluster->sequence_numbers.insert(packet_info.sequence_number);
61 69
62 // Clean up old clusters. 70 // Clean up old clusters.
63 while (clusters_.size() > kMaxNumSavedClusters) 71 while (clusters_.size() > kMaxNumSavedClusters)
64 clusters_.erase(clusters_.begin()); 72 clusters_.erase(clusters_.begin());
65 73
66 if (cluster->num_probes < kMinNumProbesValidCluster) 74 if (cluster->sequence_numbers.size() < kMinNumProbesValidCluster)
67 return ProbingResult(); 75 return ProbingResult();
68 76
69 float send_interval_ms = cluster->last_send_ms - cluster->first_send_ms; 77 float send_interval_ms = cluster->last_send_ms - cluster->first_send_ms;
70 float receive_interval_ms = 78 float receive_interval_ms =
71 cluster->last_receive_ms - cluster->first_receive_ms; 79 cluster->last_receive_ms - cluster->first_receive_ms;
72 80
73 // Since the send/receive interval does not include the send/receive time of 81 // Since the send/receive interval does not include the send/receive time of
74 // the last/first packet we expand the interval by the average inverval 82 // the last/first packet we expand the interval by the average inverval
75 // between the probing packets. 83 // between the probing packets.
76 float interval_correction = 84 float interval_correction =
77 static_cast<float>(cluster->num_probes) / (cluster->num_probes - 1); 85 static_cast<float>(cluster->sequence_numbers.size()) /
86 (cluster->sequence_numbers.size() - 1);
78 send_interval_ms *= interval_correction; 87 send_interval_ms *= interval_correction;
79 receive_interval_ms *= interval_correction; 88 receive_interval_ms *= interval_correction;
80 89
81 if (send_interval_ms == 0 || receive_interval_ms == 0) { 90 if (send_interval_ms == 0 || receive_interval_ms == 0) {
82 LOG(LS_INFO) << "Probing unsuccessful, invalid send/receive interval" 91 LOG(LS_INFO) << "Probing unsuccessful, invalid send/receive interval"
83 << " [cluster id: " << packet_info.probe_cluster_id 92 << " [cluster id: " << packet_info.probe_cluster_id
84 << "] [send interval: " << send_interval_ms << " ms]" 93 << "] [send interval: " << send_interval_ms << " ms]"
85 << " [receive interval: " << receive_interval_ms << " ms]"; 94 << " [receive interval: " << receive_interval_ms << " ms]";
86 95
87 return ProbingResult(); 96 return ProbingResult();
(...skipping 23 matching lines...) Expand all
111 << " [cluster id: " << packet_info.probe_cluster_id 120 << " [cluster id: " << packet_info.probe_cluster_id
112 << "] [send: " << cluster->size << " bytes / " 121 << "] [send: " << cluster->size << " bytes / "
113 << send_interval_ms << " ms = " << send_bps / 1000 << " kb/s]" 122 << send_interval_ms << " ms = " << send_bps / 1000 << " kb/s]"
114 << " [receive: " << cluster->size << " bytes / " 123 << " [receive: " << cluster->size << " bytes / "
115 << receive_interval_ms << " ms = " << receive_bps / 1000 124 << receive_interval_ms << " ms = " << receive_bps / 1000
116 << " kb/s]"; 125 << " kb/s]";
117 126
118 return ProbingResult(result_bps, packet_info.arrival_time_ms); 127 return ProbingResult(result_bps, packet_info.arrival_time_ms);
119 } 128 }
120 } // namespace webrtc 129 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698