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

Side by Side Diff: webrtc/modules/pacing/bitrate_prober.cc

Issue 2246403002: CongestionController::SetBweBitrates may now trigger probing. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Don't set probing state to active in the case of no clusters. 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 bool BitrateProber::IsProbing() const { 54 bool BitrateProber::IsProbing() const {
55 return probing_state_ == ProbingState::kActive; 55 return probing_state_ == ProbingState::kActive;
56 } 56 }
57 57
58 void BitrateProber::OnIncomingPacket(size_t packet_size) { 58 void BitrateProber::OnIncomingPacket(size_t packet_size) {
59 // Don't initialize probing unless we have something large enough to start 59 // Don't initialize probing unless we have something large enough to start
60 // probing. 60 // probing.
61 if (probing_state_ == ProbingState::kInactive && 61 if (probing_state_ == ProbingState::kInactive &&
62 !clusters_.empty() &&
62 packet_size >= PacedSender::kMinProbePacketSize) { 63 packet_size >= PacedSender::kMinProbePacketSize) {
63 probing_state_ = ProbingState::kActive; 64 probing_state_ = ProbingState::kActive;
64 } 65 }
65 } 66 }
66 67
67 void BitrateProber::ProbeAtBitrate(uint32_t bitrate_bps, int num_packets) { 68 void BitrateProber::CreateProbeCluster(int bitrate_bps, int num_packets) {
68 ProbeCluster cluster; 69 ProbeCluster cluster;
69 cluster.max_probe_packets = num_packets; 70 cluster.max_probe_packets = num_packets;
70 cluster.probe_bitrate_bps = bitrate_bps; 71 cluster.probe_bitrate_bps = bitrate_bps;
71 cluster.id = next_cluster_id_++; 72 cluster.id = next_cluster_id_++;
72 clusters_.push(cluster); 73 clusters_.push(cluster);
73 LOG(LS_INFO) << "Probe cluster (bitrate:packets): (" 74 LOG(LS_INFO) << "Probe cluster (bitrate:packets): ("
74 << cluster.probe_bitrate_bps << ":" << cluster.max_probe_packets 75 << cluster.probe_bitrate_bps << ":" << cluster.max_probe_packets
75 << ") "; 76 << ") ";
76 if (probing_state_ != ProbingState::kActive) 77 if (probing_state_ != ProbingState::kActive)
77 probing_state_ = ProbingState::kInactive; 78 probing_state_ = ProbingState::kInactive;
78 } 79 }
79 80
80 void BitrateProber::ResetState() { 81 void BitrateProber::ResetState() {
81 time_last_probe_sent_ms_ = -1; 82 time_last_probe_sent_ms_ = -1;
82 packet_size_last_sent_ = 0; 83 packet_size_last_sent_ = 0;
83 84
84 // Recreate all probing clusters. 85 // Recreate all probing clusters.
85 std::queue<ProbeCluster> clusters; 86 std::queue<ProbeCluster> clusters;
86 clusters.swap(clusters_); 87 clusters.swap(clusters_);
87 while (!clusters.empty()) { 88 while (!clusters.empty()) {
88 ProbeAtBitrate(clusters.front().probe_bitrate_bps, 89 CreateProbeCluster(clusters.front().probe_bitrate_bps,
89 clusters.front().max_probe_packets); 90 clusters.front().max_probe_packets);
90 clusters.pop(); 91 clusters.pop();
91 } 92 }
92 // If its enabled, reset to inactive. 93 // If its enabled, reset to inactive.
93 if (probing_state_ != ProbingState::kDisabled) 94 if (probing_state_ != ProbingState::kDisabled)
94 probing_state_ = ProbingState::kInactive; 95 probing_state_ = ProbingState::kInactive;
95 } 96 }
96 97
97 int BitrateProber::TimeUntilNextProbe(int64_t now_ms) { 98 int BitrateProber::TimeUntilNextProbe(int64_t now_ms) {
98 // Probing is not active or probing is already complete. 99 // Probing is not active or probing is already complete.
99 if (probing_state_ != ProbingState::kActive || clusters_.empty()) 100 if (probing_state_ != ProbingState::kActive || clusters_.empty())
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 if (!clusters_.empty()) { 156 if (!clusters_.empty()) {
156 ProbeCluster* cluster = &clusters_.front(); 157 ProbeCluster* cluster = &clusters_.front();
157 ++cluster->sent_probe_packets; 158 ++cluster->sent_probe_packets;
158 if (cluster->sent_probe_packets == cluster->max_probe_packets) 159 if (cluster->sent_probe_packets == cluster->max_probe_packets)
159 clusters_.pop(); 160 clusters_.pop();
160 if (clusters_.empty()) 161 if (clusters_.empty())
161 probing_state_ = ProbingState::kSuspended; 162 probing_state_ = ProbingState::kSuspended;
162 } 163 }
163 } 164 }
164 } // namespace webrtc 165 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/pacing/bitrate_prober.h ('k') | webrtc/modules/pacing/bitrate_prober_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698