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