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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc

Issue 1481003002: Revert of Make overuse estimator one dimensional. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 int RemoteBitrateEstimatorAbsSendTime::Id() const { 95 int RemoteBitrateEstimatorAbsSendTime::Id() const {
96 return static_cast<int>(reinterpret_cast<uint64_t>(this)); 96 return static_cast<int>(reinterpret_cast<uint64_t>(this));
97 } 97 }
98 98
99 RemoteBitrateEstimatorAbsSendTime::RemoteBitrateEstimatorAbsSendTime( 99 RemoteBitrateEstimatorAbsSendTime::RemoteBitrateEstimatorAbsSendTime(
100 RemoteBitrateObserver* observer, 100 RemoteBitrateObserver* observer,
101 Clock* clock) 101 Clock* clock)
102 : crit_sect_(CriticalSectionWrapper::CreateCriticalSection()), 102 : crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
103 observer_(observer), 103 observer_(observer),
104 clock_(clock), 104 clock_(clock),
105 ssrcs_(),
106 inter_arrival_(),
107 estimator_(OverUseDetectorOptions()),
108 detector_(OverUseDetectorOptions()),
105 incoming_bitrate_(kBitrateWindowMs, 8000), 109 incoming_bitrate_(kBitrateWindowMs, 8000),
106 last_process_time_(-1), 110 last_process_time_(-1),
107 process_interval_ms_(kProcessIntervalMs), 111 process_interval_ms_(kProcessIntervalMs),
108 total_propagation_delta_ms_(0), 112 total_propagation_delta_ms_(0),
109 total_probes_received_(0), 113 total_probes_received_(0),
110 first_packet_time_ms_(-1) { 114 first_packet_time_ms_(-1) {
111 assert(observer_); 115 assert(observer_);
112 assert(clock_); 116 assert(clock_);
113 LOG(LS_INFO) << "RemoteBitrateEstimatorAbsSendTime: Instantiating."; 117 LOG(LS_INFO) << "RemoteBitrateEstimatorAbsSendTime: Instantiating.";
114 } 118 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // here. 264 // here.
261 ssrcs_[ssrc] = now_ms; 265 ssrcs_[ssrc] = now_ms;
262 incoming_bitrate_.Update(payload_size, now_ms); 266 incoming_bitrate_.Update(payload_size, now_ms);
263 const BandwidthUsage prior_state = detector_.State(); 267 const BandwidthUsage prior_state = detector_.State();
264 268
265 if (first_packet_time_ms_ == -1) 269 if (first_packet_time_ms_ == -1)
266 first_packet_time_ms_ = clock_->TimeInMilliseconds(); 270 first_packet_time_ms_ = clock_->TimeInMilliseconds();
267 271
268 uint32_t ts_delta = 0; 272 uint32_t ts_delta = 0;
269 int64_t t_delta = 0; 273 int64_t t_delta = 0;
274 int size_delta = 0;
270 // For now only try to detect probes while we don't have a valid estimate, and 275 // For now only try to detect probes while we don't have a valid estimate, and
271 // make sure the packet was paced. We currently assume that only packets 276 // make sure the packet was paced. We currently assume that only packets
272 // larger than 200 bytes are paced by the sender. 277 // larger than 200 bytes are paced by the sender.
273 was_paced = was_paced && payload_size > PacedSender::kMinProbePacketSize; 278 was_paced = was_paced && payload_size > PacedSender::kMinProbePacketSize;
274 if (was_paced && 279 if (was_paced &&
275 (!remote_rate_.ValidEstimate() || 280 (!remote_rate_.ValidEstimate() ||
276 now_ms - first_packet_time_ms_ < kInitialProbingIntervalMs)) { 281 now_ms - first_packet_time_ms_ < kInitialProbingIntervalMs)) {
277 // TODO(holmer): Use a map instead to get correct order? 282 // TODO(holmer): Use a map instead to get correct order?
278 if (total_probes_received_ < kMaxProbePackets) { 283 if (total_probes_received_ < kMaxProbePackets) {
279 int send_delta_ms = -1; 284 int send_delta_ms = -1;
280 int recv_delta_ms = -1; 285 int recv_delta_ms = -1;
281 if (!probes_.empty()) { 286 if (!probes_.empty()) {
282 send_delta_ms = send_time_ms - probes_.back().send_time_ms; 287 send_delta_ms = send_time_ms - probes_.back().send_time_ms;
283 recv_delta_ms = arrival_time_ms - probes_.back().recv_time_ms; 288 recv_delta_ms = arrival_time_ms - probes_.back().recv_time_ms;
284 } 289 }
285 LOG(LS_INFO) << "Probe packet received: send time=" << send_time_ms 290 LOG(LS_INFO) << "Probe packet received: send time=" << send_time_ms
286 << " ms, recv time=" << arrival_time_ms 291 << " ms, recv time=" << arrival_time_ms
287 << " ms, send delta=" << send_delta_ms 292 << " ms, send delta=" << send_delta_ms
288 << " ms, recv delta=" << recv_delta_ms << " ms."; 293 << " ms, recv delta=" << recv_delta_ms << " ms.";
289 } 294 }
290 probes_.push_back(Probe(send_time_ms, arrival_time_ms, payload_size)); 295 probes_.push_back(Probe(send_time_ms, arrival_time_ms, payload_size));
291 ++total_probes_received_; 296 ++total_probes_received_;
292 ProcessClusters(now_ms); 297 ProcessClusters(now_ms);
293 } 298 }
294 if (!inter_arrival_.get()) { 299 if (!inter_arrival_.get()) {
295 inter_arrival_.reset( 300 inter_arrival_.reset(
296 new InterArrival((kTimestampGroupLengthMs << kInterArrivalShift) / 1000, 301 new InterArrival((kTimestampGroupLengthMs << kInterArrivalShift) / 1000,
297 kTimestampToMs, true)); 302 kTimestampToMs, true));
298 } 303 }
299 if (inter_arrival_->ComputeDeltas(timestamp, arrival_time_ms, &ts_delta, 304 if (inter_arrival_->ComputeDeltas(timestamp, arrival_time_ms, payload_size,
300 &t_delta)) { 305 &ts_delta, &t_delta, &size_delta)) {
301 double ts_delta_ms = (1000.0 * ts_delta) / (1 << kInterArrivalShift); 306 double ts_delta_ms = (1000.0 * ts_delta) / (1 << kInterArrivalShift);
302 estimator_.Update(t_delta, ts_delta_ms, detector_.State()); 307 estimator_.Update(t_delta, ts_delta_ms, size_delta, detector_.State());
303 detector_.Detect(estimator_.offset(), ts_delta_ms, 308 detector_.Detect(estimator_.offset(), ts_delta_ms,
304 estimator_.num_of_deltas(), arrival_time_ms); 309 estimator_.num_of_deltas(), arrival_time_ms);
305 UpdateStats(static_cast<int>(t_delta - ts_delta_ms), now_ms); 310 UpdateStats(static_cast<int>(t_delta - ts_delta_ms), now_ms);
306 } 311 }
307 if (detector_.State() == kBwOverusing) { 312 if (detector_.State() == kBwOverusing) {
308 uint32_t incoming_bitrate_bps = incoming_bitrate_.Rate(now_ms); 313 uint32_t incoming_bitrate_bps = incoming_bitrate_.Rate(now_ms);
309 if (prior_state != kBwOverusing || 314 if (prior_state != kBwOverusing ||
310 remote_rate_.TimeToReduceFurther(now_ms, incoming_bitrate_bps)) { 315 remote_rate_.TimeToReduceFurther(now_ms, incoming_bitrate_bps)) {
311 // The first overuse should immediately trigger a new estimate. 316 // The first overuse should immediately trigger a new estimate.
312 // We also have to update the estimate immediately if we are overusing 317 // We also have to update the estimate immediately if we are overusing
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 439
435 total_propagation_delta_ms_ = 440 total_propagation_delta_ms_ =
436 std::max(total_propagation_delta_ms_ + propagation_delta_ms, 0); 441 std::max(total_propagation_delta_ms_ + propagation_delta_ms, 0);
437 } 442 }
438 443
439 void RemoteBitrateEstimatorAbsSendTime::SetMinBitrate(int min_bitrate_bps) { 444 void RemoteBitrateEstimatorAbsSendTime::SetMinBitrate(int min_bitrate_bps) {
440 CriticalSectionScoped cs(crit_sect_.get()); 445 CriticalSectionScoped cs(crit_sect_.get());
441 remote_rate_.SetMinBitrate(min_bitrate_bps); 446 remote_rate_.SetMinBitrate(min_bitrate_bps);
442 } 447 }
443 } // namespace webrtc 448 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698