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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc

Issue 2756483002: Use RTC_UNUSED instead of conditional compilation in BWE simulator tool. (Closed)
Patch Set: Attempt static_cast<void>(x) Created 3 years, 9 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 214 }
215 215
216 RateCounterFilter::RateCounterFilter(PacketProcessorListener* listener, 216 RateCounterFilter::RateCounterFilter(PacketProcessorListener* listener,
217 int flow_id, 217 int flow_id,
218 const char* name, 218 const char* name,
219 const std::string& algorithm_name) 219 const std::string& algorithm_name)
220 : PacketProcessor(listener, flow_id, kRegular), 220 : PacketProcessor(listener, flow_id, kRegular),
221 packets_per_second_stats_(), 221 packets_per_second_stats_(),
222 kbps_stats_(), 222 kbps_stats_(),
223 start_plotting_time_ms_(0), 223 start_plotting_time_ms_(0),
224 #if BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
225 flow_id_(flow_id), 224 flow_id_(flow_id),
226 #endif
227 name_(name), 225 name_(name),
228 algorithm_name_(algorithm_name) {} 226 algorithm_name_(algorithm_name) {
227 // Only used when compiling with BWE test logging enabled.
228 RTC_UNUSED(flow_id_);
229 }
229 230
230 RateCounterFilter::RateCounterFilter(PacketProcessorListener* listener, 231 RateCounterFilter::RateCounterFilter(PacketProcessorListener* listener,
231 const FlowIds& flow_ids, 232 const FlowIds& flow_ids,
232 const char* name, 233 const char* name,
233 const std::string& algorithm_name) 234 const std::string& algorithm_name)
234 : PacketProcessor(listener, flow_ids, kRegular), 235 : PacketProcessor(listener, flow_ids, kRegular),
235 packets_per_second_stats_(), 236 packets_per_second_stats_(),
236 kbps_stats_(), 237 kbps_stats_(),
237 start_plotting_time_ms_(0), 238 start_plotting_time_ms_(0),
238 name_(name), 239 name_(name),
(...skipping 30 matching lines...) Expand all
269 kbps_stats_.Log("kbps"); 270 kbps_stats_.Log("kbps");
270 } 271 }
271 272
272 Stats<double> RateCounterFilter::GetBitrateStats() const { 273 Stats<double> RateCounterFilter::GetBitrateStats() const {
273 return kbps_stats_; 274 return kbps_stats_;
274 } 275 }
275 276
276 void RateCounterFilter::Plot(int64_t timestamp_ms) { 277 void RateCounterFilter::Plot(int64_t timestamp_ms) {
277 // TODO(stefan): Reorganize logging configuration to reduce amount 278 // TODO(stefan): Reorganize logging configuration to reduce amount
278 // of preprocessor conditionals in the code. 279 // of preprocessor conditionals in the code.
279 #if BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
280 uint32_t plot_kbps = 0; 280 uint32_t plot_kbps = 0;
281 if (timestamp_ms >= start_plotting_time_ms_) { 281 if (timestamp_ms >= start_plotting_time_ms_) {
282 plot_kbps = rate_counter_.bits_per_second() / 1000.0; 282 plot_kbps = rate_counter_.bits_per_second() / 1000.0;
283 } 283 }
284 BWE_TEST_LOGGING_CONTEXT(name_.c_str()); 284 BWE_TEST_LOGGING_CONTEXT(name_.c_str());
285 if (algorithm_name_.empty()) { 285 if (algorithm_name_.empty()) {
286 BWE_TEST_LOGGING_PLOT_WITH_SSRC(0, "Throughput_kbps#1", timestamp_ms, 286 BWE_TEST_LOGGING_PLOT_WITH_SSRC(0, "Throughput_kbps#1", timestamp_ms,
287 plot_kbps, flow_id_); 287 plot_kbps, flow_id_);
288 } else { 288 } else {
289 BWE_TEST_LOGGING_PLOT_WITH_NAME_AND_SSRC(0, "Throughput_kbps#1", 289 BWE_TEST_LOGGING_PLOT_WITH_NAME_AND_SSRC(0, "Throughput_kbps#1",
290 timestamp_ms, plot_kbps, flow_id_, 290 timestamp_ms, plot_kbps, flow_id_,
291 algorithm_name_); 291 algorithm_name_);
292 } 292 }
293 #endif 293 RTC_UNUSED(plot_kbps);
294 } 294 }
295 295
296 void RateCounterFilter::RunFor(int64_t /*time_ms*/, Packets* in_out) { 296 void RateCounterFilter::RunFor(int64_t /*time_ms*/, Packets* in_out) {
297 assert(in_out); 297 assert(in_out);
298 for (const Packet* packet : *in_out) { 298 for (const Packet* packet : *in_out) {
299 rate_counter_.UpdateRates(packet->send_time_us(), 299 rate_counter_.UpdateRates(packet->send_time_us(),
300 static_cast<int>(packet->payload_size())); 300 static_cast<int>(packet->payload_size()));
301 } 301 }
302 packets_per_second_stats_.Push(rate_counter_.packets_per_second()); 302 packets_per_second_stats_.Push(rate_counter_.packets_per_second());
303 kbps_stats_.Push(rate_counter_.bits_per_second() / 1000.0); 303 kbps_stats_.Push(rate_counter_.bits_per_second() / 1000.0);
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 uint32_t PeriodicKeyFrameSource::NextPacketSize(uint32_t frame_size, 811 uint32_t PeriodicKeyFrameSource::NextPacketSize(uint32_t frame_size,
812 uint32_t remaining_payload) { 812 uint32_t remaining_payload) {
813 uint32_t fragments = 813 uint32_t fragments =
814 (frame_size + (kMaxPayloadSizeBytes - 1)) / kMaxPayloadSizeBytes; 814 (frame_size + (kMaxPayloadSizeBytes - 1)) / kMaxPayloadSizeBytes;
815 uint32_t avg_size = (frame_size + fragments - 1) / fragments; 815 uint32_t avg_size = (frame_size + fragments - 1) / fragments;
816 return std::min(avg_size, remaining_payload); 816 return std::min(avg_size, remaining_payload);
817 } 817 }
818 } // namespace bwe 818 } // namespace bwe
819 } // namespace testing 819 } // namespace testing
820 } // namespace webrtc 820 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698