Total packet rate plots for event_log_visualizer.
Bug: b/152399961 Change-Id: I9fcd2e234f229cefc972149ab22ccd845a8e90ba Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/172440 Reviewed-by: Björn Terelius <terelius@webrtc.org> Commit-Queue: Kristoffer Erlandsson <kerl@google.com> Cr-Commit-Position: refs/heads/master@{#30963}
This commit is contained in:

committed by
Commit Bot

parent
647968f7c9
commit
a2ce423efb
@ -28,6 +28,7 @@
|
||||
#include "call/call.h"
|
||||
#include "call/video_receive_stream.h"
|
||||
#include "call/video_send_stream.h"
|
||||
#include "logging/rtc_event_log/rtc_event_processor.h"
|
||||
#include "logging/rtc_event_log/rtc_stream_config.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h"
|
||||
#include "modules/audio_coding/neteq/tools/audio_sink.h"
|
||||
@ -654,6 +655,57 @@ void EventLogAnalyzer::CreatePacketRateGraph(PacketDirection direction,
|
||||
" RTP/RTCP packets");
|
||||
}
|
||||
|
||||
void EventLogAnalyzer::CreateTotalPacketRateGraph(PacketDirection direction,
|
||||
Plot* plot) {
|
||||
// Contains a log timestamp to enable counting logged events of different
|
||||
// types using MovingAverage().
|
||||
class LogTime {
|
||||
public:
|
||||
explicit LogTime(int64_t log_time_us) : log_time_us_(log_time_us) {}
|
||||
|
||||
int64_t log_time_us() const { return log_time_us_; }
|
||||
|
||||
private:
|
||||
int64_t log_time_us_;
|
||||
};
|
||||
|
||||
std::vector<LogTime> packet_times;
|
||||
auto handle_rtp = [&](const LoggedRtpPacket& packet) {
|
||||
packet_times.emplace_back(packet.log_time_us());
|
||||
};
|
||||
RtcEventProcessor process;
|
||||
for (const auto& stream : parsed_log_.rtp_packets_by_ssrc(direction)) {
|
||||
process.AddEvents(stream.packet_view, handle_rtp);
|
||||
}
|
||||
if (direction == kIncomingPacket) {
|
||||
auto handle_incoming_rtcp = [&](const LoggedRtcpPacketIncoming& packet) {
|
||||
packet_times.emplace_back(packet.log_time_us());
|
||||
};
|
||||
process.AddEvents(parsed_log_.incoming_rtcp_packets(),
|
||||
handle_incoming_rtcp);
|
||||
} else {
|
||||
auto handle_outgoing_rtcp = [&](const LoggedRtcpPacketOutgoing& packet) {
|
||||
packet_times.emplace_back(packet.log_time_us());
|
||||
};
|
||||
process.AddEvents(parsed_log_.outgoing_rtcp_packets(),
|
||||
handle_outgoing_rtcp);
|
||||
}
|
||||
process.ProcessEventsInOrder();
|
||||
TimeSeries time_series(std::string("Total ") + "(" +
|
||||
GetDirectionAsShortString(direction) + ") packets",
|
||||
LineStyle::kLine);
|
||||
MovingAverage<LogTime, uint64_t>([](auto packet) { return 1; }, packet_times,
|
||||
config_, &time_series);
|
||||
plot->AppendTimeSeries(std::move(time_series));
|
||||
|
||||
plot->SetXAxis(config_.CallBeginTimeSec(), config_.CallEndTimeSec(),
|
||||
"Time (s)", kLeftMargin, kRightMargin);
|
||||
plot->SetSuggestedYAxis(0, 1, "Packet Rate (packets/s)", kBottomMargin,
|
||||
kTopMargin);
|
||||
plot->SetTitle("Rate of all " + GetDirectionAsString(direction) +
|
||||
" RTP/RTCP packets");
|
||||
}
|
||||
|
||||
// For each SSRC, plot the time between the consecutive playouts.
|
||||
void EventLogAnalyzer::CreatePlayoutGraph(Plot* plot) {
|
||||
for (const auto& playout_stream : parsed_log_.audio_playout_events()) {
|
||||
|
@ -65,6 +65,8 @@ class EventLogAnalyzer {
|
||||
|
||||
void CreatePacketRateGraph(PacketDirection direction, Plot* plot);
|
||||
|
||||
void CreateTotalPacketRateGraph(PacketDirection direction, Plot* plot);
|
||||
|
||||
void CreatePlayoutGraph(Plot* plot);
|
||||
|
||||
void CreateAudioLevelGraph(PacketDirection direction, Plot* plot);
|
||||
|
@ -297,6 +297,12 @@ int main(int argc, char* argv[]) {
|
||||
plots.RegisterPlot("outgoing_packet_rate", [&](Plot* plot) {
|
||||
analyzer.CreatePacketRateGraph(webrtc::kOutgoingPacket, plot);
|
||||
});
|
||||
plots.RegisterPlot("total_incoming_packet_rate", [&](Plot* plot) {
|
||||
analyzer.CreateTotalPacketRateGraph(webrtc::kIncomingPacket, plot);
|
||||
});
|
||||
plots.RegisterPlot("total_outgoing_packet_rate", [&](Plot* plot) {
|
||||
analyzer.CreateTotalPacketRateGraph(webrtc::kOutgoingPacket, plot);
|
||||
});
|
||||
plots.RegisterPlot("audio_playout",
|
||||
[&](Plot* plot) { analyzer.CreatePlayoutGraph(plot); });
|
||||
plots.RegisterPlot("incoming_audio_level", [&](Plot* plot) {
|
||||
|
Reference in New Issue
Block a user