From 61050f67efbf3e3df2c6aa353db0d027be3eac4f Mon Sep 17 00:00:00 2001 From: "gaetano.carlucci" Date: Fri, 30 Sep 2016 06:29:54 -0700 Subject: [PATCH] Fixig issues in BWE dynamics plot scripts. BUG=None Review-Url: https://codereview.webrtc.org/2360053003 Cr-Commit-Position: refs/heads/master@{#14459} --- .../bitrate_controller_impl.cc | 8 ++++---- webrtc/modules/remote_bitrate_estimator/BUILD.gn | 13 +++++-------- .../remote_bitrate_estimator/overuse_detector.cc | 4 ++-- .../overuse_estimator.cc | 6 +++--- .../remote_bitrate_estimator.gypi | 16 ++++++---------- .../test/plot_dynamics.py | 6 ++---- .../test/plot_dynamics.sh | 2 +- .../rtp_rtcp/source/receive_statistics_impl.cc | 4 ++-- webrtc/modules/rtp_rtcp/source/rtp_sender.cc | 10 +++++----- 9 files changed, 30 insertions(+), 39 deletions(-) mode change 100644 => 100755 webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.py diff --git a/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc b/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc index b3363679bd..a1f1fd3a70 100644 --- a/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc +++ b/webrtc/modules/bitrate_controller/bitrate_controller_impl.cc @@ -180,7 +180,7 @@ void BitrateControllerImpl::OnReceiverEstimatedBitrate(uint32_t bitrate) { rtc::CritScope cs(&critsect_); bandwidth_estimation_.UpdateReceiverEstimate(clock_->TimeInMilliseconds(), bitrate); - BWE_TEST_LOGGING_PLOT(1, "REMB[kbps]", clock_->TimeInMilliseconds(), + BWE_TEST_LOGGING_PLOT(1, "REMB_kbps", clock_->TimeInMilliseconds(), bitrate / 1000); } MaybeTriggerOnNetworkChanged(); @@ -269,11 +269,11 @@ bool BitrateControllerImpl::GetNetworkParameters(uint32_t* bitrate, new_bitrate = true; } - BWE_TEST_LOGGING_PLOT(1, "fraction_loss_[%%]", clock_->TimeInMilliseconds(), + BWE_TEST_LOGGING_PLOT(1, "fraction_loss_%", clock_->TimeInMilliseconds(), (last_fraction_loss_ * 100) / 256); - BWE_TEST_LOGGING_PLOT(1, "rtt[ms]", clock_->TimeInMilliseconds(), + BWE_TEST_LOGGING_PLOT(1, "rtt_ms", clock_->TimeInMilliseconds(), last_rtt_ms_); - BWE_TEST_LOGGING_PLOT(1, "Target_bitrate[kbps]", clock_->TimeInMilliseconds(), + BWE_TEST_LOGGING_PLOT(1, "Target_bitrate_kbps", clock_->TimeInMilliseconds(), last_bitrate_bps_ / 1000); return new_bitrate; diff --git a/webrtc/modules/remote_bitrate_estimator/BUILD.gn b/webrtc/modules/remote_bitrate_estimator/BUILD.gn index 2a7c68f773..515376b2b2 100644 --- a/webrtc/modules/remote_bitrate_estimator/BUILD.gn +++ b/webrtc/modules/remote_bitrate_estimator/BUILD.gn @@ -32,13 +32,11 @@ rtc_static_library("remote_bitrate_estimator") { "test/bwe_test_logging.h", ] - if (!rtc_include_tests) { - if (rtc_enable_bwe_test_logging) { - defines = [ "BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=1" ] - sources += [ "test/bwe_test_logging.cc" ] - } else { - defines = [ "BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=0" ] - } + if (rtc_enable_bwe_test_logging) { + defines = [ "BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=1" ] + sources += [ "test/bwe_test_logging.cc" ] + } else { + defines = [ "BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=0" ] } if (is_clang) { @@ -88,7 +86,6 @@ if (rtc_include_tests) { if (rtc_enable_bwe_test_logging) { defines = [ "BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=1" ] - sources += [ "test/bwe_test_logging.cc" ] } else { defines = [ "BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=0" ] } diff --git a/webrtc/modules/remote_bitrate_estimator/overuse_detector.cc b/webrtc/modules/remote_bitrate_estimator/overuse_detector.cc index 05f44aca5a..a57ea16584 100644 --- a/webrtc/modules/remote_bitrate_estimator/overuse_detector.cc +++ b/webrtc/modules/remote_bitrate_estimator/overuse_detector.cc @@ -94,8 +94,8 @@ BandwidthUsage OveruseDetector::Detect(double offset, const double prev_offset = prev_offset_; prev_offset_ = offset; const double T = std::min(num_of_deltas, kMinNumDeltas) * offset; - BWE_TEST_LOGGING_PLOT(1, "offset[ms]", now_ms, offset); - BWE_TEST_LOGGING_PLOT(1, "gamma[ms]", now_ms, threshold_ / kMinNumDeltas); + BWE_TEST_LOGGING_PLOT(1, "offset_ms#1", now_ms, offset); + BWE_TEST_LOGGING_PLOT(1, "gamma_ms#1", now_ms, threshold_ / kMinNumDeltas); if (T > threshold_) { if (time_over_using_ == -1) { // Initialize the timer. Assume that we've been diff --git a/webrtc/modules/remote_bitrate_estimator/overuse_estimator.cc b/webrtc/modules/remote_bitrate_estimator/overuse_estimator.cc index 5535fe3be3..54e73d972b 100644 --- a/webrtc/modules/remote_bitrate_estimator/overuse_estimator.cc +++ b/webrtc/modules/remote_bitrate_estimator/overuse_estimator.cc @@ -53,7 +53,7 @@ void OveruseEstimator::Update(int64_t t_delta, int64_t now_ms) { const double min_frame_period = UpdateMinFramePeriod(ts_delta); const double t_ts_delta = t_delta - ts_delta; - BWE_TEST_LOGGING_PLOT(1, "dm[ms]", now_ms, t_ts_delta); + BWE_TEST_LOGGING_PLOT(1, "dm_ms", now_ms, t_ts_delta); double fs_delta = size_delta; ++num_of_deltas_; @@ -74,7 +74,7 @@ void OveruseEstimator::Update(int64_t t_delta, const double Eh[2] = {E_[0][0]*h[0] + E_[0][1]*h[1], E_[1][0]*h[0] + E_[1][1]*h[1]}; - BWE_TEST_LOGGING_PLOT(1, "d[ms]", now_ms, slope_ * h[0] - offset_); + BWE_TEST_LOGGING_PLOT(1, "d_ms", now_ms, slope_ * h[0] - offset_); const double residual = t_ts_delta - slope_*h[0] - offset_; @@ -120,7 +120,7 @@ void OveruseEstimator::Update(int64_t t_delta, BWE_TEST_LOGGING_PLOT(1, "kc", now_ms, K[0]); BWE_TEST_LOGGING_PLOT(1, "km", now_ms, K[1]); - BWE_TEST_LOGGING_PLOT(1, "slope[1/bps]", now_ms, slope_); + BWE_TEST_LOGGING_PLOT(1, "slope_1/bps", now_ms, slope_); BWE_TEST_LOGGING_PLOT(1, "var_noise", now_ms, var_noise_); } diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi index e719f2ff9d..a5b0ab86bf 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi @@ -41,17 +41,13 @@ 'test/bwe_test_logging.h', ], # source 'conditions': [ - ['include_tests==0', { - 'conditions': [ - ['enable_bwe_test_logging==1', { - 'defines': [ 'BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=1' ], - 'sources': [ - 'test/bwe_test_logging.cc' - ], - }, { - 'defines': [ 'BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=0' ], - }], + ['enable_bwe_test_logging==1', { + 'defines': [ 'BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=1' ], + 'sources': [ + 'test/bwe_test_logging.cc' ], + }, { + 'defines': [ 'BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=0' ], }], ], }, diff --git a/webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.py b/webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.py old mode 100644 new mode 100755 index 1bae1e81f0..164300141d --- a/webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.py +++ b/webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.py @@ -49,11 +49,11 @@ class Variable(object): def addSample(self, line): - groups = re.search(r'_(((\d)+((,(\d)+)*))_(\D+))#\d@(\S+)', line) + groups = re.search(r'_(((\d)+((,(\d)+)*))_(\D+))#\d:(\d)@(\S+)', line) # Each variable will be plotted in a separated box. var_name = groups.group(1) - alg_name = groups.group(8) + alg_name = groups.group(9) alg_name = alg_name.replace('_', ' ') @@ -126,8 +126,6 @@ def main(): ('Throughput_kbps', "Time (s)", "Throughput (kbps)", 1, 4000), ('Delay_ms', "Time (s)", "One-way Delay (ms)", 2, 500), ('Packet_Loss', "Time (s)", "Packet Loss Ratio", 3, 1.0), - # ('Sending_Estimate_kbps', "Time (s)", "Sending Estimate (kbps)", - # 4, 4000), ] var = [] diff --git a/webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.sh b/webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.sh index fd104a1704..cb65e134b8 100755 --- a/webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.sh +++ b/webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.sh @@ -28,7 +28,7 @@ log=$(TimeInMilliseconds(), cumulative_loss_, ssrc_); BWE_TEST_LOGGING_PLOT_WITH_SSRC( - 1, "received_seq_max[pkts]", clock_->TimeInMilliseconds(), + 1, "received_seq_max_pkts", clock_->TimeInMilliseconds(), (received_seq_max_ - received_seq_first_), ssrc_); return stats; diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc index 38069688f2..551466690f 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc @@ -902,16 +902,16 @@ bool RTPSender::SendToNetwork(std::unique_ptr packet, packet->SetExtension(now_ms); if (video_) { - BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoTotBitrate[kbps]", now_ms, + BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoTotBitrate_kbps", now_ms, ActualSendBitrateKbit(), packet->Ssrc()); - BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoFecBitrate[Kbps]", now_ms, + BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoFecBitrate_kbps", now_ms, FecOverheadRate() / 1000, packet->Ssrc()); - BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoNackBitrate[Kbps]", now_ms, + BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "VideoNackBitrate_kbps", now_ms, NackOverheadRate() / 1000, packet->Ssrc()); } else { - BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "AudioTotBitrate[kbps]", now_ms, + BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "AudioTotBitrate_kbps", now_ms, ActualSendBitrateKbit(), packet->Ssrc()); - BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "AudioNackBitrate[Kbps]", now_ms, + BWE_TEST_LOGGING_PLOT_WITH_SSRC(1, "AudioNackBitrate_kbps", now_ms, NackOverheadRate() / 1000, packet->Ssrc()); }