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

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

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
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 */
(...skipping 28 matching lines...) Expand all
39 void ReceivePacket(int64_t arrival_time_ms, 39 void ReceivePacket(int64_t arrival_time_ms,
40 const MediaPacket& media_packet) override; 40 const MediaPacket& media_packet) override;
41 FeedbackPacket* GetFeedback(int64_t now_ms) override; 41 FeedbackPacket* GetFeedback(int64_t now_ms) override;
42 42
43 size_t RecentReceivingRate(); 43 size_t RecentReceivingRate();
44 static int64_t MedianFilter(int64_t* v, int size); 44 static int64_t MedianFilter(int64_t* v, int size);
45 static int64_t ExponentialSmoothingFilter(int64_t new_value, 45 static int64_t ExponentialSmoothingFilter(int64_t new_value,
46 int64_t last_smoothed_value, 46 int64_t last_smoothed_value,
47 float alpha); 47 float alpha);
48 48
49 static const int64_t kReceivingRateTimeWindowMs = 500; 49 static const int64_t kReceivingRateTimeWindowMs;
50 50
51 private: 51 private:
52 SimulatedClock clock_; 52 SimulatedClock clock_;
53 int64_t last_feedback_ms_; 53 int64_t last_feedback_ms_;
54 rtc::scoped_ptr<ReceiveStatistics> recv_stats_; 54 rtc::scoped_ptr<ReceiveStatistics> recv_stats_;
55 int64_t baseline_delay_ms_; // Referred as d_f. 55 int64_t baseline_delay_ms_; // Referred as d_f.
56 int64_t delay_signal_ms_; // Referred as d_n. 56 int64_t delay_signal_ms_; // Referred as d_n.
57 int64_t last_congestion_signal_ms_; 57 int64_t last_congestion_signal_ms_;
58 int last_delays_index_; 58 int last_delays_index_;
59 int64_t exp_smoothed_delay_ms_; // Referred as d_hat_n. 59 int64_t exp_smoothed_delay_ms_; // Referred as d_hat_n.
60 int64_t est_queuing_delay_signal_ms_; // Referred as d_tilde_n. 60 int64_t est_queuing_delay_signal_ms_; // Referred as d_tilde_n.
61 61 int64_t last_delays_ms_[5]; // Used for Median Filter.
62 static const int kMedian = 5; // Used for k-points Median Filter.
63 int64_t last_delays_ms_[kMedian]; // Used for Median Filter.
64 }; 62 };
65 63
66 class NadaBweSender : public BweSender { 64 class NadaBweSender : public BweSender {
67 public: 65 public:
68 NadaBweSender(int kbps, BitrateObserver* observer, Clock* clock); 66 NadaBweSender(int kbps, BitrateObserver* observer, Clock* clock);
69 NadaBweSender(BitrateObserver* observer, Clock* clock); 67 NadaBweSender(BitrateObserver* observer, Clock* clock);
70 virtual ~NadaBweSender(); 68 virtual ~NadaBweSender();
71 69
72 int GetFeedbackIntervalMs() const override; 70 int GetFeedbackIntervalMs() const override;
73 // Updates the min_feedback_delay_ms_ and the min_round_trip_time_ms_. 71 // Updates the min_feedback_delay_ms_ and the min_round_trip_time_ms_.
74 void GiveFeedback(const FeedbackPacket& feedback) override; 72 void GiveFeedback(const FeedbackPacket& feedback) override;
75 void OnPacketsSent(const Packets& packets) override {} 73 void OnPacketsSent(const Packets& packets) override {}
76 int64_t TimeUntilNextProcess() override; 74 int64_t TimeUntilNextProcess() override;
77 int Process() override; 75 int Process() override;
78 void AcceleratedRampUp(const NadaFeedback& fb); 76 void AcceleratedRampUp(const NadaFeedback& fb);
79 void AcceleratedRampDown(const NadaFeedback& fb); 77 void AcceleratedRampDown(const NadaFeedback& fb);
80 void GradualRateUpdate(const NadaFeedback& fb, 78 void GradualRateUpdate(const NadaFeedback& fb,
81 float delta_s, 79 float delta_s,
82 double smoothing_factor); 80 double smoothing_factor);
83 81
84 int bitrate_kbps() const { return bitrate_kbps_; } 82 int bitrate_kbps() const { return bitrate_kbps_; }
85 void set_bitrate_kbps(int bitrate_kbps) { bitrate_kbps_ = bitrate_kbps; } 83 void set_bitrate_kbps(int bitrate_kbps) { bitrate_kbps_ = bitrate_kbps; }
86 bool original_operating_mode() const { return original_operating_mode_; } 84 bool original_operating_mode() const { return original_operating_mode_; }
87 void set_original_operating_mode(bool original_operating_mode) { 85 void set_original_operating_mode(bool original_operating_mode) {
88 original_operating_mode_ = original_operating_mode; 86 original_operating_mode_ = original_operating_mode;
89 } 87 }
90 int64_t NowMs() const { return clock_->TimeInMilliseconds(); } 88 int64_t NowMs() const { return clock_->TimeInMilliseconds(); }
91 89
92 static const int kMinRefRateKbps = 150; // Referred as R_min. 90 static const int kMinRefRateKbps; // Referred as R_min.
93 static const int kMaxRefRateKbps = 1500; // Referred as R_max. 91 static const int kMaxRefRateKbps; // Referred as R_max.
94 92
95 private: 93 private:
96 Clock* const clock_; 94 Clock* const clock_;
97 BitrateObserver* const observer_; 95 BitrateObserver* const observer_;
98 // Used as an upper bound for calling AcceleratedRampDown. 96 // Used as an upper bound for calling AcceleratedRampDown.
99 const float kMaxCongestionSignalMs = 40.0f + kMinRefRateKbps / 15; 97 const float kMaxCongestionSignalMs = 40.0f + kMinRefRateKbps / 15;
100 // Referred as R_min, default initialization for bitrate R_n. 98 // Referred as R_min, default initialization for bitrate R_n.
101 int bitrate_kbps_; // Referred as "Reference Rate" = R_n. 99 int bitrate_kbps_; // Referred as "Reference Rate" = R_n.
102 int64_t last_feedback_ms_ = 0; 100 int64_t last_feedback_ms_ = 0;
103 // Referred as delta_0, initialized as an upper bound. 101 // Referred as delta_0, initialized as an upper bound.
104 int64_t min_feedback_delay_ms_ = 200; 102 int64_t min_feedback_delay_ms_ = 200;
105 // Referred as RTT_0, initialized as an upper bound. 103 // Referred as RTT_0, initialized as an upper bound.
106 int64_t min_round_trip_time_ms_ = 100; 104 int64_t min_round_trip_time_ms_ = 100;
107 bool original_operating_mode_; 105 bool original_operating_mode_;
108 106
109 DISALLOW_IMPLICIT_CONSTRUCTORS(NadaBweSender); 107 DISALLOW_IMPLICIT_CONSTRUCTORS(NadaBweSender);
110 }; 108 };
111 109
112 } // namespace bwe 110 } // namespace bwe
113 } // namespace testing 111 } // namespace testing
114 } // namespace webrtc 112 } // namespace webrtc
115 113
116 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_NADA_H_ 114 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_NADA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698