webrtc/rtc_tools/event_log_visualizer/plot_base.cc
Björn Terelius ff61273c01 Revert "Create new API for RtcEventLogParser."
This reverts commit 9e336ec0b8.

Reason for revert: Code can accidentally include the deprecated parser but link with the new one, or vice versa. Reverting to fix naming.

Original change's description:
> Create new API for RtcEventLogParser.
> 
> The new API stores events gathered by event type. For example, it is
> possible to ask fo a list of all incoming RTCP messages or all audio
> playout events.
> 
> The new API is experimental and may change over next few weeks. Once
> it has stabilized and all unit tests and existing tools have been
> ported to the new API, the old one will be removed.
> 
> This CL also updates the event_log_visualizer tool to use the new
> parser API. This is not a funcional change except for:
> - Incoming and outgoing audio level are now drawn in two separate plots.
> - Incoming and outgoing timstamps are now drawn in two separate plots.
> - RTCP count is no longer split into Video and Audio. It also counts
>   all RTCP packets rather than only specific message types.
> - Slight timing difference in sendside BWE simulation due to only
>   iterating over transport feedbacks and not over all RTCP packets.
>   This timing changes are not visible in the plots.
> 
> 
> Media type for RTCP messages might not be identified correctly by
> rtc_event_log2text anymore. On the other hand, assigning a specific
> media type to an RTCP packet was a bit hacky to begin with.
> 
> Bug: webrtc:8111
> Change-Id: I8e7168302beb69b2e163a097a2a142b86dd4a26b
> Reviewed-on: https://webrtc-review.googlesource.com/60865
> Reviewed-by: Minyue Li <minyue@webrtc.org>
> Reviewed-by: Sebastian Jansson <srte@webrtc.org>
> Commit-Queue: Björn Terelius <terelius@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#23015}

TBR=terelius@webrtc.org,srte@webrtc.org,minyue@webrtc.org

Change-Id: Ib4bbcf0563423675a3cc1dce59ebf665e0c5dae9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8111
Reviewed-on: https://webrtc-review.googlesource.com/72500
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23026}
2018-04-25 14:23:14 +00:00

89 lines
2.8 KiB
C++

/*
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_tools/event_log_visualizer/plot_base.h"
#include <algorithm>
#include "rtc_base/checks.h"
namespace webrtc {
namespace plotting {
void Plot::SetXAxis(float min_value,
float max_value,
std::string label,
float left_margin,
float right_margin) {
RTC_DCHECK_LE(min_value, max_value);
xaxis_min_ = min_value - left_margin * (max_value - min_value);
xaxis_max_ = max_value + right_margin * (max_value - min_value);
xaxis_label_ = label;
}
void Plot::SetSuggestedXAxis(float min_value,
float max_value,
std::string label,
float left_margin,
float right_margin) {
for (const auto& series : series_list_) {
for (const auto& point : series.points) {
min_value = std::min(min_value, point.x);
max_value = std::max(max_value, point.x);
}
}
SetXAxis(min_value, max_value, label, left_margin, right_margin);
}
void Plot::SetYAxis(float min_value,
float max_value,
std::string label,
float bottom_margin,
float top_margin) {
RTC_DCHECK_LE(min_value, max_value);
yaxis_min_ = min_value - bottom_margin * (max_value - min_value);
yaxis_max_ = max_value + top_margin * (max_value - min_value);
yaxis_label_ = label;
}
void Plot::SetSuggestedYAxis(float min_value,
float max_value,
std::string label,
float bottom_margin,
float top_margin) {
for (const auto& series : series_list_) {
for (const auto& point : series.points) {
min_value = std::min(min_value, point.y);
max_value = std::max(max_value, point.y);
}
}
SetYAxis(min_value, max_value, label, bottom_margin, top_margin);
}
void Plot::SetTitle(std::string title) {
title_ = title;
}
void Plot::AppendTimeSeries(TimeSeries&& time_series) {
series_list_.emplace_back(std::move(time_series));
}
void Plot::AppendIntervalSeries(IntervalSeries&& interval_series) {
interval_list_.emplace_back(std::move(interval_series));
}
void Plot::AppendTimeSeriesIfNotEmpty(TimeSeries&& time_series) {
if (time_series.points.size() > 0) {
series_list_.emplace_back(std::move(time_series));
}
}
} // namespace plotting
} // namespace webrtc