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

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

Issue 2996883002: In bwe test Collect receive statistic using GetReportBlocks collector (Closed)
Patch Set: . Created 3 years, 4 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/remb.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
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 // Log received packet information. 104 // Log received packet information.
105 BweReceiver::ReceivePacket(arrival_time_ms, media_packet); 105 BweReceiver::ReceivePacket(arrival_time_ms, media_packet);
106 } 106 }
107 107
108 FeedbackPacket* RembReceiver::GetFeedback(int64_t now_ms) { 108 FeedbackPacket* RembReceiver::GetFeedback(int64_t now_ms) {
109 BWE_TEST_LOGGING_CONTEXT("Remb"); 109 BWE_TEST_LOGGING_CONTEXT("Remb");
110 uint32_t estimated_bps = 0; 110 uint32_t estimated_bps = 0;
111 RembFeedback* feedback = NULL; 111 RembFeedback* feedback = NULL;
112 if (LatestEstimate(&estimated_bps)) { 112 if (LatestEstimate(&estimated_bps)) {
113 StatisticianMap statisticians = recv_stats_->GetActiveStatisticians(); 113 auto report_blocks = recv_stats_->RtcpReportBlocks(1);
114 RTCPReportBlock report_block; 114 if (!report_blocks.empty()) {
115 if (!statisticians.empty()) { 115 const rtcp::ReportBlock& stat = report_blocks.front();
116 latest_report_block_ = BuildReportBlock(statisticians.begin()->second); 116 latest_report_block_.fraction_lost = stat.fraction_lost();
117 latest_report_block_.packets_lost = stat.cumulative_lost();
118 latest_report_block_.extended_highest_sequence_number =
119 stat.extended_high_seq_num();
120 latest_report_block_.jitter = stat.jitter();
117 } 121 }
118 122
119 feedback = new RembFeedback(flow_id_, now_ms * 1000, last_feedback_ms_, 123 feedback = new RembFeedback(flow_id_, now_ms * 1000, last_feedback_ms_,
120 estimated_bps, latest_report_block_); 124 estimated_bps, latest_report_block_);
121 last_feedback_ms_ = now_ms; 125 last_feedback_ms_ = now_ms;
122 126
123 double estimated_kbps = static_cast<double>(estimated_bps) / 1000.0; 127 double estimated_kbps = static_cast<double>(estimated_bps) / 1000.0;
124 RTC_UNUSED(estimated_kbps); 128 RTC_UNUSED(estimated_kbps);
125 if (plot_estimate_) { 129 if (plot_estimate_) {
126 BWE_TEST_LOGGING_PLOT(0, estimate_log_prefix_, 130 BWE_TEST_LOGGING_PLOT(0, estimate_log_prefix_,
127 clock_.TimeInMilliseconds(), estimated_kbps); 131 clock_.TimeInMilliseconds(), estimated_kbps);
128 } 132 }
129 } 133 }
130 return feedback; 134 return feedback;
131 } 135 }
132 136
133 void RembReceiver::OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs, 137 void RembReceiver::OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs,
134 uint32_t bitrate) {} 138 uint32_t bitrate) {}
135 139
136 RTCPReportBlock RembReceiver::BuildReportBlock(
137 StreamStatistician* statistician) {
138 RTCPReportBlock report_block;
139 RtcpStatistics stats;
140 RTC_DCHECK(statistician->GetStatistics(&stats, true));
141 report_block.fraction_lost = stats.fraction_lost;
142 report_block.packets_lost = stats.packets_lost;
143 report_block.extended_highest_sequence_number =
144 stats.extended_highest_sequence_number;
145 report_block.jitter = stats.jitter;
146 return report_block;
147 }
148
149 bool RembReceiver::LatestEstimate(uint32_t* estimate_bps) { 140 bool RembReceiver::LatestEstimate(uint32_t* estimate_bps) {
150 if (latest_estimate_bps_ < 0) { 141 if (latest_estimate_bps_ < 0) {
151 std::vector<uint32_t> ssrcs; 142 std::vector<uint32_t> ssrcs;
152 uint32_t bps = 0; 143 uint32_t bps = 0;
153 if (!estimator_->LatestEstimate(&ssrcs, &bps)) { 144 if (!estimator_->LatestEstimate(&ssrcs, &bps)) {
154 return false; 145 return false;
155 } 146 }
156 latest_estimate_bps_ = bps; 147 latest_estimate_bps_ = bps;
157 } 148 }
158 *estimate_bps = latest_estimate_bps_; 149 *estimate_bps = latest_estimate_bps_;
159 return true; 150 return true;
160 } 151 }
161 152
162 } // namespace bwe 153 } // namespace bwe
163 } // namespace testing 154 } // namespace testing
164 } // namespace webrtc 155 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698