OLD | NEW |
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 !clusters_.empty() && |
63 packet_size >= PacedSender::kMinProbePacketSize) { | 63 packet_size >= PacedSender::kMinProbePacketSize) { |
64 probing_state_ = ProbingState::kActive; | 64 probing_state_ = ProbingState::kActive; |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 void BitrateProber::CreateProbeCluster(int bitrate_bps, int num_packets) { | 68 void BitrateProber::CreateProbeCluster(int bitrate_bps, int num_packets) { |
| 69 RTC_DCHECK(probing_state_ != ProbingState::kDisabled); |
69 ProbeCluster cluster; | 70 ProbeCluster cluster; |
70 cluster.max_probe_packets = num_packets; | 71 cluster.max_probe_packets = num_packets; |
71 cluster.probe_bitrate_bps = bitrate_bps; | 72 cluster.probe_bitrate_bps = bitrate_bps; |
72 cluster.id = next_cluster_id_++; | 73 cluster.id = next_cluster_id_++; |
73 clusters_.push(cluster); | 74 clusters_.push(cluster); |
74 LOG(LS_INFO) << "Probe cluster (bitrate:packets): (" | 75 LOG(LS_INFO) << "Probe cluster (bitrate:packets): (" |
75 << cluster.probe_bitrate_bps << ":" << cluster.max_probe_packets | 76 << cluster.probe_bitrate_bps << ":" << cluster.max_probe_packets |
76 << ") "; | 77 << ") "; |
77 if (probing_state_ != ProbingState::kActive) | 78 if (probing_state_ != ProbingState::kActive) |
78 probing_state_ = ProbingState::kInactive; | 79 probing_state_ = ProbingState::kInactive; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 if (!clusters_.empty()) { | 157 if (!clusters_.empty()) { |
157 ProbeCluster* cluster = &clusters_.front(); | 158 ProbeCluster* cluster = &clusters_.front(); |
158 ++cluster->sent_probe_packets; | 159 ++cluster->sent_probe_packets; |
159 if (cluster->sent_probe_packets == cluster->max_probe_packets) | 160 if (cluster->sent_probe_packets == cluster->max_probe_packets) |
160 clusters_.pop(); | 161 clusters_.pop(); |
161 if (clusters_.empty()) | 162 if (clusters_.empty()) |
162 probing_state_ = ProbingState::kSuspended; | 163 probing_state_ = ProbingState::kSuspended; |
163 } | 164 } |
164 } | 165 } |
165 } // namespace webrtc | 166 } // namespace webrtc |
OLD | NEW |