Revert "Create new API for RtcEventLogParser."

This reverts commit 9e336ec0b8a77c3461d13677cff3563c11c88daa.

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}
This commit is contained in:
Björn Terelius
2018-04-25 14:23:01 +00:00
committed by Commit Bot
parent 65fb4049c1
commit ff61273c01
23 changed files with 1422 additions and 3279 deletions

View File

@ -253,8 +253,8 @@ if (rtc_enable_protobuf) {
rtc_static_library("rtc_event_log_parser") {
sources = [
"rtc_event_log/rtc_event_log_parser2.cc",
"rtc_event_log/rtc_event_log_parser2.h",
"rtc_event_log/rtc_event_log_parser.cc",
"rtc_event_log/rtc_event_log_parser.h",
]
deps = [
@ -265,7 +265,6 @@ if (rtc_enable_protobuf) {
":rtc_event_log_proto",
":rtc_stream_config",
"..:webrtc_common",
"../api:libjingle_peerconnection_api",
"../call:video_stream_api",
"../modules/audio_coding:audio_network_adaptor",
"../modules/remote_bitrate_estimator:remote_bitrate_estimator",
@ -366,7 +365,6 @@ if (rtc_enable_protobuf) {
"../rtc_base:checks",
"../rtc_base:protobuf_utils",
"../rtc_base:rtc_base_approved",
"../rtc_base:stringutils",
# TODO(kwiberg): Remove this dependency.
"../api/audio_codecs:audio_codecs_api",

View File

@ -32,7 +32,7 @@
#include "logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h"
#include "logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h"
#include "logging/rtc_event_log/events/rtc_event_video_send_stream_config.h"
#include "logging/rtc_event_log/rtc_event_log_parser2.h"
#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor_config.h"
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
#include "modules/rtp_rtcp/source/rtcp_packet/bye.h" // Arbitrary RTCP message.
@ -142,11 +142,11 @@ void RtcEventLogEncoderTest::TestRtcEventAudioNetworkAdaptation(
ASSERT_EQ(parsed_log_.GetEventType(0),
ParsedRtcEventLog::AUDIO_NETWORK_ADAPTATION_EVENT);
LoggedAudioNetworkAdaptationEvent parsed_event =
parsed_log_.GetAudioNetworkAdaptation(0);
AudioEncoderRuntimeConfig parsed_runtime_config;
parsed_log_.GetAudioNetworkAdaptation(0, &parsed_runtime_config);
EXPECT_EQ(parsed_event.timestamp_us, timestamp_us);
EXPECT_EQ(parsed_event.config, original_runtime_config);
EXPECT_EQ(parsed_log_.GetTimestamp(0), timestamp_us);
EXPECT_EQ(parsed_runtime_config, original_runtime_config);
}
TEST_P(RtcEventLogEncoderTest, RtcEventAudioNetworkAdaptationBitrate) {
@ -234,10 +234,11 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioPlayout) {
ASSERT_EQ(parsed_log_.GetEventType(0),
ParsedRtcEventLog::AUDIO_PLAYOUT_EVENT);
LoggedAudioPlayoutEvent playout_event = parsed_log_.GetAudioPlayout(0);
uint32_t parsed_ssrc;
parsed_log_.GetAudioPlayout(0, &parsed_ssrc);
EXPECT_EQ(playout_event.timestamp_us, timestamp_us);
EXPECT_EQ(playout_event.ssrc, ssrc);
EXPECT_EQ(parsed_log_.GetTimestamp(0), timestamp_us);
EXPECT_EQ(parsed_ssrc, ssrc);
}
TEST_P(RtcEventLogEncoderTest, RtcEventAudioReceiveStreamConfig) {
@ -332,12 +333,16 @@ TEST_P(RtcEventLogEncoderTest, RtcEventBweUpdateLossBased) {
ASSERT_EQ(parsed_log_.GetEventType(0),
ParsedRtcEventLog::LOSS_BASED_BWE_UPDATE);
LoggedBweLossBasedUpdate bwe_update = parsed_log_.GetLossBasedBweUpdate(0);
int32_t parsed_bitrate_bps;
uint8_t parsed_fraction_loss;
int32_t parsed_total_packets;
parsed_log_.GetLossBasedBweUpdate(
0, &parsed_bitrate_bps, &parsed_fraction_loss, &parsed_total_packets);
EXPECT_EQ(bwe_update.timestamp_us, timestamp_us);
EXPECT_EQ(bwe_update.bitrate_bps, bitrate_bps);
EXPECT_EQ(bwe_update.fraction_lost, fraction_loss);
EXPECT_EQ(bwe_update.expected_packets, total_packets);
EXPECT_EQ(parsed_log_.GetTimestamp(0), timestamp_us);
EXPECT_EQ(parsed_bitrate_bps, bitrate_bps);
EXPECT_EQ(parsed_fraction_loss, fraction_loss);
EXPECT_EQ(parsed_total_packets, total_packets);
}
TEST_P(RtcEventLogEncoderTest, RtcEventLoggingStarted) {

View File

@ -21,7 +21,6 @@
namespace webrtc {
// TODO(terelius): Move this to the parser.
enum PacketDirection { kIncomingPacket = 0, kOutgoingPacket };
class RtcEventLog {

View File

@ -16,7 +16,7 @@
#include <string>
#include "logging/rtc_event_log/rtc_event_log.h"
#include "logging/rtc_event_log/rtc_event_log_parser2.h"
#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "modules/rtp_rtcp/source/byte_io.h"
#include "modules/rtp_rtcp/source/rtp_utility.h"
#include "rtc_base/checks.h"

View File

@ -13,12 +13,13 @@
#include <iomanip> // setfill, setw
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <utility> // pair
#include "call/video_config.h"
#include "common_types.h" // NOLINT(build/include)
#include "logging/rtc_event_log/rtc_event_log_parser2.h"
#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor_config.h"
#include "modules/rtp_rtcp/source/rtcp_packet/bye.h"
#include "modules/rtp_rtcp/source/rtcp_packet/common_header.h"
@ -39,7 +40,6 @@
#include "rtc_base/checks.h"
#include "rtc_base/flags.h"
#include "rtc_base/logging.h"
#include "rtc_base/strings/string_builder.h"
namespace {
@ -443,7 +443,7 @@ int main(int argc, char* argv[]) {
size_t total_length;
uint8_t header[IP_PACKET_SIZE];
webrtc::PacketDirection direction;
const webrtc::RtpHeaderExtensionMap* extension_map =
webrtc::RtpHeaderExtensionMap* extension_map =
parsed_stream.GetRtpHeader(i, &direction, header, &header_length,
&total_length, nullptr);
@ -583,9 +583,10 @@ int main(int argc, char* argv[]) {
case webrtc::ParsedRtcEventLog::AUDIO_PLAYOUT_EVENT: {
if (FLAG_playout) {
auto audio_playout = parsed_stream.GetAudioPlayout(i);
std::cout << audio_playout.log_time_us() << "\tAUDIO_PLAYOUT"
<< "\tssrc=" << audio_playout.ssrc << std::endl;
uint32_t ssrc;
parsed_stream.GetAudioPlayout(i, &ssrc);
std::cout << parsed_stream.GetTimestamp(i) << "\tAUDIO_PLAYOUT"
<< "\tssrc=" << ssrc << std::endl;
}
event_recognized = true;
break;
@ -593,13 +594,15 @@ int main(int argc, char* argv[]) {
case webrtc::ParsedRtcEventLog::LOSS_BASED_BWE_UPDATE: {
if (FLAG_bwe) {
auto bwe_update = parsed_stream.GetLossBasedBweUpdate(i);
std::cout << bwe_update.log_time_us() << "\tBWE(LOSS_BASED)"
<< "\tbitrate_bps=" << bwe_update.bitrate_bps
<< "\tfraction_lost="
<< static_cast<unsigned>(bwe_update.fraction_lost)
<< "\texpected_packets=" << bwe_update.expected_packets
<< std::endl;
int32_t bitrate_bps;
uint8_t fraction_loss;
int32_t total_packets;
parsed_stream.GetLossBasedBweUpdate(i, &bitrate_bps, &fraction_loss,
&total_packets);
std::cout << parsed_stream.GetTimestamp(i) << "\tBWE(LOSS_BASED)"
<< "\tbitrate_bps=" << bitrate_bps << "\tfraction_loss="
<< static_cast<unsigned>(fraction_loss)
<< "\ttotal_packets=" << total_packets << std::endl;
}
event_recognized = true;
break;
@ -608,7 +611,7 @@ int main(int argc, char* argv[]) {
case webrtc::ParsedRtcEventLog::DELAY_BASED_BWE_UPDATE: {
if (FLAG_bwe) {
auto bwe_update = parsed_stream.GetDelayBasedBweUpdate(i);
std::cout << bwe_update.log_time_us() << "\tBWE(DELAY_BASED)"
std::cout << parsed_stream.GetTimestamp(i) << "\tBWE(DELAY_BASED)"
<< "\tbitrate_bps=" << bwe_update.bitrate_bps
<< "\tdetector_state="
<< static_cast<int>(bwe_update.detector_state) << std::endl;
@ -720,31 +723,30 @@ int main(int argc, char* argv[]) {
case webrtc::ParsedRtcEventLog::AUDIO_NETWORK_ADAPTATION_EVENT: {
if (FLAG_ana) {
auto ana_event = parsed_stream.GetAudioNetworkAdaptation(i);
char buffer[300];
rtc::SimpleStringBuilder builder(buffer);
builder << parsed_stream.GetTimestamp(i) << "\tANA_UPDATE";
if (ana_event.config.bitrate_bps) {
builder << "\tbitrate_bps=" << *ana_event.config.bitrate_bps;
webrtc::AudioEncoderRuntimeConfig ana_config;
parsed_stream.GetAudioNetworkAdaptation(i, &ana_config);
std::stringstream ss;
ss << parsed_stream.GetTimestamp(i) << "\tANA_UPDATE";
if (ana_config.bitrate_bps) {
ss << "\tbitrate_bps=" << *ana_config.bitrate_bps;
}
if (ana_event.config.frame_length_ms) {
builder << "\tframe_length_ms="
<< *ana_event.config.frame_length_ms;
if (ana_config.frame_length_ms) {
ss << "\tframe_length_ms=" << *ana_config.frame_length_ms;
}
if (ana_event.config.uplink_packet_loss_fraction) {
builder << "\tuplink_packet_loss_fraction="
<< *ana_event.config.uplink_packet_loss_fraction;
if (ana_config.uplink_packet_loss_fraction) {
ss << "\tuplink_packet_loss_fraction="
<< *ana_config.uplink_packet_loss_fraction;
}
if (ana_event.config.enable_fec) {
builder << "\tenable_fec=" << *ana_event.config.enable_fec;
if (ana_config.enable_fec) {
ss << "\tenable_fec=" << *ana_config.enable_fec;
}
if (ana_event.config.enable_dtx) {
builder << "\tenable_dtx=" << *ana_event.config.enable_dtx;
if (ana_config.enable_dtx) {
ss << "\tenable_dtx=" << *ana_config.enable_dtx;
}
if (ana_event.config.num_channels) {
builder << "\tnum_channels=" << *ana_event.config.num_channels;
if (ana_config.num_channels) {
ss << "\tnum_channels=" << *ana_config.num_channels;
}
std::cout << builder.str() << std::endl;
std::cout << ss.str() << std::endl;
}
event_recognized = true;
break;
@ -752,7 +754,8 @@ int main(int argc, char* argv[]) {
case webrtc::ParsedRtcEventLog::BWE_PROBE_CLUSTER_CREATED_EVENT: {
if (FLAG_probe) {
auto probe_event = parsed_stream.GetBweProbeClusterCreated(i);
webrtc::ParsedRtcEventLog::BweProbeClusterCreatedEvent probe_event =
parsed_stream.GetBweProbeClusterCreated(i);
std::cout << parsed_stream.GetTimestamp(i) << "\tPROBE_CREATED("
<< probe_event.id << ")"
<< "\tbitrate_bps=" << probe_event.bitrate_bps
@ -765,7 +768,7 @@ int main(int argc, char* argv[]) {
case webrtc::ParsedRtcEventLog::BWE_PROBE_RESULT_EVENT: {
if (FLAG_probe) {
webrtc::LoggedBweProbeResultEvent probe_result =
webrtc::ParsedRtcEventLog::BweProbeResultEvent probe_result =
parsed_stream.GetBweProbeResult(i);
if (probe_result.failure_reason) {
std::cout << parsed_stream.GetTimestamp(i) << "\tPROBE_SUCCESS("
@ -786,7 +789,8 @@ int main(int argc, char* argv[]) {
case webrtc::ParsedRtcEventLog::ALR_STATE_EVENT: {
if (FLAG_bwe) {
webrtc::LoggedAlrStateEvent alr_state = parsed_stream.GetAlrState(i);
webrtc::ParsedRtcEventLog::AlrStateEvent alr_state =
parsed_stream.GetAlrState(i);
std::cout << parsed_stream.GetTimestamp(i) << "\tALR_STATE"
<< "\tin_alr=" << alr_state.in_alr << std::endl;
}
@ -796,7 +800,7 @@ int main(int argc, char* argv[]) {
case webrtc::ParsedRtcEventLog::ICE_CANDIDATE_PAIR_CONFIG: {
if (FLAG_ice) {
webrtc::LoggedIceCandidatePairConfig ice_cp_config =
webrtc::ParsedRtcEventLog::IceCandidatePairConfig ice_cp_config =
parsed_stream.GetIceCandidatePairConfig(i);
// TODO(qingsi): convert the numeric representation of states to text
std::cout << parsed_stream.GetTimestamp(i)
@ -810,7 +814,7 @@ int main(int argc, char* argv[]) {
case webrtc::ParsedRtcEventLog::ICE_CANDIDATE_PAIR_EVENT: {
if (FLAG_ice) {
webrtc::LoggedIceCandidatePairEvent ice_cp_event =
webrtc::ParsedRtcEventLog::IceCandidatePairEvent ice_cp_event =
parsed_stream.GetIceCandidatePairEvent(i);
// TODO(qingsi): convert the numeric representation of states to text
std::cout << parsed_stream.GetTimestamp(i)

File diff suppressed because it is too large Load Diff

View File

@ -1,920 +0,0 @@
/*
* 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.
*/
#ifndef LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_PARSER2_H_
#define LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_PARSER2_H_
#include <iterator>
#include <map>
#include <set>
#include <string>
#include <utility> // pair
#include <vector>
#include "call/video_receive_stream.h"
#include "call/video_send_stream.h"
#include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h"
#include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h"
#include "logging/rtc_event_log/events/rtc_event_probe_result_failure.h"
#include "logging/rtc_event_log/rtc_event_log.h"
#include "logging/rtc_event_log/rtc_stream_config.h"
#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h"
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
#include "modules/rtp_rtcp/source/rtcp_packet/common_header.h"
#include "modules/rtp_rtcp/source/rtcp_packet/nack.h"
#include "modules/rtp_rtcp/source/rtcp_packet/receiver_report.h"
#include "modules/rtp_rtcp/source/rtcp_packet/remb.h"
#include "modules/rtp_rtcp/source/rtcp_packet/sender_report.h"
#include "modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
#include "rtc_base/ignore_wundef.h"
// Files generated at build-time by the protobuf compiler.
RTC_PUSH_IGNORING_WUNDEF()
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/logging/rtc_event_log/rtc_event_log.pb.h"
#else
#include "logging/rtc_event_log/rtc_event_log.pb.h"
#endif
RTC_POP_IGNORING_WUNDEF()
namespace webrtc {
enum class BandwidthUsage;
struct AudioEncoderRuntimeConfig;
struct LoggedAlrStateEvent {
int64_t timestamp_us;
bool in_alr;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedAudioPlayoutEvent {
int64_t timestamp_us;
uint32_t ssrc;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedAudioNetworkAdaptationEvent {
int64_t timestamp_us;
AudioEncoderRuntimeConfig config;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedBweDelayBasedUpdate {
int64_t timestamp_us;
int32_t bitrate_bps;
BandwidthUsage detector_state;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedBweLossBasedUpdate {
int64_t timestamp_us;
int32_t bitrate_bps;
uint8_t fraction_lost;
int32_t expected_packets;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedBweProbeClusterCreatedEvent {
int64_t timestamp_us;
uint32_t id;
uint64_t bitrate_bps;
uint32_t min_packets;
uint32_t min_bytes;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedBweProbeResultEvent {
int64_t timestamp_us;
uint32_t id;
rtc::Optional<uint64_t> bitrate_bps;
rtc::Optional<ProbeFailureReason> failure_reason;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedIceCandidatePairConfig {
int64_t timestamp_us;
IceCandidatePairEventType type;
uint32_t candidate_pair_id;
IceCandidateType local_candidate_type;
IceCandidatePairProtocol local_relay_protocol;
IceCandidateNetworkType local_network_type;
IceCandidatePairAddressFamily local_address_family;
IceCandidateType remote_candidate_type;
IceCandidatePairAddressFamily remote_address_family;
IceCandidatePairProtocol candidate_pair_protocol;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedIceCandidatePairEvent {
int64_t timestamp_us;
IceCandidatePairEventType type;
uint32_t candidate_pair_id;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedRtpPacket {
LoggedRtpPacket(uint64_t timestamp_us,
RTPHeader header,
size_t header_length,
size_t total_length)
: timestamp_us(timestamp_us),
header(header),
header_length(header_length),
total_length(total_length) {}
int64_t timestamp_us;
// TODO(terelius): This allocates space for 15 CSRCs even if none are used.
RTPHeader header;
size_t header_length;
size_t total_length;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedRtpPacketIncoming {
LoggedRtpPacketIncoming(uint64_t timestamp_us,
RTPHeader header,
size_t header_length,
size_t total_length)
: rtp(timestamp_us, header, header_length, total_length) {}
LoggedRtpPacket rtp;
int64_t log_time_us() const { return rtp.timestamp_us; }
int64_t log_time_ms() const { return rtp.timestamp_us / 1000; }
};
struct LoggedRtpPacketOutgoing {
LoggedRtpPacketOutgoing(uint64_t timestamp_us,
RTPHeader header,
size_t header_length,
size_t total_length)
: rtp(timestamp_us, header, header_length, total_length) {}
LoggedRtpPacket rtp;
int64_t log_time_us() const { return rtp.timestamp_us; }
int64_t log_time_ms() const { return rtp.timestamp_us / 1000; }
};
struct LoggedRtcpPacket {
LoggedRtcpPacket(uint64_t timestamp_us,
const uint8_t* packet,
size_t total_length)
: timestamp_us(timestamp_us), raw_data(packet, packet + total_length) {}
int64_t timestamp_us;
std::vector<uint8_t> raw_data;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedRtcpPacketIncoming {
LoggedRtcpPacketIncoming(uint64_t timestamp_us,
const uint8_t* packet,
size_t total_length)
: rtcp(timestamp_us, packet, total_length) {}
LoggedRtcpPacket rtcp;
int64_t log_time_us() const { return rtcp.timestamp_us; }
int64_t log_time_ms() const { return rtcp.timestamp_us / 1000; }
};
struct LoggedRtcpPacketOutgoing {
LoggedRtcpPacketOutgoing(uint64_t timestamp_us,
const uint8_t* packet,
size_t total_length)
: rtcp(timestamp_us, packet, total_length) {}
LoggedRtcpPacket rtcp;
int64_t log_time_us() const { return rtcp.timestamp_us; }
int64_t log_time_ms() const { return rtcp.timestamp_us / 1000; }
};
struct LoggedRtcpPacketReceiverReport {
int64_t timestamp_us;
rtcp::ReceiverReport rr;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedRtcpPacketSenderReport {
int64_t timestamp_us;
rtcp::SenderReport sr;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedRtcpPacketRemb {
int64_t timestamp_us;
rtcp::Remb remb;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedRtcpPacketNack {
int64_t timestamp_us;
rtcp::Nack nack;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedRtcpPacketTransportFeedback {
int64_t timestamp_us;
rtcp::TransportFeedback transport_feedback;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedStartEvent {
explicit LoggedStartEvent(uint64_t timestamp_us)
: timestamp_us(timestamp_us) {}
int64_t timestamp_us;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedStopEvent {
explicit LoggedStopEvent(uint64_t timestamp_us)
: timestamp_us(timestamp_us) {}
int64_t timestamp_us;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedAudioRecvConfig {
LoggedAudioRecvConfig(int64_t timestamp_us, const rtclog::StreamConfig config)
: timestamp_us(timestamp_us), config(config) {}
int64_t timestamp_us;
rtclog::StreamConfig config;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedAudioSendConfig {
LoggedAudioSendConfig(int64_t timestamp_us, const rtclog::StreamConfig config)
: timestamp_us(timestamp_us), config(config) {}
int64_t timestamp_us;
rtclog::StreamConfig config;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedVideoRecvConfig {
LoggedVideoRecvConfig(int64_t timestamp_us, const rtclog::StreamConfig config)
: timestamp_us(timestamp_us), config(config) {}
int64_t timestamp_us;
rtclog::StreamConfig config;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
struct LoggedVideoSendConfig {
LoggedVideoSendConfig(int64_t timestamp_us,
const std::vector<rtclog::StreamConfig> configs)
: timestamp_us(timestamp_us), configs(configs) {}
int64_t timestamp_us;
std::vector<rtclog::StreamConfig> configs;
int64_t log_time_us() const { return timestamp_us; }
int64_t log_time_ms() const { return timestamp_us / 1000; }
};
template <typename T>
class PacketView;
template <typename T>
class PacketIterator {
friend class PacketView<T>;
public:
// Standard iterator traits.
using difference_type = std::ptrdiff_t;
using value_type = T;
using pointer = T*;
using reference = T&;
using iterator_category = std::bidirectional_iterator_tag;
// The default-contructed iterator is meaningless, but is required by the
// ForwardIterator concept.
PacketIterator() : ptr_(nullptr), element_size_(0) {}
PacketIterator(const PacketIterator& other)
: ptr_(other.ptr_), element_size_(other.element_size_) {}
PacketIterator(const PacketIterator&& other)
: ptr_(other.ptr_), element_size_(other.element_size_) {}
~PacketIterator() = default;
PacketIterator& operator=(const PacketIterator& other) {
ptr_ = other.ptr_;
element_size_ = other.element_size_;
return *this;
}
PacketIterator& operator=(const PacketIterator&& other) {
ptr_ = other.ptr_;
element_size_ = other.element_size_;
return *this;
}
bool operator==(const PacketIterator<T>& other) const {
RTC_DCHECK_EQ(element_size_, other.element_size_);
return ptr_ == other.ptr_;
}
bool operator!=(const PacketIterator<T>& other) const {
RTC_DCHECK_EQ(element_size_, other.element_size_);
return ptr_ != other.ptr_;
}
PacketIterator& operator++() {
ptr_ += element_size_;
return *this;
}
PacketIterator& operator--() {
ptr_ -= element_size_;
return *this;
}
PacketIterator operator++(int) {
PacketIterator iter_copy(ptr_, element_size_);
ptr_ += element_size_;
return iter_copy;
}
PacketIterator operator--(int) {
PacketIterator iter_copy(ptr_, element_size_);
ptr_ -= element_size_;
return iter_copy;
}
T& operator*() { return *reinterpret_cast<T*>(ptr_); }
const T& operator*() const { return *reinterpret_cast<const T*>(ptr_); }
private:
PacketIterator(typename std::conditional<std::is_const<T>::value,
const void*,
void*>::type p,
size_t s)
: ptr_(reinterpret_cast<decltype(ptr_)>(p)), element_size_(s) {}
typename std::conditional<std::is_const<T>::value, const char*, char*>::type
ptr_;
size_t element_size_;
};
// Suppose that we have a struct S where we are only interested in a specific
// member M. Given an array of S, PacketView can be used to treat the array
// as an array of M, without exposing the type S to surrounding code and without
// accessing the member through a virtual function. In this case, we want to
// have a common view for incoming and outgoing RtpPackets, hence the PacketView
// name.
// Note that constructing a PacketView bypasses the typesystem, so the caller
// has to take extra care when constructing these objects. The implementation
// also requires that the containing struct is standard-layout (e.g. POD).
//
// Usage example:
// struct A {...};
// struct B { A a; ...};
// struct C { A a; ...};
// size_t len = 10;
// B* array1 = new B[len];
// C* array2 = new C[len];
//
// PacketView<A> view1 = PacketView<A>::Create<B>(array1, len, offsetof(B, a));
// PacketView<A> view2 = PacketView<A>::Create<C>(array2, len, offsetof(C, a));
//
// The following code works with either view1 or view2.
// void f(PacketView<A> view)
// for (A& a : view) {
// DoSomething(a);
// }
template <typename T>
class PacketView {
public:
template <typename U>
static PacketView Create(U* ptr, size_t num_elements, size_t offset) {
static_assert(std::is_standard_layout<U>::value,
"PacketView can only be created for standard layout types.");
static_assert(std::is_standard_layout<T>::value,
"PacketView can only be created for standard layout types.");
return PacketView(ptr, num_elements, offset, sizeof(U));
}
using iterator = PacketIterator<T>;
using const_iterator = PacketIterator<const T>;
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
iterator begin() { return iterator(data_, element_size_); }
iterator end() {
auto end_ptr = data_ + num_elements_ * element_size_;
return iterator(end_ptr, element_size_);
}
const_iterator begin() const { return const_iterator(data_, element_size_); }
const_iterator end() const {
auto end_ptr = data_ + num_elements_ * element_size_;
return const_iterator(end_ptr, element_size_);
}
reverse_iterator rbegin() { return reverse_iterator(end()); }
reverse_iterator rend() { return reverse_iterator(begin()); }
const_reverse_iterator rbegin() const {
return const_reverse_iterator(end());
}
const_reverse_iterator rend() const {
return const_reverse_iterator(begin());
}
size_t size() const { return num_elements_; }
T& operator[](size_t i) {
auto elem_ptr = data_ + i * element_size_;
return *reinterpret_cast<T*>(elem_ptr);
}
const T& operator[](size_t i) const {
auto elem_ptr = data_ + i * element_size_;
return *reinterpret_cast<const T*>(elem_ptr);
}
private:
PacketView(typename std::conditional<std::is_const<T>::value,
const void*,
void*>::type data,
size_t num_elements,
size_t offset,
size_t element_size)
: data_(reinterpret_cast<decltype(data_)>(data) + offset),
num_elements_(num_elements),
element_size_(element_size) {}
typename std::conditional<std::is_const<T>::value, const char*, char*>::type
data_;
size_t num_elements_;
size_t element_size_;
};
class ParsedRtcEventLog {
friend class RtcEventLogTestHelper;
public:
enum EventType {
UNKNOWN_EVENT = 0,
LOG_START = 1,
LOG_END = 2,
RTP_EVENT = 3,
RTCP_EVENT = 4,
AUDIO_PLAYOUT_EVENT = 5,
LOSS_BASED_BWE_UPDATE = 6,
DELAY_BASED_BWE_UPDATE = 7,
VIDEO_RECEIVER_CONFIG_EVENT = 8,
VIDEO_SENDER_CONFIG_EVENT = 9,
AUDIO_RECEIVER_CONFIG_EVENT = 10,
AUDIO_SENDER_CONFIG_EVENT = 11,
AUDIO_NETWORK_ADAPTATION_EVENT = 16,
BWE_PROBE_CLUSTER_CREATED_EVENT = 17,
BWE_PROBE_RESULT_EVENT = 18,
ALR_STATE_EVENT = 19,
ICE_CANDIDATE_PAIR_CONFIG = 20,
ICE_CANDIDATE_PAIR_EVENT = 21,
};
enum class MediaType { ANY, AUDIO, VIDEO, DATA };
enum class UnconfiguredHeaderExtensions {
kDontParse,
kAttemptWebrtcDefaultConfig
};
explicit ParsedRtcEventLog(
UnconfiguredHeaderExtensions parse_unconfigured_header_extensions =
UnconfiguredHeaderExtensions::kDontParse);
// Clears previously parsed events and resets the ParsedRtcEventLog to an
// empty state.
void Clear();
// Reads an RtcEventLog file and returns true if parsing was successful.
bool ParseFile(const std::string& file_name);
// Reads an RtcEventLog from a string and returns true if successful.
bool ParseString(const std::string& s);
// Reads an RtcEventLog from an istream and returns true if successful.
bool ParseStream(
std::istream& stream); // no-presubmit-check TODO(webrtc:8982)
// Returns the number of events in an EventStream.
size_t GetNumberOfEvents() const;
// Reads the arrival timestamp (in microseconds) from a rtclog::Event.
int64_t GetTimestamp(size_t index) const;
int64_t GetTimestamp(const rtclog::Event& event) const;
// Reads the event type of the rtclog::Event at |index|.
EventType GetEventType(size_t index) const;
// Reads the header, direction, header length and packet length from the RTP
// event at |index|, and stores the values in the corresponding output
// parameters. Each output parameter can be set to nullptr if that value
// isn't needed.
// NB: The header must have space for at least IP_PACKET_SIZE bytes.
// Returns: a pointer to a header extensions map acquired from parsing
// corresponding Audio/Video Sender/Receiver config events.
// Warning: if the same SSRC is reused by both video and audio streams during
// call, extensions maps may be incorrect (the last one would be returned).
const webrtc::RtpHeaderExtensionMap* GetRtpHeader(
size_t index,
PacketDirection* incoming,
uint8_t* header,
size_t* header_length,
size_t* total_length,
int* probe_cluster_id) const;
const webrtc::RtpHeaderExtensionMap* GetRtpHeader(
const rtclog::Event& event,
PacketDirection* incoming,
uint8_t* header,
size_t* header_length,
size_t* total_length,
int* probe_cluster_id) const;
// Reads packet, direction and packet length from the RTCP event at |index|,
// and stores the values in the corresponding output parameters.
// Each output parameter can be set to nullptr if that value isn't needed.
// NB: The packet must have space for at least IP_PACKET_SIZE bytes.
void GetRtcpPacket(size_t index,
PacketDirection* incoming,
uint8_t* packet,
size_t* length) const;
void GetRtcpPacket(const rtclog::Event& event,
PacketDirection* incoming,
uint8_t* packet,
size_t* length) const;
// Reads a video receive config event to a StreamConfig struct.
// Only the fields that are stored in the protobuf will be written.
rtclog::StreamConfig GetVideoReceiveConfig(size_t index) const;
// Reads a video send config event to a StreamConfig struct. If the proto
// contains multiple SSRCs and RTX SSRCs (this used to be the case for
// simulcast streams) then we return one StreamConfig per SSRC,RTX_SSRC pair.
// Only the fields that are stored in the protobuf will be written.
std::vector<rtclog::StreamConfig> GetVideoSendConfig(size_t index) const;
// Reads a audio receive config event to a StreamConfig struct.
// Only the fields that are stored in the protobuf will be written.
rtclog::StreamConfig GetAudioReceiveConfig(size_t index) const;
// Reads a config event to a StreamConfig struct.
// Only the fields that are stored in the protobuf will be written.
rtclog::StreamConfig GetAudioSendConfig(size_t index) const;
// Reads the SSRC from the audio playout event at |index|. The SSRC is stored
// in the output parameter ssrc. The output parameter can be set to nullptr
// and in that case the function only asserts that the event is well formed.
LoggedAudioPlayoutEvent GetAudioPlayout(size_t index) const;
// Reads bitrate, fraction loss (as defined in RFC 1889) and total number of
// expected packets from the loss based BWE event at |index| and stores the
// values in
// the corresponding output parameters. Each output parameter can be set to
// nullptr if that
// value isn't needed.
LoggedBweLossBasedUpdate GetLossBasedBweUpdate(size_t index) const;
// Reads bitrate and detector_state from the delay based BWE event at |index|
// and stores the values in the corresponding output parameters. Each output
// parameter can be set to nullptr if that
// value isn't needed.
LoggedBweDelayBasedUpdate GetDelayBasedBweUpdate(size_t index) const;
// Reads a audio network adaptation event to a (non-NULL)
// AudioEncoderRuntimeConfig struct. Only the fields that are
// stored in the protobuf will be written.
LoggedAudioNetworkAdaptationEvent GetAudioNetworkAdaptation(
size_t index) const;
LoggedBweProbeClusterCreatedEvent GetBweProbeClusterCreated(
size_t index) const;
LoggedBweProbeResultEvent GetBweProbeResult(size_t index) const;
MediaType GetMediaType(uint32_t ssrc, PacketDirection direction) const;
LoggedAlrStateEvent GetAlrState(size_t index) const;
LoggedIceCandidatePairConfig GetIceCandidatePairConfig(size_t index) const;
LoggedIceCandidatePairEvent GetIceCandidatePairEvent(size_t index) const;
const std::set<uint32_t>& incoming_rtx_ssrcs() const {
return incoming_rtx_ssrcs_;
}
const std::set<uint32_t>& incoming_video_ssrcs() const {
return incoming_video_ssrcs_;
}
const std::set<uint32_t>& incoming_audio_ssrcs() const {
return incoming_audio_ssrcs_;
}
const std::set<uint32_t>& outgoing_rtx_ssrcs() const {
return outgoing_rtx_ssrcs_;
}
const std::set<uint32_t>& outgoing_video_ssrcs() const {
return outgoing_video_ssrcs_;
}
const std::set<uint32_t>& outgoing_audio_ssrcs() const {
return outgoing_audio_ssrcs_;
}
const std::vector<LoggedStartEvent>& start_log_events() const {
return start_log_events_;
}
const std::vector<LoggedStopEvent>& stop_log_events() const {
return stop_log_events_;
}
const std::map<uint32_t, std::vector<int64_t>>& audio_playout_events() const {
return audio_playout_events_;
}
const std::vector<LoggedAudioNetworkAdaptationEvent>&
audio_network_adaptation_events() const {
return audio_network_adaptation_events_;
}
const std::vector<LoggedBweProbeClusterCreatedEvent>&
bwe_probe_cluster_created_events() const {
return bwe_probe_cluster_created_events_;
}
const std::vector<LoggedBweProbeResultEvent>& bwe_probe_result_events()
const {
return bwe_probe_result_events_;
}
const std::vector<LoggedBweDelayBasedUpdate>& bwe_delay_updates() const {
return bwe_delay_updates_;
}
const std::vector<LoggedBweLossBasedUpdate>& bwe_loss_updates() const {
return bwe_loss_updates_;
}
const std::vector<LoggedAlrStateEvent>& alr_state_events() const {
return alr_state_events_;
}
const std::vector<LoggedIceCandidatePairConfig>& ice_candidate_pair_configs()
const {
return ice_candidate_pair_configs_;
}
const std::vector<LoggedIceCandidatePairEvent>& ice_candidate_pair_events()
const {
return ice_candidate_pair_events_;
}
struct LoggedRtpStreamIncoming {
uint32_t ssrc;
std::vector<LoggedRtpPacketIncoming> incoming_packets;
};
struct LoggedRtpStreamOutgoing {
uint32_t ssrc;
std::vector<LoggedRtpPacketOutgoing> outgoing_packets;
};
struct LoggedRtpStreamView {
LoggedRtpStreamView(uint32_t ssrc,
const LoggedRtpPacketIncoming* ptr,
size_t num_elements)
: ssrc(ssrc),
packet_view(PacketView<const LoggedRtpPacket>::Create(
ptr,
num_elements,
offsetof(LoggedRtpPacketIncoming, rtp))) {}
LoggedRtpStreamView(uint32_t ssrc,
const LoggedRtpPacketOutgoing* ptr,
size_t num_elements)
: ssrc(ssrc),
packet_view(PacketView<const LoggedRtpPacket>::Create(
ptr,
num_elements,
offsetof(LoggedRtpPacketOutgoing, rtp))) {}
uint32_t ssrc;
PacketView<const LoggedRtpPacket> packet_view;
};
const std::vector<LoggedRtpStreamIncoming>& incoming_rtp_packets_by_ssrc()
const {
return incoming_rtp_packets_by_ssrc_;
}
const std::vector<LoggedRtpStreamOutgoing>& outgoing_rtp_packets_by_ssrc()
const {
return outgoing_rtp_packets_by_ssrc_;
}
const std::vector<LoggedRtcpPacketIncoming>& incoming_rtcp_packets() const {
return incoming_rtcp_packets_;
}
const std::vector<LoggedRtcpPacketOutgoing>& outgoing_rtcp_packets() const {
return outgoing_rtcp_packets_;
}
const std::vector<LoggedRtpStreamView>& rtp_packets_by_ssrc(
PacketDirection direction) const {
if (direction == kIncomingPacket)
return incoming_rtp_packet_views_by_ssrc_;
else
return outgoing_rtp_packet_views_by_ssrc_;
}
const std::vector<LoggedRtcpPacketReceiverReport>& receiver_reports(
PacketDirection direction) const {
if (direction == kIncomingPacket) {
return incoming_rr_;
} else {
return outgoing_rr_;
}
}
const std::vector<LoggedRtcpPacketSenderReport>& sender_reports(
PacketDirection direction) const {
if (direction == kIncomingPacket) {
return incoming_sr_;
} else {
return outgoing_sr_;
}
}
const std::vector<LoggedRtcpPacketNack>& nacks(
PacketDirection direction) const {
if (direction == kIncomingPacket) {
return incoming_nack_;
} else {
return outgoing_nack_;
}
}
const std::vector<LoggedRtcpPacketRemb>& rembs(
PacketDirection direction) const {
if (direction == kIncomingPacket) {
return incoming_remb_;
} else {
return outgoing_remb_;
}
}
const std::vector<LoggedRtcpPacketTransportFeedback>& transport_feedbacks(
PacketDirection direction) const {
if (direction == kIncomingPacket) {
return incoming_transport_feedback_;
} else {
return outgoing_transport_feedback_;
}
}
int64_t first_timestamp() const { return first_timestamp_; }
int64_t last_timestamp() const { return last_timestamp_; }
private:
void StoreParsedEvent(const rtclog::Event& event);
rtclog::StreamConfig GetVideoReceiveConfig(const rtclog::Event& event) const;
std::vector<rtclog::StreamConfig> GetVideoSendConfig(
const rtclog::Event& event) const;
rtclog::StreamConfig GetAudioReceiveConfig(const rtclog::Event& event) const;
rtclog::StreamConfig GetAudioSendConfig(const rtclog::Event& event) const;
LoggedAudioPlayoutEvent GetAudioPlayout(const rtclog::Event& event) const;
LoggedBweLossBasedUpdate GetLossBasedBweUpdate(
const rtclog::Event& event) const;
LoggedBweDelayBasedUpdate GetDelayBasedBweUpdate(
const rtclog::Event& event) const;
LoggedAudioNetworkAdaptationEvent GetAudioNetworkAdaptation(
const rtclog::Event& event) const;
LoggedBweProbeClusterCreatedEvent GetBweProbeClusterCreated(
const rtclog::Event& event) const;
LoggedBweProbeResultEvent GetBweProbeResult(const rtclog::Event& event) const;
LoggedAlrStateEvent GetAlrState(const rtclog::Event& event) const;
LoggedIceCandidatePairConfig GetIceCandidatePairConfig(
const rtclog::Event& event) const;
LoggedIceCandidatePairEvent GetIceCandidatePairEvent(
const rtclog::Event& event) const;
std::vector<rtclog::Event> events_;
struct Stream {
Stream(uint32_t ssrc,
MediaType media_type,
PacketDirection direction,
webrtc::RtpHeaderExtensionMap map)
: ssrc(ssrc),
media_type(media_type),
direction(direction),
rtp_extensions_map(map) {}
uint32_t ssrc;
MediaType media_type;
PacketDirection direction;
webrtc::RtpHeaderExtensionMap rtp_extensions_map;
};
const UnconfiguredHeaderExtensions parse_unconfigured_header_extensions_;
// Make a default extension map for streams without configuration information.
// TODO(ivoc): Once configuration of audio streams is stored in the event log,
// this can be removed. Tracking bug: webrtc:6399
RtpHeaderExtensionMap default_extension_map_;
// Tracks what each stream is configured for. Note that a single SSRC can be
// in several sets. For example, the SSRC used for sending video over RTX
// will appear in both video_ssrcs_ and rtx_ssrcs_. In the unlikely case that
// an SSRC is reconfigured to a different media type mid-call, it will also
// appear in multiple sets.
std::set<uint32_t> incoming_rtx_ssrcs_;
std::set<uint32_t> incoming_video_ssrcs_;
std::set<uint32_t> incoming_audio_ssrcs_;
std::set<uint32_t> outgoing_rtx_ssrcs_;
std::set<uint32_t> outgoing_video_ssrcs_;
std::set<uint32_t> outgoing_audio_ssrcs_;
// Maps an SSRC to the parsed RTP headers in that stream. Header extensions
// are parsed if the stream has been configured. This is only used for
// grouping the events by SSRC during parsing; the events are moved to
// incoming_rtp_packets_by_ssrc_ once the parsing is done.
std::map<uint32_t, std::vector<LoggedRtpPacketIncoming>>
incoming_rtp_packets_map_;
std::map<uint32_t, std::vector<LoggedRtpPacketOutgoing>>
outgoing_rtp_packets_map_;
// RTP headers.
std::vector<LoggedRtpStreamIncoming> incoming_rtp_packets_by_ssrc_;
std::vector<LoggedRtpStreamOutgoing> outgoing_rtp_packets_by_ssrc_;
std::vector<LoggedRtpStreamView> incoming_rtp_packet_views_by_ssrc_;
std::vector<LoggedRtpStreamView> outgoing_rtp_packet_views_by_ssrc_;
// Raw RTCP packets.
std::vector<LoggedRtcpPacketIncoming> incoming_rtcp_packets_;
std::vector<LoggedRtcpPacketOutgoing> outgoing_rtcp_packets_;
// Parsed RTCP messages. Currently not separated based on SSRC.
std::vector<LoggedRtcpPacketReceiverReport> incoming_rr_;
std::vector<LoggedRtcpPacketReceiverReport> outgoing_rr_;
std::vector<LoggedRtcpPacketSenderReport> incoming_sr_;
std::vector<LoggedRtcpPacketSenderReport> outgoing_sr_;
std::vector<LoggedRtcpPacketNack> incoming_nack_;
std::vector<LoggedRtcpPacketNack> outgoing_nack_;
std::vector<LoggedRtcpPacketRemb> incoming_remb_;
std::vector<LoggedRtcpPacketRemb> outgoing_remb_;
std::vector<LoggedRtcpPacketTransportFeedback> incoming_transport_feedback_;
std::vector<LoggedRtcpPacketTransportFeedback> outgoing_transport_feedback_;
std::vector<LoggedStartEvent> start_log_events_;
std::vector<LoggedStopEvent> stop_log_events_;
// Maps an SSRC to the timestamps of parsed audio playout events.
std::map<uint32_t, std::vector<int64_t>> audio_playout_events_;
std::vector<LoggedAudioNetworkAdaptationEvent>
audio_network_adaptation_events_;
std::vector<LoggedBweProbeClusterCreatedEvent>
bwe_probe_cluster_created_events_;
std::vector<LoggedBweProbeResultEvent> bwe_probe_result_events_;
std::vector<LoggedBweDelayBasedUpdate> bwe_delay_updates_;
// A list of all updates from the send-side loss-based bandwidth estimator.
std::vector<LoggedBweLossBasedUpdate> bwe_loss_updates_;
std::vector<LoggedAlrStateEvent> alr_state_events_;
std::vector<LoggedIceCandidatePairConfig> ice_candidate_pair_configs_;
std::vector<LoggedIceCandidatePairEvent> ice_candidate_pair_events_;
std::vector<LoggedAudioRecvConfig> audio_recv_configs_;
std::vector<LoggedAudioSendConfig> audio_send_configs_;
std::vector<LoggedVideoRecvConfig> video_recv_configs_;
std::vector<LoggedVideoSendConfig> video_send_configs_;
uint8_t last_incoming_rtcp_packet_[IP_PACKET_SIZE];
uint8_t last_incoming_rtcp_packet_length_;
int64_t first_timestamp_;
int64_t last_timestamp_;
// The extension maps are mutable to allow us to insert the default
// configuration when parsing an RTP header for an unconfigured stream.
mutable std::map<uint32_t, webrtc::RtpHeaderExtensionMap>
incoming_rtp_extensions_maps_;
mutable std::map<uint32_t, webrtc::RtpHeaderExtensionMap>
outgoing_rtp_extensions_maps_;
};
} // namespace webrtc
#endif // LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_PARSER2_H_

View File

@ -34,7 +34,7 @@
#include "logging/rtc_event_log/events/rtc_event_video_send_stream_config.h"
#include "logging/rtc_event_log/output/rtc_event_log_output_file.h"
#include "logging/rtc_event_log/rtc_event_log.h"
#include "logging/rtc_event_log/rtc_event_log_parser2.h"
#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "logging/rtc_event_log/rtc_event_log_unittest_helper.h"
#include "logging/rtc_event_log/rtc_stream_config.h"
#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h"
@ -750,16 +750,17 @@ TEST(RtcEventLogTest, CircularBufferKeepsMostRecentEvents) {
for (size_t i = 1; i < parsed_log.GetNumberOfEvents() - 1; i++) {
EXPECT_EQ(parsed_log.GetEventType(i),
ParsedRtcEventLog::EventType::AUDIO_PLAYOUT_EVENT);
LoggedAudioPlayoutEvent playout_event = parsed_log.GetAudioPlayout(i);
EXPECT_LT(playout_event.ssrc, kNumEvents);
EXPECT_EQ(static_cast<int64_t>(kStartTime + 10000 * playout_event.ssrc),
playout_event.timestamp_us);
uint32_t ssrc;
parsed_log.GetAudioPlayout(i, &ssrc);
int64_t timestamp = parsed_log.GetTimestamp(i);
EXPECT_LT(ssrc, kNumEvents);
EXPECT_EQ(static_cast<int64_t>(kStartTime + 10000 * ssrc), timestamp);
if (last_ssrc)
EXPECT_EQ(playout_event.ssrc, *last_ssrc + 1);
EXPECT_EQ(ssrc, *last_ssrc + 1);
if (last_timestamp)
EXPECT_EQ(playout_event.timestamp_us, *last_timestamp + 10000);
last_ssrc = playout_event.ssrc;
last_timestamp = playout_event.timestamp_us;
EXPECT_EQ(timestamp, *last_timestamp + 10000);
last_ssrc = ssrc;
last_timestamp = timestamp;
}
RtcEventLogTestHelper::VerifyLogEndEvent(parsed_log,
parsed_log.GetNumberOfEvents() - 1);

View File

@ -460,8 +460,9 @@ void RtcEventLogTestHelper::VerifyPlayoutEvent(
EXPECT_EQ(ssrc, playout_event.local_ssrc());
// Check consistency of the parser.
LoggedAudioPlayoutEvent parsed_event = parsed_log.GetAudioPlayout(index);
EXPECT_EQ(ssrc, parsed_event.ssrc);
uint32_t parsed_ssrc;
parsed_log.GetAudioPlayout(index, &parsed_ssrc);
EXPECT_EQ(ssrc, parsed_ssrc);
}
void RtcEventLogTestHelper::VerifyBweLossEvent(
@ -483,10 +484,14 @@ void RtcEventLogTestHelper::VerifyBweLossEvent(
EXPECT_EQ(total_packets, bwe_event.total_packets());
// Check consistency of the parser.
LoggedBweLossBasedUpdate bwe_update = parsed_log.GetLossBasedBweUpdate(index);
EXPECT_EQ(bitrate, bwe_update.bitrate_bps);
EXPECT_EQ(fraction_loss, bwe_update.fraction_lost);
EXPECT_EQ(total_packets, bwe_update.expected_packets);
int32_t parsed_bitrate;
uint8_t parsed_fraction_loss;
int32_t parsed_total_packets;
parsed_log.GetLossBasedBweUpdate(
index, &parsed_bitrate, &parsed_fraction_loss, &parsed_total_packets);
EXPECT_EQ(bitrate, parsed_bitrate);
EXPECT_EQ(fraction_loss, parsed_fraction_loss);
EXPECT_EQ(total_packets, parsed_total_packets);
}
void RtcEventLogTestHelper::VerifyBweDelayEvent(
@ -506,7 +511,8 @@ void RtcEventLogTestHelper::VerifyBweDelayEvent(
GetRuntimeDetectorState(bwe_event.detector_state()));
// Check consistency of the parser.
LoggedBweDelayBasedUpdate res = parsed_log.GetDelayBasedBweUpdate(index);
ParsedRtcEventLog::BweDelayBasedUpdate res =
parsed_log.GetDelayBasedBweUpdate(index);
EXPECT_EQ(res.bitrate_bps, bitrate);
EXPECT_EQ(res.detector_state, detector_state);
}
@ -515,20 +521,15 @@ void RtcEventLogTestHelper::VerifyAudioNetworkAdaptation(
const ParsedRtcEventLog& parsed_log,
size_t index,
const AudioEncoderRuntimeConfig& config) {
ASSERT_LT(index, parsed_log.events_.size());
const rtclog::Event& event = parsed_log.events_[index];
ASSERT_TRUE(IsValidBasicEvent(event));
ASSERT_EQ(rtclog::Event::AUDIO_NETWORK_ADAPTATION_EVENT, event.type());
LoggedAudioNetworkAdaptationEvent parsed_event =
parsed_log.GetAudioNetworkAdaptation(index);
EXPECT_EQ(config.bitrate_bps, parsed_event.config.bitrate_bps);
EXPECT_EQ(config.enable_dtx, parsed_event.config.enable_dtx);
EXPECT_EQ(config.enable_fec, parsed_event.config.enable_fec);
EXPECT_EQ(config.frame_length_ms, parsed_event.config.frame_length_ms);
EXPECT_EQ(config.num_channels, parsed_event.config.num_channels);
AudioEncoderRuntimeConfig parsed_config;
parsed_log.GetAudioNetworkAdaptation(index, &parsed_config);
EXPECT_EQ(config.bitrate_bps, parsed_config.bitrate_bps);
EXPECT_EQ(config.enable_dtx, parsed_config.enable_dtx);
EXPECT_EQ(config.enable_fec, parsed_config.enable_fec);
EXPECT_EQ(config.frame_length_ms, parsed_config.frame_length_ms);
EXPECT_EQ(config.num_channels, parsed_config.num_channels);
EXPECT_EQ(config.uplink_packet_loss_fraction,
parsed_event.config.uplink_packet_loss_fraction);
parsed_config.uplink_packet_loss_fraction);
}
void RtcEventLogTestHelper::VerifyLogStartEvent(

View File

@ -12,7 +12,7 @@
#define LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_UNITTEST_HELPER_H_
#include "call/call.h"
#include "logging/rtc_event_log/rtc_event_log_parser2.h"
#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"

View File

@ -66,7 +66,7 @@ std::unique_ptr<Packet> RtcEventLogSource::NextPacket() {
}
if (parsed_stream_.GetMediaType(packet->header().ssrc, direction) !=
ParsedRtcEventLog::MediaType::AUDIO) {
webrtc::ParsedRtcEventLog::MediaType::AUDIO) {
continue;
}
@ -85,10 +85,12 @@ int64_t RtcEventLogSource::NextAudioOutputEventMs() {
while (audio_output_index_ < parsed_stream_.GetNumberOfEvents()) {
if (parsed_stream_.GetEventType(audio_output_index_) ==
ParsedRtcEventLog::AUDIO_PLAYOUT_EVENT) {
LoggedAudioPlayoutEvent playout_event =
parsed_stream_.GetAudioPlayout(audio_output_index_);
uint64_t timestamp_us = parsed_stream_.GetTimestamp(audio_output_index_);
// We call GetAudioPlayout only to check that the protobuf event is
// well-formed.
parsed_stream_.GetAudioPlayout(audio_output_index_, nullptr);
audio_output_index_++;
return playout_event.timestamp_us / 1000;
return timestamp_us / 1000;
}
audio_output_index_++;
}

View File

@ -14,7 +14,7 @@
#include <memory>
#include <string>
#include "logging/rtc_event_log/rtc_event_log_parser2.h"
#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "modules/audio_coding/neteq/tools/packet_source.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "rtc_base/constructormagic.h"

View File

@ -237,7 +237,6 @@ if (!build_with_chromium) {
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"../rtc_base:rtc_numerics",
"../rtc_base:stringutils",
# TODO(kwiberg): Remove this dependency.
"../api/audio_codecs:audio_codecs_api",

File diff suppressed because it is too large Load Diff

View File

@ -18,12 +18,54 @@
#include <utility>
#include <vector>
#include "logging/rtc_event_log/rtc_event_log_parser2.h"
#include "rtc_base/strings/string_builder.h"
#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/rtcp_packet.h"
#include "rtc_base/function_view.h"
#include "rtc_tools/event_log_visualizer/plot_base.h"
#include "rtc_tools/event_log_visualizer/triage_notifications.h"
namespace webrtc {
namespace plotting {
struct LoggedRtpPacket {
LoggedRtpPacket(uint64_t timestamp,
RTPHeader header,
size_t header_length,
size_t total_length)
: timestamp(timestamp),
header(header),
header_length(header_length),
total_length(total_length) {}
uint64_t timestamp;
// TODO(terelius): This allocates space for 15 CSRCs even if none are used.
RTPHeader header;
size_t header_length;
size_t total_length;
};
struct LoggedRtcpPacket {
LoggedRtcpPacket(uint64_t timestamp,
RTCPPacketType rtcp_type,
std::unique_ptr<rtcp::RtcpPacket> rtcp_packet)
: timestamp(timestamp), type(rtcp_type), packet(std::move(rtcp_packet)) {}
uint64_t timestamp;
RTCPPacketType type;
std::unique_ptr<rtcp::RtcpPacket> packet;
};
struct LossBasedBweUpdate {
uint64_t timestamp;
int32_t new_bitrate;
uint8_t fraction_loss;
int32_t expected_packets;
};
struct AudioNetworkAdaptationEvent {
uint64_t timestamp;
AudioEncoderRuntimeConfig config;
};
class EventLogAnalyzer {
public:
@ -32,13 +74,14 @@ class EventLogAnalyzer {
// modified while the EventLogAnalyzer is being used.
explicit EventLogAnalyzer(const ParsedRtcEventLog& log);
void CreatePacketGraph(PacketDirection direction, Plot* plot);
void CreatePacketGraph(PacketDirection desired_direction, Plot* plot);
void CreateAccumulatedPacketsGraph(PacketDirection direction, Plot* plot);
void CreateAccumulatedPacketsGraph(PacketDirection desired_direction,
Plot* plot);
void CreatePlayoutGraph(Plot* plot);
void CreateAudioLevelGraph(PacketDirection direction, Plot* plot);
void CreateAudioLevelGraph(Plot* plot);
void CreateSequenceNumberGraph(Plot* plot);
@ -49,20 +92,19 @@ class EventLogAnalyzer {
void CreateFractionLossGraph(Plot* plot);
void CreateTotalIncomingBitrateGraph(Plot* plot);
void CreateTotalOutgoingBitrateGraph(Plot* plot,
bool show_detector_state = false,
bool show_alr_state = false);
void CreateTotalBitrateGraph(PacketDirection desired_direction,
Plot* plot,
bool show_detector_state = false,
bool show_alr_state = false);
void CreateStreamBitrateGraph(PacketDirection direction, Plot* plot);
void CreateStreamBitrateGraph(PacketDirection desired_direction, Plot* plot);
void CreateSendSideBweSimulationGraph(Plot* plot);
void CreateReceiveSideBweSimulationGraph(Plot* plot);
void CreateNetworkDelayFeedbackGraph(Plot* plot);
void CreatePacerDelayGraph(Plot* plot);
void CreateTimestampGraph(PacketDirection direction, Plot* plot);
void CreateTimestampGraph(Plot* plot);
void CreateAudioEncoderTargetBitrateGraph(Plot* plot);
void CreateAudioEncoderFrameLengthGraph(Plot* plot);
@ -77,114 +119,55 @@ class EventLogAnalyzer {
void CreateIceCandidatePairConfigGraph(Plot* plot);
void CreateIceConnectivityCheckGraph(Plot* plot);
// Returns a vector of capture and arrival timestamps for the video frames
// of the stream with the most number of frames.
std::vector<std::pair<int64_t, int64_t>> GetFrameTimestamps() const;
void CreateTriageNotifications();
void PrintNotifications(FILE* file);
private:
bool IsRtxSsrc(PacketDirection direction, uint32_t ssrc) const {
if (direction == kIncomingPacket) {
return parsed_log_.incoming_rtx_ssrcs().find(ssrc) !=
parsed_log_.incoming_rtx_ssrcs().end();
} else {
return parsed_log_.outgoing_rtx_ssrcs().find(ssrc) !=
parsed_log_.outgoing_rtx_ssrcs().end();
class StreamId {
public:
StreamId(uint32_t ssrc, webrtc::PacketDirection direction)
: ssrc_(ssrc), direction_(direction) {}
bool operator<(const StreamId& other) const {
return std::tie(ssrc_, direction_) <
std::tie(other.ssrc_, other.direction_);
}
}
bool IsVideoSsrc(PacketDirection direction, uint32_t ssrc) const {
if (direction == kIncomingPacket) {
return parsed_log_.incoming_video_ssrcs().find(ssrc) !=
parsed_log_.incoming_video_ssrcs().end();
} else {
return parsed_log_.outgoing_video_ssrcs().find(ssrc) !=
parsed_log_.outgoing_video_ssrcs().end();
bool operator==(const StreamId& other) const {
return std::tie(ssrc_, direction_) ==
std::tie(other.ssrc_, other.direction_);
}
}
uint32_t GetSsrc() const { return ssrc_; }
webrtc::PacketDirection GetDirection() const { return direction_; }
bool IsAudioSsrc(PacketDirection direction, uint32_t ssrc) const {
if (direction == kIncomingPacket) {
return parsed_log_.incoming_audio_ssrcs().find(ssrc) !=
parsed_log_.incoming_audio_ssrcs().end();
} else {
return parsed_log_.outgoing_audio_ssrcs().find(ssrc) !=
parsed_log_.outgoing_audio_ssrcs().end();
}
}
private:
uint32_t ssrc_;
webrtc::PacketDirection direction_;
};
template <typename IterableType>
void CreateAccumulatedPacketsTimeSeries(Plot* plot,
const IterableType& packets,
const std::string& label);
template <typename T>
void CreateAccumulatedPacketsTimeSeries(
PacketDirection desired_direction,
Plot* plot,
const std::map<StreamId, std::vector<T>>& packets,
const std::string& label_prefix);
void CreateStreamGapAlerts(PacketDirection direction);
void CreateTransmissionGapAlerts(PacketDirection direction);
bool IsRtxSsrc(StreamId stream_id) const;
std::string GetStreamName(PacketDirection direction, uint32_t ssrc) const {
char buffer[200];
rtc::SimpleStringBuilder name(buffer);
if (IsAudioSsrc(direction, ssrc)) {
name << "Audio ";
} else if (IsVideoSsrc(direction, ssrc)) {
name << "Video ";
} else {
name << "Unknown ";
}
if (IsRtxSsrc(direction, ssrc)) {
name << "RTX ";
}
if (direction == kIncomingPacket)
name << "(In) ";
else
name << "(Out) ";
name << "SSRC " << ssrc;
return name.str();
}
bool IsVideoSsrc(StreamId stream_id) const;
bool IsAudioSsrc(StreamId stream_id) const;
std::string GetStreamName(StreamId stream_id) const;
rtc::Optional<uint32_t> EstimateRtpClockFrequency(
const std::vector<LoggedRtpPacket>& packets) const;
float ToCallTime(int64_t timestamp) const;
void Alert_RtpLogTimeGap(PacketDirection direction,
float time_seconds,
int64_t duration) {
if (direction == kIncomingPacket) {
incoming_rtp_recv_time_gaps_.emplace_back(time_seconds, duration);
} else {
outgoing_rtp_send_time_gaps_.emplace_back(time_seconds, duration);
}
}
void Alert_RtcpLogTimeGap(PacketDirection direction,
float time_seconds,
int64_t duration) {
if (direction == kIncomingPacket) {
incoming_rtcp_recv_time_gaps_.emplace_back(time_seconds, duration);
} else {
outgoing_rtcp_send_time_gaps_.emplace_back(time_seconds, duration);
}
}
void Alert_SeqNumJump(PacketDirection direction,
float time_seconds,
uint32_t ssrc) {
if (direction == kIncomingPacket) {
incoming_seq_num_jumps_.emplace_back(time_seconds, ssrc);
} else {
outgoing_seq_num_jumps_.emplace_back(time_seconds, ssrc);
}
}
void Alert_CaptureTimeJump(PacketDirection direction,
float time_seconds,
uint32_t ssrc) {
if (direction == kIncomingPacket) {
incoming_capture_time_jumps_.emplace_back(time_seconds, ssrc);
} else {
outgoing_capture_time_jumps_.emplace_back(time_seconds, ssrc);
}
}
void Alert_OutgoingHighLoss(double avg_loss_fraction) {
outgoing_high_loss_alerts_.emplace_back(avg_loss_fraction);
}
void Notification(std::unique_ptr<TriageNotification> notification);
std::string GetCandidatePairLogDescriptionFromId(uint32_t candidate_pair_id);
@ -194,19 +177,50 @@ class EventLogAnalyzer {
// If left empty, all SSRCs will be considered relevant.
std::vector<uint32_t> desired_ssrc_;
// Tracks what each stream is configured for. Note that a single SSRC can be
// in several sets. For example, the SSRC used for sending video over RTX
// will appear in both video_ssrcs_ and rtx_ssrcs_. In the unlikely case that
// an SSRC is reconfigured to a different media type mid-call, it will also
// appear in multiple sets.
std::set<StreamId> rtx_ssrcs_;
std::set<StreamId> video_ssrcs_;
std::set<StreamId> audio_ssrcs_;
// Maps a stream identifier consisting of ssrc and direction to the parsed
// RTP headers in that stream. Header extensions are parsed if the stream
// has been configured.
std::map<StreamId, std::vector<LoggedRtpPacket>> rtp_packets_;
std::map<StreamId, std::vector<LoggedRtcpPacket>> rtcp_packets_;
// Maps an SSRC to the timestamps of parsed audio playout events.
std::map<uint32_t, std::vector<uint64_t>> audio_playout_events_;
// Stores the timestamps for all log segments, in the form of associated start
// and end events.
std::vector<std::pair<int64_t, int64_t>> log_segments_;
std::vector<std::pair<uint64_t, uint64_t>> log_segments_;
std::vector<IncomingRtpReceiveTimeGap> incoming_rtp_recv_time_gaps_;
std::vector<IncomingRtcpReceiveTimeGap> incoming_rtcp_recv_time_gaps_;
std::vector<OutgoingRtpSendTimeGap> outgoing_rtp_send_time_gaps_;
std::vector<OutgoingRtcpSendTimeGap> outgoing_rtcp_send_time_gaps_;
std::vector<IncomingSeqNumJump> incoming_seq_num_jumps_;
std::vector<IncomingCaptureTimeJump> incoming_capture_time_jumps_;
std::vector<OutgoingSeqNoJump> outgoing_seq_num_jumps_;
std::vector<OutgoingCaptureTimeJump> outgoing_capture_time_jumps_;
std::vector<OutgoingHighLoss> outgoing_high_loss_alerts_;
// A list of all updates from the send-side loss-based bandwidth estimator.
std::vector<LossBasedBweUpdate> bwe_loss_updates_;
std::vector<AudioNetworkAdaptationEvent> audio_network_adaptation_events_;
std::vector<ParsedRtcEventLog::BweProbeClusterCreatedEvent>
bwe_probe_cluster_created_events_;
std::vector<ParsedRtcEventLog::BweProbeResultEvent> bwe_probe_result_events_;
std::vector<ParsedRtcEventLog::BweDelayBasedUpdate> bwe_delay_updates_;
std::vector<std::unique_ptr<TriageNotification>> notifications_;
std::vector<ParsedRtcEventLog::AlrStateEvent> alr_state_events_;
std::vector<ParsedRtcEventLog::IceCandidatePairConfig>
ice_candidate_pair_configs_;
std::vector<ParsedRtcEventLog::IceCandidatePairEvent>
ice_candidate_pair_events_;
std::map<uint32_t, std::string> candidate_pair_desc_by_id_;
@ -214,17 +228,18 @@ class EventLogAnalyzer {
// The generated data points will be |step_| microseconds apart.
// Only events occuring at most |window_duration_| microseconds before the
// current data point will be part of the average.
int64_t window_duration_;
int64_t step_;
uint64_t window_duration_;
uint64_t step_;
// First and last events of the log.
int64_t begin_time_;
int64_t end_time_;
uint64_t begin_time_;
uint64_t end_time_;
// Duration (in seconds) of log file.
float call_duration_s_;
};
} // namespace plotting
} // namespace webrtc
#endif // RTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_

View File

@ -10,7 +10,7 @@
#include <iostream>
#include "logging/rtc_event_log/rtc_event_log_parser2.h"
#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "rtc_base/flags.h"
#include "rtc_tools/event_log_visualizer/analyzer.h"
#include "rtc_tools/event_log_visualizer/plot_base.h"
@ -143,15 +143,10 @@ DEFINE_bool(show_alr_state,
false,
"Show the state ALR state on the total bitrate graph");
DEFINE_bool(parse_unconfigured_header_extensions,
true,
"Attempt to parse unconfigured header extensions using the default "
"WebRTC mapping. This can give very misleading results if the "
"application negotiates a different mapping.");
DEFINE_bool(print_triage_alerts,
false,
"Print triage alerts, i.e. a list of potential problems.");
DEFINE_bool(
print_triage_notifications,
false,
"Print triage notifications, i.e. a list of suspicious looking events.");
void SetAllPlotFlags(bool setting);
@ -214,13 +209,7 @@ int main(int argc, char* argv[]) {
std::string filename = argv[1];
webrtc::ParsedRtcEventLog::UnconfiguredHeaderExtensions header_extensions =
webrtc::ParsedRtcEventLog::UnconfiguredHeaderExtensions::kDontParse;
if (FLAG_parse_unconfigured_header_extensions) {
header_extensions = webrtc::ParsedRtcEventLog::
UnconfiguredHeaderExtensions::kAttemptWebrtcDefaultConfig;
}
webrtc::ParsedRtcEventLog parsed_log(header_extensions);
webrtc::ParsedRtcEventLog parsed_log;
if (!parsed_log.ParseFile(filename)) {
std::cerr << "Could not parse the entire log file." << std::endl;
@ -229,34 +218,31 @@ int main(int argc, char* argv[]) {
<< std::endl;
}
webrtc::EventLogAnalyzer analyzer(parsed_log);
std::unique_ptr<webrtc::PlotCollection> collection(
new webrtc::PythonPlotCollection());
webrtc::plotting::EventLogAnalyzer analyzer(parsed_log);
std::unique_ptr<webrtc::plotting::PlotCollection> collection(
new webrtc::plotting::PythonPlotCollection());
if (FLAG_plot_incoming_packet_sizes) {
analyzer.CreatePacketGraph(webrtc::kIncomingPacket,
analyzer.CreatePacketGraph(webrtc::PacketDirection::kIncomingPacket,
collection->AppendNewPlot());
}
if (FLAG_plot_outgoing_packet_sizes) {
analyzer.CreatePacketGraph(webrtc::kOutgoingPacket,
analyzer.CreatePacketGraph(webrtc::PacketDirection::kOutgoingPacket,
collection->AppendNewPlot());
}
if (FLAG_plot_incoming_packet_count) {
analyzer.CreateAccumulatedPacketsGraph(webrtc::kIncomingPacket,
collection->AppendNewPlot());
analyzer.CreateAccumulatedPacketsGraph(
webrtc::PacketDirection::kIncomingPacket, collection->AppendNewPlot());
}
if (FLAG_plot_outgoing_packet_count) {
analyzer.CreateAccumulatedPacketsGraph(webrtc::kOutgoingPacket,
collection->AppendNewPlot());
analyzer.CreateAccumulatedPacketsGraph(
webrtc::PacketDirection::kOutgoingPacket, collection->AppendNewPlot());
}
if (FLAG_plot_audio_playout) {
analyzer.CreatePlayoutGraph(collection->AppendNewPlot());
}
if (FLAG_plot_audio_level) {
analyzer.CreateAudioLevelGraph(webrtc::kIncomingPacket,
collection->AppendNewPlot());
analyzer.CreateAudioLevelGraph(webrtc::kOutgoingPacket,
collection->AppendNewPlot());
analyzer.CreateAudioLevelGraph(collection->AppendNewPlot());
}
if (FLAG_plot_incoming_sequence_number_delta) {
analyzer.CreateSequenceNumberGraph(collection->AppendNewPlot());
@ -271,19 +257,23 @@ int main(int argc, char* argv[]) {
analyzer.CreateIncomingPacketLossGraph(collection->AppendNewPlot());
}
if (FLAG_plot_incoming_bitrate) {
analyzer.CreateTotalIncomingBitrateGraph(collection->AppendNewPlot());
analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kIncomingPacket,
collection->AppendNewPlot(),
FLAG_show_detector_state,
FLAG_show_alr_state);
}
if (FLAG_plot_outgoing_bitrate) {
analyzer.CreateTotalOutgoingBitrateGraph(collection->AppendNewPlot(),
FLAG_show_detector_state,
FLAG_show_alr_state);
analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kOutgoingPacket,
collection->AppendNewPlot(),
FLAG_show_detector_state,
FLAG_show_alr_state);
}
if (FLAG_plot_incoming_stream_bitrate) {
analyzer.CreateStreamBitrateGraph(webrtc::kIncomingPacket,
analyzer.CreateStreamBitrateGraph(webrtc::PacketDirection::kIncomingPacket,
collection->AppendNewPlot());
}
if (FLAG_plot_outgoing_stream_bitrate) {
analyzer.CreateStreamBitrateGraph(webrtc::kOutgoingPacket,
analyzer.CreateStreamBitrateGraph(webrtc::PacketDirection::kOutgoingPacket,
collection->AppendNewPlot());
}
if (FLAG_plot_simulated_receiveside_bwe) {
@ -299,10 +289,7 @@ int main(int argc, char* argv[]) {
analyzer.CreateFractionLossGraph(collection->AppendNewPlot());
}
if (FLAG_plot_timestamps) {
analyzer.CreateTimestampGraph(webrtc::kIncomingPacket,
collection->AppendNewPlot());
analyzer.CreateTimestampGraph(webrtc::kOutgoingPacket,
collection->AppendNewPlot());
analyzer.CreateTimestampGraph(collection->AppendNewPlot());
}
if (FLAG_plot_pacer_delay) {
analyzer.CreatePacerDelayGraph(collection->AppendNewPlot());
@ -346,7 +333,7 @@ int main(int argc, char* argv[]) {
collection->Draw();
if (FLAG_print_triage_alerts) {
if (FLAG_print_triage_notifications) {
analyzer.CreateTriageNotifications();
analyzer.PrintNotifications(stderr);
}

View File

@ -15,6 +15,7 @@
#include "rtc_base/checks.h"
namespace webrtc {
namespace plotting {
void Plot::SetXAxis(float min_value,
float max_value,
@ -84,4 +85,5 @@ void Plot::AppendTimeSeriesIfNotEmpty(TimeSeries&& time_series) {
}
}
} // namespace plotting
} // namespace webrtc

View File

@ -16,6 +16,7 @@
#include <vector>
namespace webrtc {
namespace plotting {
enum class LineStyle {
kNone, // No line connecting the points. Used to create scatter plots.
@ -172,6 +173,7 @@ class PlotCollection {
std::vector<std::unique_ptr<Plot> > plots_;
};
} // namespace plotting
} // namespace webrtc
#endif // RTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_BASE_H_

View File

@ -13,6 +13,7 @@
#include <memory>
namespace webrtc {
namespace plotting {
ProtobufPlot::ProtobufPlot() {}
@ -82,4 +83,5 @@ Plot* ProtobufPlotCollection::AppendNewPlot() {
return plot;
}
} // namespace plotting
} // namespace webrtc

View File

@ -17,6 +17,7 @@ RTC_POP_IGNORING_WUNDEF()
#include "rtc_tools/event_log_visualizer/plot_base.h"
namespace webrtc {
namespace plotting {
class ProtobufPlot final : public Plot {
public:
@ -35,6 +36,7 @@ class ProtobufPlotCollection final : public PlotCollection {
void ExportProtobuf(webrtc::analytics::ChartCollection* collection);
};
} // namespace plotting
} // namespace webrtc
#endif // RTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_PROTOBUF_H_

View File

@ -17,6 +17,7 @@
#include "rtc_base/checks.h"
namespace webrtc {
namespace plotting {
PythonPlot::PythonPlot() {}
@ -179,4 +180,5 @@ Plot* PythonPlotCollection::AppendNewPlot() {
return plot;
}
} // namespace plotting
} // namespace webrtc

View File

@ -13,6 +13,7 @@
#include "rtc_tools/event_log_visualizer/plot_base.h"
namespace webrtc {
namespace plotting {
class PythonPlot final : public Plot {
public:
@ -29,6 +30,7 @@ class PythonPlotCollection final : public PlotCollection {
Plot* AppendNewPlot() override;
};
} // namespace plotting
} // namespace webrtc
#endif // RTC_TOOLS_EVENT_LOG_VISUALIZER_PLOT_PYTHON_H_

View File

@ -14,136 +14,130 @@
#include <string>
namespace webrtc {
namespace plotting {
class IncomingRtpReceiveTimeGap {
class TriageNotification {
public:
TriageNotification() : time_seconds_() {}
explicit TriageNotification(float time_seconds)
: time_seconds_(time_seconds) {}
virtual ~TriageNotification() = default;
virtual std::string ToString() = 0;
rtc::Optional<float> Time() { return time_seconds_; }
private:
rtc::Optional<float> time_seconds_;
};
class IncomingRtpReceiveTimeGap : public TriageNotification {
public:
IncomingRtpReceiveTimeGap(float time_seconds, int64_t duration)
: time_seconds_(time_seconds), duration_(duration) {}
float Time() const { return time_seconds_; }
std::string ToString() const {
: TriageNotification(time_seconds), duration_(duration) {}
std::string ToString() {
return std::string("No RTP packets received for ") +
std::to_string(duration_) + std::string(" ms");
}
private:
float time_seconds_;
int64_t duration_;
};
class IncomingRtcpReceiveTimeGap {
class IncomingRtcpReceiveTimeGap : public TriageNotification {
public:
IncomingRtcpReceiveTimeGap(float time_seconds, int64_t duration)
: time_seconds_(time_seconds), duration_(duration) {}
float Time() const { return time_seconds_; }
std::string ToString() const {
: TriageNotification(time_seconds), duration_(duration) {}
std::string ToString() {
return std::string("No RTCP packets received for ") +
std::to_string(duration_) + std::string(" ms");
}
private:
float time_seconds_;
int64_t duration_;
};
class OutgoingRtpSendTimeGap {
class OutgoingRtpSendTimeGap : public TriageNotification {
public:
OutgoingRtpSendTimeGap(float time_seconds, int64_t duration)
: time_seconds_(time_seconds), duration_(duration) {}
float Time() const { return time_seconds_; }
std::string ToString() const {
: TriageNotification(time_seconds), duration_(duration) {}
std::string ToString() {
return std::string("No RTP packets sent for ") + std::to_string(duration_) +
std::string(" ms");
}
private:
float time_seconds_;
int64_t duration_;
};
class OutgoingRtcpSendTimeGap {
class OutgoingRtcpSendTimeGap : public TriageNotification {
public:
OutgoingRtcpSendTimeGap(float time_seconds, int64_t duration)
: time_seconds_(time_seconds), duration_(duration) {}
float Time() const { return time_seconds_; }
std::string ToString() const {
: TriageNotification(time_seconds), duration_(duration) {}
std::string ToString() {
return std::string("No RTCP packets sent for ") +
std::to_string(duration_) + std::string(" ms");
}
private:
float time_seconds_;
int64_t duration_;
};
class IncomingSeqNumJump {
class IncomingSeqNoJump : public TriageNotification {
public:
IncomingSeqNumJump(float time_seconds, uint32_t ssrc)
: time_seconds_(time_seconds), ssrc_(ssrc) {}
float Time() const { return time_seconds_; }
std::string ToString() const {
IncomingSeqNoJump(float time_seconds, uint32_t ssrc)
: TriageNotification(time_seconds), ssrc_(ssrc) {}
std::string ToString() {
return std::string("Sequence number jumps on incoming SSRC ") +
std::to_string(ssrc_);
}
private:
float time_seconds_;
uint32_t ssrc_;
};
class IncomingCaptureTimeJump {
class IncomingCaptureTimeJump : public TriageNotification {
public:
IncomingCaptureTimeJump(float time_seconds, uint32_t ssrc)
: time_seconds_(time_seconds), ssrc_(ssrc) {}
float Time() const { return time_seconds_; }
std::string ToString() const {
: TriageNotification(time_seconds), ssrc_(ssrc) {}
std::string ToString() {
return std::string("Capture timestamp jumps on incoming SSRC ") +
std::to_string(ssrc_);
}
private:
float time_seconds_;
uint32_t ssrc_;
};
class OutgoingSeqNoJump {
class OutgoingSeqNoJump : public TriageNotification {
public:
OutgoingSeqNoJump(float time_seconds, uint32_t ssrc)
: time_seconds_(time_seconds), ssrc_(ssrc) {}
float Time() const { return time_seconds_; }
std::string ToString() const {
: TriageNotification(time_seconds), ssrc_(ssrc) {}
std::string ToString() {
return std::string("Sequence number jumps on outgoing SSRC ") +
std::to_string(ssrc_);
}
private:
float time_seconds_;
uint32_t ssrc_;
};
class OutgoingCaptureTimeJump {
class OutgoingCaptureTimeJump : public TriageNotification {
public:
OutgoingCaptureTimeJump(float time_seconds, uint32_t ssrc)
: time_seconds_(time_seconds), ssrc_(ssrc) {}
float Time() const { return time_seconds_; }
std::string ToString() const {
: TriageNotification(time_seconds), ssrc_(ssrc) {}
std::string ToString() {
return std::string("Capture timestamp jumps on outgoing SSRC ") +
std::to_string(ssrc_);
}
private:
float time_seconds_;
uint32_t ssrc_;
};
class OutgoingHighLoss {
class OutgoingHighLoss : public TriageNotification {
public:
explicit OutgoingHighLoss(double avg_loss_fraction)
: avg_loss_fraction_(avg_loss_fraction) {}
std::string ToString() const {
std::string ToString() {
return std::string("High average loss (") +
std::to_string(avg_loss_fraction_ * 100) +
std::string("%) across the call.");
@ -153,6 +147,7 @@ class OutgoingHighLoss {
double avg_loss_fraction_;
};
} // namespace plotting
} // namespace webrtc
#endif // RTC_TOOLS_EVENT_LOG_VISUALIZER_TRIAGE_NOTIFICATIONS_H_