OLD | NEW |
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 #include <algorithm> | 11 #include <algorithm> |
12 | 12 |
13 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h" | 13 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h" |
14 | 14 |
15 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 15 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
16 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_s
end_time.h" | 16 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_s
end_time.h" |
17 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" | 17 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" |
18 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" | 18 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" |
19 #include "webrtc/test/gtest.h" | 19 #include "webrtc/test/gtest.h" |
| 20 #include "webrtc/typedefs.h" |
20 | 21 |
21 namespace webrtc { | 22 namespace webrtc { |
22 namespace testing { | 23 namespace testing { |
23 namespace bwe { | 24 namespace bwe { |
24 | 25 |
25 RembBweSender::RembBweSender(int kbps, BitrateObserver* observer, Clock* clock) | 26 RembBweSender::RembBweSender(int kbps, BitrateObserver* observer, Clock* clock) |
26 : bitrate_controller_( | 27 : bitrate_controller_( |
27 BitrateController::CreateBitrateController(clock, | 28 BitrateController::CreateBitrateController(clock, |
28 observer, | 29 observer, |
29 &event_log_)), | 30 &event_log_)), |
(...skipping 28 matching lines...) Expand all Loading... |
58 bitrate_controller_->Process(); | 59 bitrate_controller_->Process(); |
59 } | 60 } |
60 | 61 |
61 int RembBweSender::GetFeedbackIntervalMs() const { | 62 int RembBweSender::GetFeedbackIntervalMs() const { |
62 return 100; | 63 return 100; |
63 } | 64 } |
64 | 65 |
65 RembReceiver::RembReceiver(int flow_id, bool plot) | 66 RembReceiver::RembReceiver(int flow_id, bool plot) |
66 : BweReceiver(flow_id), | 67 : BweReceiver(flow_id), |
67 estimate_log_prefix_(), | 68 estimate_log_prefix_(), |
68 #if BWE_TEST_LOGGING_COMPILE_TIME_ENABLE | |
69 plot_estimate_(plot), | 69 plot_estimate_(plot), |
70 #endif | |
71 clock_(0), | 70 clock_(0), |
72 recv_stats_(ReceiveStatistics::Create(&clock_)), | 71 recv_stats_(ReceiveStatistics::Create(&clock_)), |
73 latest_estimate_bps_(-1), | 72 latest_estimate_bps_(-1), |
74 last_feedback_ms_(-1), | 73 last_feedback_ms_(-1), |
75 estimator_(new RemoteBitrateEstimatorAbsSendTime(this, &clock_)) { | 74 estimator_(new RemoteBitrateEstimatorAbsSendTime(this, &clock_)) { |
76 std::stringstream ss; | 75 std::stringstream ss; |
77 ss << "Estimate_" << flow_id_ << "#1"; | 76 ss << "Estimate_" << flow_id_ << "#1"; |
78 estimate_log_prefix_ = ss.str(); | 77 estimate_log_prefix_ = ss.str(); |
79 // Default RTT in RemoteRateControl is 200 ms ; 50 ms is more realistic. | 78 // Default RTT in RemoteRateControl is 200 ms ; 50 ms is more realistic. |
80 estimator_->OnRttUpdate(50, 50); | 79 estimator_->OnRttUpdate(50, 50); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 StatisticianMap statisticians = recv_stats_->GetActiveStatisticians(); | 113 StatisticianMap statisticians = recv_stats_->GetActiveStatisticians(); |
115 RTCPReportBlock report_block; | 114 RTCPReportBlock report_block; |
116 if (!statisticians.empty()) { | 115 if (!statisticians.empty()) { |
117 latest_report_block_ = BuildReportBlock(statisticians.begin()->second); | 116 latest_report_block_ = BuildReportBlock(statisticians.begin()->second); |
118 } | 117 } |
119 | 118 |
120 feedback = new RembFeedback(flow_id_, now_ms * 1000, last_feedback_ms_, | 119 feedback = new RembFeedback(flow_id_, now_ms * 1000, last_feedback_ms_, |
121 estimated_bps, latest_report_block_); | 120 estimated_bps, latest_report_block_); |
122 last_feedback_ms_ = now_ms; | 121 last_feedback_ms_ = now_ms; |
123 | 122 |
124 #if BWE_TEST_LOGGING_COMPILE_TIME_ENABLE | |
125 double estimated_kbps = static_cast<double>(estimated_bps) / 1000.0; | 123 double estimated_kbps = static_cast<double>(estimated_bps) / 1000.0; |
| 124 RTC_UNUSED(estimated_kbps); |
126 if (plot_estimate_) { | 125 if (plot_estimate_) { |
127 BWE_TEST_LOGGING_PLOT(0, estimate_log_prefix_, | 126 BWE_TEST_LOGGING_PLOT(0, estimate_log_prefix_, |
128 clock_.TimeInMilliseconds(), estimated_kbps); | 127 clock_.TimeInMilliseconds(), estimated_kbps); |
129 } | 128 } |
130 #endif | |
131 } | 129 } |
132 return feedback; | 130 return feedback; |
133 } | 131 } |
134 | 132 |
135 void RembReceiver::OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs, | 133 void RembReceiver::OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs, |
136 uint32_t bitrate) {} | 134 uint32_t bitrate) {} |
137 | 135 |
138 RTCPReportBlock RembReceiver::BuildReportBlock( | 136 RTCPReportBlock RembReceiver::BuildReportBlock( |
139 StreamStatistician* statistician) { | 137 StreamStatistician* statistician) { |
140 RTCPReportBlock report_block; | 138 RTCPReportBlock report_block; |
(...skipping 15 matching lines...) Expand all Loading... |
156 } | 154 } |
157 latest_estimate_bps_ = bps; | 155 latest_estimate_bps_ = bps; |
158 } | 156 } |
159 *estimate_bps = latest_estimate_bps_; | 157 *estimate_bps = latest_estimate_bps_; |
160 return true; | 158 return true; |
161 } | 159 } |
162 | 160 |
163 } // namespace bwe | 161 } // namespace bwe |
164 } // namespace testing | 162 } // namespace testing |
165 } // namespace webrtc | 163 } // namespace webrtc |
OLD | NEW |