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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/test/estimators/nada.cc

Issue 1235143002: Fix simulator issue where chokes didn't apply to non-congested packets. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comments addressed. Created 5 years, 5 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/remote_bitrate_estimator/test/estimators/nada.h ('k') | no next file » | 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) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 11
12 // Implementation of Network-Assisted Dynamic Adaptation's (NADA's) proposal. 12 // Implementation of Network-Assisted Dynamic Adaptation's (NADA's) proposal.
13 // Version according to Draft Document (mentioned in references) 13 // Version according to Draft Document (mentioned in references)
14 // http://tools.ietf.org/html/draft-zhu-rmcat-nada-06 14 // http://tools.ietf.org/html/draft-zhu-rmcat-nada-06
15 // From March 26, 2015. 15 // From March 26, 2015.
16 16
17 #include <math.h> 17 #include <math.h>
18 #include <algorithm> 18 #include <algorithm>
19 #include <vector> 19 #include <vector>
20 #include <iostream> 20 #include <iostream>
21 21
22 #include "webrtc/base/common.h"
22 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h" 23 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h"
23 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" 24 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
24 #include "webrtc/modules/rtp_rtcp/interface/receive_statistics.h" 25 #include "webrtc/modules/rtp_rtcp/interface/receive_statistics.h"
25 26
26 namespace webrtc { 27 namespace webrtc {
27 namespace testing { 28 namespace testing {
28 namespace bwe { 29 namespace bwe {
29 30
30 const int NadaBweReceiver::kMedian; 31 const int NadaBweSender::kMinRefRateKbps = 150;
31 const int NadaBweSender::kMinRefRateKbps; 32 const int NadaBweSender::kMaxRefRateKbps = 1500;
32 const int NadaBweSender::kMaxRefRateKbps; 33 const int64_t NadaBweReceiver::kReceivingRateTimeWindowMs = 500;
33 const int64_t NadaBweReceiver::kReceivingRateTimeWindowMs;
34 34
35 NadaBweReceiver::NadaBweReceiver(int flow_id) 35 NadaBweReceiver::NadaBweReceiver(int flow_id)
36 : BweReceiver(flow_id), 36 : BweReceiver(flow_id),
37 clock_(0), 37 clock_(0),
38 last_feedback_ms_(0), 38 last_feedback_ms_(0),
39 recv_stats_(ReceiveStatistics::Create(&clock_)), 39 recv_stats_(ReceiveStatistics::Create(&clock_)),
40 baseline_delay_ms_(0), 40 baseline_delay_ms_(0),
41 delay_signal_ms_(0), 41 delay_signal_ms_(0),
42 last_congestion_signal_ms_(0), 42 last_congestion_signal_ms_(0),
43 last_delays_index_(0), 43 last_delays_index_(0),
(...skipping 13 matching lines...) Expand all
57 clock_.AdvanceTimeMilliseconds(arrival_time_ms - clock_.TimeInMilliseconds()); 57 clock_.AdvanceTimeMilliseconds(arrival_time_ms - clock_.TimeInMilliseconds());
58 recv_stats_->IncomingPacket(media_packet.header(), 58 recv_stats_->IncomingPacket(media_packet.header(),
59 media_packet.payload_size(), false); 59 media_packet.payload_size(), false);
60 int64_t delay_ms = arrival_time_ms - 60 int64_t delay_ms = arrival_time_ms -
61 media_packet.creation_time_us() / 1000; // Refered as x_n. 61 media_packet.creation_time_us() / 1000; // Refered as x_n.
62 // The min should be updated within the first 10 minutes. 62 // The min should be updated within the first 10 minutes.
63 if (clock_.TimeInMilliseconds() < 10 * 60 * 1000) { 63 if (clock_.TimeInMilliseconds() < 10 * 60 * 1000) {
64 baseline_delay_ms_ = std::min(baseline_delay_ms_, delay_ms); 64 baseline_delay_ms_ = std::min(baseline_delay_ms_, delay_ms);
65 } 65 }
66 delay_signal_ms_ = delay_ms - baseline_delay_ms_; // Refered as d_n. 66 delay_signal_ms_ = delay_ms - baseline_delay_ms_; // Refered as d_n.
67 const int kMedian = ARRAY_SIZE(last_delays_ms_);
67 last_delays_ms_[(last_delays_index_++) % kMedian] = delay_signal_ms_; 68 last_delays_ms_[(last_delays_index_++) % kMedian] = delay_signal_ms_;
68 int size = std::min(last_delays_index_, kMedian); 69 int size = std::min(last_delays_index_, kMedian);
69 int64_t median_filtered_delay_ms_ = MedianFilter(last_delays_ms_, size); 70 int64_t median_filtered_delay_ms_ = MedianFilter(last_delays_ms_, size);
70 exp_smoothed_delay_ms_ = ExponentialSmoothingFilter( 71 exp_smoothed_delay_ms_ = ExponentialSmoothingFilter(
71 median_filtered_delay_ms_, exp_smoothed_delay_ms_, kAlpha); 72 median_filtered_delay_ms_, exp_smoothed_delay_ms_, kAlpha);
72 73
73 if (exp_smoothed_delay_ms_ < kDelayLowThresholdMs) { 74 if (exp_smoothed_delay_ms_ < kDelayLowThresholdMs) {
74 est_queuing_delay_signal_ms_ = exp_smoothed_delay_ms_; 75 est_queuing_delay_signal_ms_ = exp_smoothed_delay_ms_;
75 } else if (exp_smoothed_delay_ms_ < kDelayMaxThresholdMs) { 76 } else if (exp_smoothed_delay_ms_ < kDelayMaxThresholdMs) {
76 est_queuing_delay_signal_ms_ = static_cast<int64_t>( 77 est_queuing_delay_signal_ms_ = static_cast<int64_t>(
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 (kTheta - (bitrate_kbps_ - kMinRefRateKbps) * x_hat)) / 319 (kTheta - (bitrate_kbps_ - kMinRefRateKbps) * x_hat)) /
319 (kTauOMs * kTauOMs) + 320 (kTauOMs * kTauOMs) +
320 0.5f); 321 0.5f);
321 322
322 bitrate_kbps_ = bitrate_kbps_ + smoothing_factor * original_increase; 323 bitrate_kbps_ = bitrate_kbps_ + smoothing_factor * original_increase;
323 } 324 }
324 325
325 } // namespace bwe 326 } // namespace bwe
326 } // namespace testing 327 } // namespace testing
327 } // namespace webrtc 328 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698