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

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

Issue 2781853002: Revert of Log created probe clusters to RtcEventLog. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « webrtc/modules/pacing/bitrate_prober.h ('k') | webrtc/modules/pacing/mock/mock_paced_sender.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include "webrtc/modules/pacing/bitrate_prober.h" 11 #include "webrtc/modules/pacing/bitrate_prober.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 14
15 #include "webrtc/base/checks.h" 15 #include "webrtc/base/checks.h"
16 #include "webrtc/base/logging.h" 16 #include "webrtc/base/logging.h"
17 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
18 #include "webrtc/modules/pacing/paced_sender.h" 17 #include "webrtc/modules/pacing/paced_sender.h"
19 18
20 namespace webrtc { 19 namespace webrtc {
21 20
22 namespace { 21 namespace {
23 22
24 // A minimum interval between probes to allow scheduling to be feasible. 23 // A minimum interval between probes to allow scheduling to be feasible.
25 constexpr int kMinProbeDeltaMs = 1; 24 constexpr int kMinProbeDeltaMs = 1;
26 25
27 // The minimum number probing packets used. 26 // The minimum number probing packets used.
(...skipping 11 matching lines...) Expand all
39 38
40 // The min probe packet size is scaled with the bitrate we're probing at. 39 // The min probe packet size is scaled with the bitrate we're probing at.
41 // This defines the max min probe packet size, meaning that on high bitrates 40 // This defines the max min probe packet size, meaning that on high bitrates
42 // we have a min probe packet size of 200 bytes. 41 // we have a min probe packet size of 200 bytes.
43 constexpr size_t kMinProbePacketSize = 200; 42 constexpr size_t kMinProbePacketSize = 200;
44 43
45 constexpr int64_t kProbeClusterTimeoutMs = 5000; 44 constexpr int64_t kProbeClusterTimeoutMs = 5000;
46 45
47 } // namespace 46 } // namespace
48 47
49 BitrateProber::BitrateProber() : BitrateProber(nullptr) {} 48 BitrateProber::BitrateProber()
50
51 BitrateProber::BitrateProber(RtcEventLog* event_log)
52 : probing_state_(ProbingState::kDisabled), 49 : probing_state_(ProbingState::kDisabled),
53 next_probe_time_ms_(-1), 50 next_probe_time_ms_(-1),
54 next_cluster_id_(0), 51 next_cluster_id_(0) {
55 event_log_(event_log) {
56 SetEnabled(true); 52 SetEnabled(true);
57 } 53 }
58 54
59 void BitrateProber::SetEnabled(bool enable) { 55 void BitrateProber::SetEnabled(bool enable) {
60 if (enable) { 56 if (enable) {
61 if (probing_state_ == ProbingState::kDisabled) { 57 if (probing_state_ == ProbingState::kDisabled) {
62 probing_state_ = ProbingState::kInactive; 58 probing_state_ = ProbingState::kInactive;
63 LOG(LS_INFO) << "Bandwidth probing enabled, set to inactive"; 59 LOG(LS_INFO) << "Bandwidth probing enabled, set to inactive";
64 } 60 }
65 } else { 61 } else {
(...skipping 26 matching lines...) Expand all
92 } 88 }
93 89
94 ProbeCluster cluster; 90 ProbeCluster cluster;
95 cluster.time_created_ms = now_ms; 91 cluster.time_created_ms = now_ms;
96 cluster.pace_info.probe_cluster_min_probes = kMinProbePacketsSent; 92 cluster.pace_info.probe_cluster_min_probes = kMinProbePacketsSent;
97 cluster.pace_info.probe_cluster_min_bytes = 93 cluster.pace_info.probe_cluster_min_bytes =
98 bitrate_bps * kMinProbeDurationMs / 8000; 94 bitrate_bps * kMinProbeDurationMs / 8000;
99 cluster.pace_info.send_bitrate_bps = bitrate_bps; 95 cluster.pace_info.send_bitrate_bps = bitrate_bps;
100 cluster.pace_info.probe_cluster_id = next_cluster_id_++; 96 cluster.pace_info.probe_cluster_id = next_cluster_id_++;
101 clusters_.push(cluster); 97 clusters_.push(cluster);
102 if (event_log_)
103 event_log_->LogProbeClusterCreated(
104 cluster.pace_info.probe_cluster_id, cluster.pace_info.send_bitrate_bps,
105 cluster.pace_info.probe_cluster_min_probes,
106 cluster.pace_info.probe_cluster_min_bytes);
107 98
108 LOG(LS_INFO) << "Probe cluster (bitrate:min bytes:min packets): (" 99 LOG(LS_INFO) << "Probe cluster (bitrate:min bytes:min packets): ("
109 << cluster.pace_info.send_bitrate_bps << ":" 100 << cluster.pace_info.send_bitrate_bps << ":"
110 << cluster.pace_info.probe_cluster_min_bytes << ":" 101 << cluster.pace_info.probe_cluster_min_bytes << ":"
111 << cluster.pace_info.probe_cluster_min_probes << ")"; 102 << cluster.pace_info.probe_cluster_min_probes << ")";
112 // If we are already probing, continue to do so. Otherwise set it to 103 // If we are already probing, continue to do so. Otherwise set it to
113 // kInactive and wait for OnIncomingPacket to start the probing. 104 // kInactive and wait for OnIncomingPacket to start the probing.
114 if (probing_state_ != ProbingState::kActive) 105 if (probing_state_ != ProbingState::kActive)
115 probing_state_ = ProbingState::kInactive; 106 probing_state_ = ProbingState::kInactive;
116 } 107 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Compute the time delta from the cluster start to ensure probe bitrate stays 184 // Compute the time delta from the cluster start to ensure probe bitrate stays
194 // close to the target bitrate. Result is in milliseconds. 185 // close to the target bitrate. Result is in milliseconds.
195 int64_t delta_ms = 186 int64_t delta_ms =
196 (8000ll * cluster.sent_bytes + cluster.pace_info.send_bitrate_bps / 2) / 187 (8000ll * cluster.sent_bytes + cluster.pace_info.send_bitrate_bps / 2) /
197 cluster.pace_info.send_bitrate_bps; 188 cluster.pace_info.send_bitrate_bps;
198 return cluster.time_started_ms + delta_ms; 189 return cluster.time_started_ms + delta_ms;
199 } 190 }
200 191
201 192
202 } // namespace webrtc 193 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/pacing/bitrate_prober.h ('k') | webrtc/modules/pacing/mock/mock_paced_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698