This cl removes RtcEventLog deps to call:call_interfaces. The purpose is to be able to use the event log from the upcoming RtpTransport.
Biggest change is to Remove MediaType as argument to RtcEventLog::LogRtpHeader and RtcEventLog::LogRtcpHeader. Since the type is used by tools, these tools are rewritten to figure out the media type from the configurations instead. BUG=webrtc:7538 TBR=solenberg@webrtc.org // For call.cc and voiceengine.cc Review-Url: https://codereview.webrtc.org/2855143002 Cr-Commit-Position: refs/heads/master@{#18324}
This commit is contained in:
@ -1214,7 +1214,7 @@ PacketReceiver::DeliveryStatus Call::DeliverRtcp(MediaType media_type,
|
||||
}
|
||||
|
||||
if (rtcp_delivered)
|
||||
event_log_->LogRtcpPacket(kIncomingPacket, media_type, packet, length);
|
||||
event_log_->LogRtcpPacket(kIncomingPacket, packet, length);
|
||||
|
||||
return rtcp_delivered ? DELIVERY_OK : DELIVERY_PACKET_ERROR;
|
||||
}
|
||||
@ -1242,14 +1242,14 @@ PacketReceiver::DeliveryStatus Call::DeliverRtp(MediaType media_type,
|
||||
if (audio_rtp_demuxer_.OnRtpPacket(*parsed_packet)) {
|
||||
received_bytes_per_second_counter_.Add(static_cast<int>(length));
|
||||
received_audio_bytes_per_second_counter_.Add(static_cast<int>(length));
|
||||
event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length);
|
||||
event_log_->LogRtpHeader(kIncomingPacket, packet, length);
|
||||
return DELIVERY_OK;
|
||||
}
|
||||
} else if (media_type == MediaType::VIDEO) {
|
||||
if (video_rtp_demuxer_.OnRtpPacket(*parsed_packet)) {
|
||||
received_bytes_per_second_counter_.Add(static_cast<int>(length));
|
||||
received_video_bytes_per_second_counter_.Add(static_cast<int>(length));
|
||||
event_log_->LogRtpHeader(kIncomingPacket, media_type, packet, length);
|
||||
event_log_->LogRtpHeader(kIncomingPacket, packet, length);
|
||||
return DELIVERY_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,8 +28,8 @@ rtc_source_set("rtc_event_log_api") {
|
||||
]
|
||||
deps = [
|
||||
"..:video_stream_api",
|
||||
"..:webrtc_common",
|
||||
"../base:rtc_base_approved",
|
||||
"../call:call_interfaces",
|
||||
]
|
||||
}
|
||||
|
||||
@ -48,7 +48,6 @@ rtc_static_library("rtc_event_log_impl") {
|
||||
"..:webrtc_common",
|
||||
"../base:protobuf_utils",
|
||||
"../base:rtc_base_approved",
|
||||
"../call:call_interfaces",
|
||||
"../modules/audio_coding:audio_network_adaptor",
|
||||
"../modules/remote_bitrate_estimator:remote_bitrate_estimator",
|
||||
"../modules/rtp_rtcp",
|
||||
@ -83,7 +82,6 @@ if (rtc_enable_protobuf) {
|
||||
":rtc_event_log_api",
|
||||
":rtc_event_log_proto",
|
||||
"..:webrtc_common",
|
||||
"../call:call_interfaces",
|
||||
"../modules/audio_coding:audio_network_adaptor",
|
||||
"../modules/remote_bitrate_estimator:remote_bitrate_estimator",
|
||||
"../modules/rtp_rtcp:rtp_rtcp",
|
||||
@ -138,7 +136,6 @@ if (rtc_enable_protobuf) {
|
||||
":rtc_event_log_impl",
|
||||
":rtc_event_log_parser",
|
||||
"../base:rtc_base_approved",
|
||||
"../call:call_interfaces",
|
||||
"../modules/rtp_rtcp:rtp_rtcp",
|
||||
"../system_wrappers:field_trial_default",
|
||||
"../system_wrappers:metrics_default",
|
||||
@ -162,7 +159,6 @@ if (rtc_enable_protobuf) {
|
||||
":rtc_event_log_impl",
|
||||
":rtc_event_log_parser",
|
||||
"../base:rtc_base_approved",
|
||||
"../call:call_interfaces",
|
||||
|
||||
# TODO(kwiberg): Remove this dependency.
|
||||
"../api/audio_codecs:audio_codecs_api",
|
||||
|
||||
@ -41,22 +41,19 @@ class MockRtcEventLog : public RtcEventLog {
|
||||
MOCK_METHOD1(LogAudioSendStreamConfig,
|
||||
void(const rtclog::StreamConfig& config));
|
||||
|
||||
MOCK_METHOD4(LogRtpHeader,
|
||||
MOCK_METHOD3(LogRtpHeader,
|
||||
void(PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* header,
|
||||
size_t packet_length));
|
||||
|
||||
MOCK_METHOD5(LogRtpHeader,
|
||||
MOCK_METHOD4(LogRtpHeader,
|
||||
void(PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* header,
|
||||
size_t packet_length,
|
||||
int probe_cluster_id));
|
||||
|
||||
MOCK_METHOD4(LogRtcpPacket,
|
||||
MOCK_METHOD3(LogRtcpPacket,
|
||||
void(PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* packet,
|
||||
size_t length));
|
||||
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
#include "webrtc/base/swap_queue.h"
|
||||
#include "webrtc/base/thread_checker.h"
|
||||
#include "webrtc/base/timeutils.h"
|
||||
#include "webrtc/call/call.h"
|
||||
#include "webrtc/logging/rtc_event_log/rtc_event_log_helper_thread.h"
|
||||
#include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
@ -67,16 +66,13 @@ class RtcEventLogImpl final : public RtcEventLog {
|
||||
void LogAudioReceiveStreamConfig(const rtclog::StreamConfig& config) override;
|
||||
void LogAudioSendStreamConfig(const rtclog::StreamConfig& config) override;
|
||||
void LogRtpHeader(PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* header,
|
||||
size_t packet_length) override;
|
||||
void LogRtpHeader(PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* header,
|
||||
size_t packet_length,
|
||||
int probe_cluster_id) override;
|
||||
void LogRtcpPacket(PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* packet,
|
||||
size_t length) override;
|
||||
void LogAudioPlayout(uint32_t ssrc) override;
|
||||
@ -132,21 +128,6 @@ rtclog::VideoReceiveConfig_RtcpMode ConvertRtcpMode(RtcpMode rtcp_mode) {
|
||||
return rtclog::VideoReceiveConfig::RTCP_COMPOUND;
|
||||
}
|
||||
|
||||
rtclog::MediaType ConvertMediaType(MediaType media_type) {
|
||||
switch (media_type) {
|
||||
case MediaType::ANY:
|
||||
return rtclog::MediaType::ANY;
|
||||
case MediaType::AUDIO:
|
||||
return rtclog::MediaType::AUDIO;
|
||||
case MediaType::VIDEO:
|
||||
return rtclog::MediaType::VIDEO;
|
||||
case MediaType::DATA:
|
||||
return rtclog::MediaType::DATA;
|
||||
}
|
||||
RTC_NOTREACHED();
|
||||
return rtclog::ANY;
|
||||
}
|
||||
|
||||
rtclog::DelayBasedBweUpdate::DetectorState ConvertDetectorState(
|
||||
BandwidthUsage state) {
|
||||
switch (state) {
|
||||
@ -390,15 +371,12 @@ void RtcEventLogImpl::LogAudioSendStreamConfig(
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogRtpHeader(PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* header,
|
||||
size_t packet_length) {
|
||||
LogRtpHeader(direction, media_type, header, packet_length,
|
||||
PacedPacketInfo::kNotAProbe);
|
||||
LogRtpHeader(direction, header, packet_length, PacedPacketInfo::kNotAProbe);
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogRtpHeader(PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* header,
|
||||
size_t packet_length,
|
||||
int probe_cluster_id) {
|
||||
@ -422,7 +400,6 @@ void RtcEventLogImpl::LogRtpHeader(PacketDirection direction,
|
||||
rtp_event->set_timestamp_us(rtc::TimeMicros());
|
||||
rtp_event->set_type(rtclog::Event::RTP_EVENT);
|
||||
rtp_event->mutable_rtp_packet()->set_incoming(direction == kIncomingPacket);
|
||||
rtp_event->mutable_rtp_packet()->set_type(ConvertMediaType(media_type));
|
||||
rtp_event->mutable_rtp_packet()->set_packet_length(packet_length);
|
||||
rtp_event->mutable_rtp_packet()->set_header(header, header_length);
|
||||
if (probe_cluster_id != PacedPacketInfo::kNotAProbe)
|
||||
@ -431,14 +408,12 @@ void RtcEventLogImpl::LogRtpHeader(PacketDirection direction,
|
||||
}
|
||||
|
||||
void RtcEventLogImpl::LogRtcpPacket(PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* packet,
|
||||
size_t length) {
|
||||
std::unique_ptr<rtclog::Event> rtcp_event(new rtclog::Event());
|
||||
rtcp_event->set_timestamp_us(rtc::TimeMicros());
|
||||
rtcp_event->set_type(rtclog::Event::RTCP_EVENT);
|
||||
rtcp_event->mutable_rtcp_packet()->set_incoming(direction == kIncomingPacket);
|
||||
rtcp_event->mutable_rtcp_packet()->set_type(ConvertMediaType(media_type));
|
||||
|
||||
rtcp::CommonHeader header;
|
||||
const uint8_t* block_begin = packet;
|
||||
|
||||
@ -16,10 +16,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/base/platform_file.h"
|
||||
#include "webrtc/call/audio_receive_stream.h"
|
||||
#include "webrtc/call/audio_send_stream.h"
|
||||
#include "webrtc/video_receive_stream.h"
|
||||
#include "webrtc/video_send_stream.h"
|
||||
#include "webrtc/config.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -129,21 +126,18 @@ class RtcEventLog {
|
||||
// Logs the header of an incoming or outgoing RTP packet. packet_length
|
||||
// is the total length of the packet, including both header and payload.
|
||||
virtual void LogRtpHeader(PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* header,
|
||||
size_t packet_length) = 0;
|
||||
|
||||
// Same as above but used on the sender side to log packets that are part of
|
||||
// a probe cluster.
|
||||
virtual void LogRtpHeader(PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* header,
|
||||
size_t packet_length,
|
||||
int probe_cluster_id) = 0;
|
||||
|
||||
// Logs an incoming or outgoing RTCP packet.
|
||||
virtual void LogRtcpPacket(PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* packet,
|
||||
size_t length) = 0;
|
||||
|
||||
@ -204,16 +198,13 @@ class RtcEventLogNullImpl : public RtcEventLog {
|
||||
const rtclog::StreamConfig& config) override {}
|
||||
void LogAudioSendStreamConfig(const rtclog::StreamConfig& config) override {}
|
||||
void LogRtpHeader(PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* header,
|
||||
size_t packet_length) override {}
|
||||
void LogRtpHeader(PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* header,
|
||||
size_t packet_length,
|
||||
int probe_cluster_id) override {}
|
||||
void LogRtcpPacket(PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* packet,
|
||||
size_t length) override {}
|
||||
void LogAudioPlayout(uint32_t ssrc) override {}
|
||||
|
||||
@ -86,8 +86,7 @@ message RtpPacket {
|
||||
// required - True if the packet is incoming w.r.t. the user logging the data
|
||||
optional bool incoming = 1;
|
||||
|
||||
// required
|
||||
optional MediaType type = 2;
|
||||
optional MediaType type = 2 [deprecated = true];
|
||||
|
||||
// required - The size of the packet including both payload and header.
|
||||
optional uint32 packet_length = 3;
|
||||
@ -105,8 +104,7 @@ message RtcpPacket {
|
||||
// required - True if the packet is incoming w.r.t. the user logging the data
|
||||
optional bool incoming = 1;
|
||||
|
||||
// required
|
||||
optional MediaType type = 2;
|
||||
optional MediaType type = 2 [deprecated = true];
|
||||
|
||||
// required - The whole packet including both payload and header.
|
||||
optional bytes packet_data = 3;
|
||||
|
||||
@ -15,14 +15,16 @@
|
||||
|
||||
#include "gflags/gflags.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/call/call.h"
|
||||
#include "webrtc/logging/rtc_event_log/rtc_event_log.h"
|
||||
#include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
|
||||
#include "webrtc/test/rtp_file_writer.h"
|
||||
|
||||
namespace {
|
||||
|
||||
using MediaType = webrtc::ParsedRtcEventLog::MediaType;
|
||||
|
||||
DEFINE_bool(noaudio,
|
||||
false,
|
||||
"Excludes audio packets from the converted RTPdump file.");
|
||||
@ -118,21 +120,28 @@ int main(int argc, char* argv[]) {
|
||||
parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::RTP_EVENT) {
|
||||
webrtc::test::RtpPacket packet;
|
||||
webrtc::PacketDirection direction;
|
||||
webrtc::MediaType media_type;
|
||||
parsed_stream.GetRtpHeader(i, &direction, &media_type, packet.data,
|
||||
&packet.length, &packet.original_length);
|
||||
parsed_stream.GetRtpHeader(i, &direction, packet.data, &packet.length,
|
||||
&packet.original_length);
|
||||
if (packet.original_length > packet.length)
|
||||
header_only = true;
|
||||
packet.time_ms = parsed_stream.GetTimestamp(i) / 1000;
|
||||
|
||||
webrtc::RtpUtility::RtpHeaderParser rtp_parser(packet.data,
|
||||
packet.length);
|
||||
|
||||
// TODO(terelius): Maybe add a flag to dump outgoing traffic instead?
|
||||
if (direction == webrtc::kOutgoingPacket)
|
||||
continue;
|
||||
if (FLAGS_noaudio && media_type == webrtc::MediaType::AUDIO)
|
||||
|
||||
webrtc::RTPHeader parsed_header;
|
||||
rtp_parser.Parse(&parsed_header);
|
||||
MediaType media_type =
|
||||
parsed_stream.GetMediaType(parsed_header.ssrc, direction);
|
||||
if (FLAGS_noaudio && media_type == MediaType::AUDIO)
|
||||
continue;
|
||||
if (FLAGS_novideo && media_type == webrtc::MediaType::VIDEO)
|
||||
if (FLAGS_novideo && media_type == MediaType::VIDEO)
|
||||
continue;
|
||||
if (FLAGS_nodata && media_type == webrtc::MediaType::DATA)
|
||||
if (FLAGS_nodata && media_type == MediaType::DATA)
|
||||
continue;
|
||||
if (!FLAGS_ssrc.empty()) {
|
||||
const uint32_t packet_ssrc =
|
||||
@ -150,9 +159,7 @@ int main(int argc, char* argv[]) {
|
||||
webrtc::ParsedRtcEventLog::RTCP_EVENT) {
|
||||
webrtc::test::RtpPacket packet;
|
||||
webrtc::PacketDirection direction;
|
||||
webrtc::MediaType media_type;
|
||||
parsed_stream.GetRtcpPacket(i, &direction, &media_type, packet.data,
|
||||
&packet.length);
|
||||
parsed_stream.GetRtcpPacket(i, &direction, packet.data, &packet.length);
|
||||
// For RTCP packets the original_length should be set to 0 in the
|
||||
// RTPdump format.
|
||||
packet.original_length = 0;
|
||||
@ -161,16 +168,20 @@ int main(int argc, char* argv[]) {
|
||||
// TODO(terelius): Maybe add a flag to dump outgoing traffic instead?
|
||||
if (direction == webrtc::kOutgoingPacket)
|
||||
continue;
|
||||
if (FLAGS_noaudio && media_type == webrtc::MediaType::AUDIO)
|
||||
|
||||
// Note that |packet_ssrc| is the sender SSRC. An RTCP message may contain
|
||||
// report blocks for many streams, thus several SSRCs and they doen't
|
||||
// necessarily have to be of the same media type.
|
||||
const uint32_t packet_ssrc = webrtc::ByteReader<uint32_t>::ReadBigEndian(
|
||||
reinterpret_cast<const uint8_t*>(packet.data + 4));
|
||||
MediaType media_type = parsed_stream.GetMediaType(packet_ssrc, direction);
|
||||
if (FLAGS_noaudio && media_type == MediaType::AUDIO)
|
||||
continue;
|
||||
if (FLAGS_novideo && media_type == webrtc::MediaType::VIDEO)
|
||||
if (FLAGS_novideo && media_type == MediaType::VIDEO)
|
||||
continue;
|
||||
if (FLAGS_nodata && media_type == webrtc::MediaType::DATA)
|
||||
if (FLAGS_nodata && media_type == MediaType::DATA)
|
||||
continue;
|
||||
if (!FLAGS_ssrc.empty()) {
|
||||
const uint32_t packet_ssrc =
|
||||
webrtc::ByteReader<uint32_t>::ReadBigEndian(
|
||||
reinterpret_cast<const uint8_t*>(packet.data + 4));
|
||||
if (packet_ssrc != ssrc_filter)
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
|
||||
#include "gflags/gflags.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/call/call.h"
|
||||
#include "webrtc/common_types.h"
|
||||
#include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h"
|
||||
@ -52,6 +51,8 @@ DEFINE_string(ssrc,
|
||||
"Print only packets with this SSRC (decimal or hex, the latter "
|
||||
"starting with 0x).");
|
||||
|
||||
using MediaType = webrtc::ParsedRtcEventLog::MediaType;
|
||||
|
||||
static uint32_t filtered_ssrc = 0;
|
||||
|
||||
// Parses the input string for a valid SSRC. If a valid SSRC is found, it is
|
||||
@ -73,44 +74,18 @@ bool ParseSsrc(std::string str) {
|
||||
return str.empty() || (!ss.fail() && ss.eof());
|
||||
}
|
||||
|
||||
// Struct used for storing SSRCs used in a Stream.
|
||||
struct Stream {
|
||||
Stream(uint32_t ssrc,
|
||||
webrtc::MediaType media_type,
|
||||
webrtc::PacketDirection direction)
|
||||
: ssrc(ssrc), media_type(media_type), direction(direction) {}
|
||||
uint32_t ssrc;
|
||||
webrtc::MediaType media_type;
|
||||
webrtc::PacketDirection direction;
|
||||
};
|
||||
|
||||
// All configured streams found in the event log.
|
||||
std::vector<Stream> global_streams;
|
||||
|
||||
// Returns the MediaType for registered SSRCs. Search from the end to use last
|
||||
// registered types first.
|
||||
webrtc::MediaType GetMediaType(uint32_t ssrc,
|
||||
webrtc::PacketDirection direction) {
|
||||
for (auto rit = global_streams.rbegin(); rit != global_streams.rend();
|
||||
++rit) {
|
||||
if (rit->ssrc == ssrc && rit->direction == direction)
|
||||
return rit->media_type;
|
||||
}
|
||||
return webrtc::MediaType::ANY;
|
||||
}
|
||||
|
||||
bool ExcludePacket(webrtc::PacketDirection direction,
|
||||
webrtc::MediaType media_type,
|
||||
MediaType media_type,
|
||||
uint32_t packet_ssrc) {
|
||||
if (FLAGS_nooutgoing && direction == webrtc::kOutgoingPacket)
|
||||
return true;
|
||||
if (FLAGS_noincoming && direction == webrtc::kIncomingPacket)
|
||||
return true;
|
||||
if (FLAGS_noaudio && media_type == webrtc::MediaType::AUDIO)
|
||||
if (FLAGS_noaudio && media_type == MediaType::AUDIO)
|
||||
return true;
|
||||
if (FLAGS_novideo && media_type == webrtc::MediaType::VIDEO)
|
||||
if (FLAGS_novideo && media_type == MediaType::VIDEO)
|
||||
return true;
|
||||
if (FLAGS_nodata && media_type == webrtc::MediaType::DATA)
|
||||
if (FLAGS_nodata && media_type == MediaType::DATA)
|
||||
return true;
|
||||
if (!FLAGS_ssrc.empty() && packet_ssrc != filtered_ssrc)
|
||||
return true;
|
||||
@ -118,23 +93,23 @@ bool ExcludePacket(webrtc::PacketDirection direction,
|
||||
}
|
||||
|
||||
const char* StreamInfo(webrtc::PacketDirection direction,
|
||||
webrtc::MediaType media_type) {
|
||||
MediaType media_type) {
|
||||
if (direction == webrtc::kOutgoingPacket) {
|
||||
if (media_type == webrtc::MediaType::AUDIO)
|
||||
if (media_type == MediaType::AUDIO)
|
||||
return "(out,audio)";
|
||||
else if (media_type == webrtc::MediaType::VIDEO)
|
||||
else if (media_type == MediaType::VIDEO)
|
||||
return "(out,video)";
|
||||
else if (media_type == webrtc::MediaType::DATA)
|
||||
else if (media_type == MediaType::DATA)
|
||||
return "(out,data)";
|
||||
else
|
||||
return "(out)";
|
||||
}
|
||||
if (direction == webrtc::kIncomingPacket) {
|
||||
if (media_type == webrtc::MediaType::AUDIO)
|
||||
if (media_type == MediaType::AUDIO)
|
||||
return "(in,audio)";
|
||||
else if (media_type == webrtc::MediaType::VIDEO)
|
||||
else if (media_type == MediaType::VIDEO)
|
||||
return "(in,video)";
|
||||
else if (media_type == webrtc::MediaType::DATA)
|
||||
else if (media_type == MediaType::DATA)
|
||||
return "(in,data)";
|
||||
else
|
||||
return "(in)";
|
||||
@ -142,13 +117,15 @@ const char* StreamInfo(webrtc::PacketDirection direction,
|
||||
return "(unknown)";
|
||||
}
|
||||
|
||||
void PrintSenderReport(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
void PrintSenderReport(const webrtc::ParsedRtcEventLog& parsed_stream,
|
||||
const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
uint64_t log_timestamp,
|
||||
webrtc::PacketDirection direction) {
|
||||
webrtc::rtcp::SenderReport sr;
|
||||
if (!sr.Parse(rtcp_block))
|
||||
return;
|
||||
webrtc::MediaType media_type = GetMediaType(sr.sender_ssrc(), direction);
|
||||
MediaType media_type =
|
||||
parsed_stream.GetMediaType(sr.sender_ssrc(), direction);
|
||||
if (ExcludePacket(direction, media_type, sr.sender_ssrc()))
|
||||
return;
|
||||
std::cout << log_timestamp << "\t"
|
||||
@ -157,13 +134,15 @@ void PrintSenderReport(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
<< "\ttimestamp=" << sr.rtp_timestamp() << std::endl;
|
||||
}
|
||||
|
||||
void PrintReceiverReport(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
void PrintReceiverReport(const webrtc::ParsedRtcEventLog& parsed_stream,
|
||||
const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
uint64_t log_timestamp,
|
||||
webrtc::PacketDirection direction) {
|
||||
webrtc::rtcp::ReceiverReport rr;
|
||||
if (!rr.Parse(rtcp_block))
|
||||
return;
|
||||
webrtc::MediaType media_type = GetMediaType(rr.sender_ssrc(), direction);
|
||||
MediaType media_type =
|
||||
parsed_stream.GetMediaType(rr.sender_ssrc(), direction);
|
||||
if (ExcludePacket(direction, media_type, rr.sender_ssrc()))
|
||||
return;
|
||||
std::cout << log_timestamp << "\t"
|
||||
@ -171,13 +150,15 @@ void PrintReceiverReport(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
<< "\tssrc=" << rr.sender_ssrc() << std::endl;
|
||||
}
|
||||
|
||||
void PrintXr(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
void PrintXr(const webrtc::ParsedRtcEventLog& parsed_stream,
|
||||
const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
uint64_t log_timestamp,
|
||||
webrtc::PacketDirection direction) {
|
||||
webrtc::rtcp::ExtendedReports xr;
|
||||
if (!xr.Parse(rtcp_block))
|
||||
return;
|
||||
webrtc::MediaType media_type = GetMediaType(xr.sender_ssrc(), direction);
|
||||
MediaType media_type =
|
||||
parsed_stream.GetMediaType(xr.sender_ssrc(), direction);
|
||||
if (ExcludePacket(direction, media_type, xr.sender_ssrc()))
|
||||
return;
|
||||
std::cout << log_timestamp << "\t"
|
||||
@ -189,18 +170,20 @@ void PrintSdes(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
uint64_t log_timestamp,
|
||||
webrtc::PacketDirection direction) {
|
||||
std::cout << log_timestamp << "\t"
|
||||
<< "RTCP_SDES" << StreamInfo(direction, webrtc::MediaType::ANY)
|
||||
<< "RTCP_SDES" << StreamInfo(direction, MediaType::ANY)
|
||||
<< std::endl;
|
||||
RTC_NOTREACHED() << "SDES should have been redacted when writing the log";
|
||||
}
|
||||
|
||||
void PrintBye(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
void PrintBye(const webrtc::ParsedRtcEventLog& parsed_stream,
|
||||
const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
uint64_t log_timestamp,
|
||||
webrtc::PacketDirection direction) {
|
||||
webrtc::rtcp::Bye bye;
|
||||
if (!bye.Parse(rtcp_block))
|
||||
return;
|
||||
webrtc::MediaType media_type = GetMediaType(bye.sender_ssrc(), direction);
|
||||
MediaType media_type =
|
||||
parsed_stream.GetMediaType(bye.sender_ssrc(), direction);
|
||||
if (ExcludePacket(direction, media_type, bye.sender_ssrc()))
|
||||
return;
|
||||
std::cout << log_timestamp << "\t"
|
||||
@ -208,7 +191,8 @@ void PrintBye(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
<< "\tssrc=" << bye.sender_ssrc() << std::endl;
|
||||
}
|
||||
|
||||
void PrintRtpFeedback(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
void PrintRtpFeedback(const webrtc::ParsedRtcEventLog& parsed_stream,
|
||||
const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
uint64_t log_timestamp,
|
||||
webrtc::PacketDirection direction) {
|
||||
switch (rtcp_block.fmt()) {
|
||||
@ -216,8 +200,8 @@ void PrintRtpFeedback(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
webrtc::rtcp::Nack nack;
|
||||
if (!nack.Parse(rtcp_block))
|
||||
return;
|
||||
webrtc::MediaType media_type =
|
||||
GetMediaType(nack.sender_ssrc(), direction);
|
||||
MediaType media_type =
|
||||
parsed_stream.GetMediaType(nack.sender_ssrc(), direction);
|
||||
if (ExcludePacket(direction, media_type, nack.sender_ssrc()))
|
||||
return;
|
||||
std::cout << log_timestamp << "\t"
|
||||
@ -229,8 +213,8 @@ void PrintRtpFeedback(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
webrtc::rtcp::Tmmbr tmmbr;
|
||||
if (!tmmbr.Parse(rtcp_block))
|
||||
return;
|
||||
webrtc::MediaType media_type =
|
||||
GetMediaType(tmmbr.sender_ssrc(), direction);
|
||||
MediaType media_type =
|
||||
parsed_stream.GetMediaType(tmmbr.sender_ssrc(), direction);
|
||||
if (ExcludePacket(direction, media_type, tmmbr.sender_ssrc()))
|
||||
return;
|
||||
std::cout << log_timestamp << "\t"
|
||||
@ -242,8 +226,8 @@ void PrintRtpFeedback(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
webrtc::rtcp::Tmmbn tmmbn;
|
||||
if (!tmmbn.Parse(rtcp_block))
|
||||
return;
|
||||
webrtc::MediaType media_type =
|
||||
GetMediaType(tmmbn.sender_ssrc(), direction);
|
||||
MediaType media_type =
|
||||
parsed_stream.GetMediaType(tmmbn.sender_ssrc(), direction);
|
||||
if (ExcludePacket(direction, media_type, tmmbn.sender_ssrc()))
|
||||
return;
|
||||
std::cout << log_timestamp << "\t"
|
||||
@ -255,8 +239,8 @@ void PrintRtpFeedback(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
webrtc::rtcp::RapidResyncRequest sr_req;
|
||||
if (!sr_req.Parse(rtcp_block))
|
||||
return;
|
||||
webrtc::MediaType media_type =
|
||||
GetMediaType(sr_req.sender_ssrc(), direction);
|
||||
MediaType media_type =
|
||||
parsed_stream.GetMediaType(sr_req.sender_ssrc(), direction);
|
||||
if (ExcludePacket(direction, media_type, sr_req.sender_ssrc()))
|
||||
return;
|
||||
std::cout << log_timestamp << "\t"
|
||||
@ -268,8 +252,8 @@ void PrintRtpFeedback(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
webrtc::rtcp::TransportFeedback transport_feedback;
|
||||
if (!transport_feedback.Parse(rtcp_block))
|
||||
return;
|
||||
webrtc::MediaType media_type =
|
||||
GetMediaType(transport_feedback.sender_ssrc(), direction);
|
||||
MediaType media_type = parsed_stream.GetMediaType(
|
||||
transport_feedback.sender_ssrc(), direction);
|
||||
if (ExcludePacket(direction, media_type,
|
||||
transport_feedback.sender_ssrc()))
|
||||
return;
|
||||
@ -283,7 +267,8 @@ void PrintRtpFeedback(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
}
|
||||
}
|
||||
|
||||
void PrintPsFeedback(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
void PrintPsFeedback(const webrtc::ParsedRtcEventLog& parsed_stream,
|
||||
const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
uint64_t log_timestamp,
|
||||
webrtc::PacketDirection direction) {
|
||||
switch (rtcp_block.fmt()) {
|
||||
@ -291,7 +276,8 @@ void PrintPsFeedback(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
webrtc::rtcp::Pli pli;
|
||||
if (!pli.Parse(rtcp_block))
|
||||
return;
|
||||
webrtc::MediaType media_type = GetMediaType(pli.sender_ssrc(), direction);
|
||||
MediaType media_type =
|
||||
parsed_stream.GetMediaType(pli.sender_ssrc(), direction);
|
||||
if (ExcludePacket(direction, media_type, pli.sender_ssrc()))
|
||||
return;
|
||||
std::cout << log_timestamp << "\t"
|
||||
@ -303,7 +289,8 @@ void PrintPsFeedback(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
webrtc::rtcp::Fir fir;
|
||||
if (!fir.Parse(rtcp_block))
|
||||
return;
|
||||
webrtc::MediaType media_type = GetMediaType(fir.sender_ssrc(), direction);
|
||||
MediaType media_type =
|
||||
parsed_stream.GetMediaType(fir.sender_ssrc(), direction);
|
||||
if (ExcludePacket(direction, media_type, fir.sender_ssrc()))
|
||||
return;
|
||||
std::cout << log_timestamp << "\t"
|
||||
@ -315,8 +302,8 @@ void PrintPsFeedback(const webrtc::rtcp::CommonHeader& rtcp_block,
|
||||
webrtc::rtcp::Remb remb;
|
||||
if (!remb.Parse(rtcp_block))
|
||||
return;
|
||||
webrtc::MediaType media_type =
|
||||
GetMediaType(remb.sender_ssrc(), direction);
|
||||
MediaType media_type =
|
||||
parsed_stream.GetMediaType(remb.sender_ssrc(), direction);
|
||||
if (ExcludePacket(direction, media_type, remb.sender_ssrc()))
|
||||
return;
|
||||
std::cout << log_timestamp << "\t"
|
||||
@ -362,67 +349,41 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < parsed_stream.GetNumberOfEvents(); i++) {
|
||||
if (parsed_stream.GetEventType(i) ==
|
||||
webrtc::ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT) {
|
||||
if (!FLAGS_noconfig && !FLAGS_novideo && !FLAGS_noincoming &&
|
||||
parsed_stream.GetEventType(i) ==
|
||||
webrtc::ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT) {
|
||||
webrtc::rtclog::StreamConfig config;
|
||||
parsed_stream.GetVideoReceiveConfig(i, &config);
|
||||
|
||||
global_streams.emplace_back(config.remote_ssrc,
|
||||
webrtc::MediaType::VIDEO,
|
||||
webrtc::kIncomingPacket);
|
||||
global_streams.emplace_back(config.local_ssrc,
|
||||
webrtc::MediaType::VIDEO,
|
||||
webrtc::kOutgoingPacket);
|
||||
|
||||
if (!FLAGS_noconfig && !FLAGS_novideo && !FLAGS_noincoming) {
|
||||
std::cout << parsed_stream.GetTimestamp(i) << "\tVIDEO_RECV_CONFIG"
|
||||
std::cout << parsed_stream.GetTimestamp(i) << "\tVIDEO_RECV_CONFIG"
|
||||
<< "\tssrc=" << config.remote_ssrc
|
||||
<< "\tfeedback_ssrc=" << config.local_ssrc << std::endl;
|
||||
}
|
||||
}
|
||||
if (parsed_stream.GetEventType(i) ==
|
||||
webrtc::ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT) {
|
||||
if (!FLAGS_noconfig && !FLAGS_novideo && !FLAGS_nooutgoing &&
|
||||
parsed_stream.GetEventType(i) ==
|
||||
webrtc::ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT) {
|
||||
webrtc::rtclog::StreamConfig config;
|
||||
parsed_stream.GetVideoSendConfig(i, &config);
|
||||
global_streams.emplace_back(config.local_ssrc, webrtc::MediaType::VIDEO,
|
||||
webrtc::kOutgoingPacket);
|
||||
|
||||
global_streams.emplace_back(config.rtx_ssrc, webrtc::MediaType::VIDEO,
|
||||
webrtc::kOutgoingPacket);
|
||||
|
||||
if (!FLAGS_noconfig && !FLAGS_novideo && !FLAGS_nooutgoing) {
|
||||
std::cout << parsed_stream.GetTimestamp(i) << "\tVIDEO_SEND_CONFIG";
|
||||
std::cout << "\tssrcs=" << config.local_ssrc;
|
||||
std::cout << "\trtx_ssrcs=" << config.rtx_ssrc;
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
if (parsed_stream.GetEventType(i) ==
|
||||
webrtc::ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT) {
|
||||
if (!FLAGS_noconfig && !FLAGS_noaudio && !FLAGS_noincoming &&
|
||||
parsed_stream.GetEventType(i) ==
|
||||
webrtc::ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT) {
|
||||
webrtc::rtclog::StreamConfig config;
|
||||
parsed_stream.GetAudioReceiveConfig(i, &config);
|
||||
global_streams.emplace_back(config.remote_ssrc,
|
||||
webrtc::MediaType::AUDIO,
|
||||
webrtc::kIncomingPacket);
|
||||
global_streams.emplace_back(config.local_ssrc,
|
||||
webrtc::MediaType::AUDIO,
|
||||
webrtc::kOutgoingPacket);
|
||||
if (!FLAGS_noconfig && !FLAGS_noaudio && !FLAGS_noincoming) {
|
||||
std::cout << parsed_stream.GetTimestamp(i) << "\tAUDIO_RECV_CONFIG"
|
||||
<< "\tssrc=" << config.remote_ssrc
|
||||
<< "\tfeedback_ssrc=" << config.local_ssrc << std::endl;
|
||||
}
|
||||
std::cout << parsed_stream.GetTimestamp(i) << "\tAUDIO_RECV_CONFIG"
|
||||
<< "\tssrc=" << config.remote_ssrc
|
||||
<< "\tfeedback_ssrc=" << config.local_ssrc << std::endl;
|
||||
}
|
||||
if (parsed_stream.GetEventType(i) ==
|
||||
webrtc::ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT) {
|
||||
if (!FLAGS_noconfig && !FLAGS_noaudio && !FLAGS_nooutgoing &&
|
||||
parsed_stream.GetEventType(i) ==
|
||||
webrtc::ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT) {
|
||||
webrtc::rtclog::StreamConfig config;
|
||||
parsed_stream.GetAudioSendConfig(i, &config);
|
||||
global_streams.emplace_back(config.local_ssrc, webrtc::MediaType::AUDIO,
|
||||
webrtc::kOutgoingPacket);
|
||||
if (!FLAGS_noconfig && !FLAGS_noaudio && !FLAGS_nooutgoing) {
|
||||
std::cout << parsed_stream.GetTimestamp(i) << "\tAUDIO_SEND_CONFIG"
|
||||
<< "\tssrc=" << config.local_ssrc << std::endl;
|
||||
}
|
||||
std::cout << parsed_stream.GetTimestamp(i) << "\tAUDIO_SEND_CONFIG"
|
||||
<< "\tssrc=" << config.local_ssrc << std::endl;
|
||||
}
|
||||
if (!FLAGS_nortp &&
|
||||
parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::RTP_EVENT) {
|
||||
@ -430,15 +391,16 @@ int main(int argc, char* argv[]) {
|
||||
size_t total_length;
|
||||
uint8_t header[IP_PACKET_SIZE];
|
||||
webrtc::PacketDirection direction;
|
||||
webrtc::MediaType media_type;
|
||||
parsed_stream.GetRtpHeader(i, &direction, &media_type, header,
|
||||
&header_length, &total_length);
|
||||
|
||||
parsed_stream.GetRtpHeader(i, &direction, header, &header_length,
|
||||
&total_length);
|
||||
|
||||
// Parse header to get SSRC and RTP time.
|
||||
webrtc::RtpUtility::RtpHeaderParser rtp_parser(header, header_length);
|
||||
webrtc::RTPHeader parsed_header;
|
||||
rtp_parser.Parse(&parsed_header);
|
||||
media_type = GetMediaType(parsed_header.ssrc, direction);
|
||||
MediaType media_type =
|
||||
parsed_stream.GetMediaType(parsed_header.ssrc, direction);
|
||||
|
||||
if (ExcludePacket(direction, media_type, parsed_header.ssrc))
|
||||
continue;
|
||||
@ -454,8 +416,7 @@ int main(int argc, char* argv[]) {
|
||||
size_t length;
|
||||
uint8_t packet[IP_PACKET_SIZE];
|
||||
webrtc::PacketDirection direction;
|
||||
webrtc::MediaType media_type;
|
||||
parsed_stream.GetRtcpPacket(i, &direction, &media_type, packet, &length);
|
||||
parsed_stream.GetRtcpPacket(i, &direction, packet, &length);
|
||||
|
||||
webrtc::rtcp::CommonHeader rtcp_block;
|
||||
const uint8_t* packet_end = packet + length;
|
||||
@ -470,25 +431,29 @@ int main(int argc, char* argv[]) {
|
||||
uint64_t log_timestamp = parsed_stream.GetTimestamp(i);
|
||||
switch (rtcp_block.type()) {
|
||||
case webrtc::rtcp::SenderReport::kPacketType:
|
||||
PrintSenderReport(rtcp_block, log_timestamp, direction);
|
||||
PrintSenderReport(parsed_stream, rtcp_block, log_timestamp,
|
||||
direction);
|
||||
break;
|
||||
case webrtc::rtcp::ReceiverReport::kPacketType:
|
||||
PrintReceiverReport(rtcp_block, log_timestamp, direction);
|
||||
PrintReceiverReport(parsed_stream, rtcp_block, log_timestamp,
|
||||
direction);
|
||||
break;
|
||||
case webrtc::rtcp::Sdes::kPacketType:
|
||||
PrintSdes(rtcp_block, log_timestamp, direction);
|
||||
break;
|
||||
case webrtc::rtcp::ExtendedReports::kPacketType:
|
||||
PrintXr(rtcp_block, log_timestamp, direction);
|
||||
PrintXr(parsed_stream, rtcp_block, log_timestamp, direction);
|
||||
break;
|
||||
case webrtc::rtcp::Bye::kPacketType:
|
||||
PrintBye(rtcp_block, log_timestamp, direction);
|
||||
PrintBye(parsed_stream, rtcp_block, log_timestamp, direction);
|
||||
break;
|
||||
case webrtc::rtcp::Rtpfb::kPacketType:
|
||||
PrintRtpFeedback(rtcp_block, log_timestamp, direction);
|
||||
PrintRtpFeedback(parsed_stream, rtcp_block, log_timestamp,
|
||||
direction);
|
||||
break;
|
||||
case webrtc::rtcp::Psfb::kPacketType:
|
||||
PrintPsFeedback(rtcp_block, log_timestamp, direction);
|
||||
PrintPsFeedback(parsed_stream, rtcp_block, log_timestamp,
|
||||
direction);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/protobuf_utils.h"
|
||||
#include "webrtc/call/call.h"
|
||||
#include "webrtc/logging/rtc_event_log/rtc_event_log.h"
|
||||
#include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
@ -31,21 +30,6 @@
|
||||
namespace webrtc {
|
||||
|
||||
namespace {
|
||||
MediaType GetRuntimeMediaType(rtclog::MediaType media_type) {
|
||||
switch (media_type) {
|
||||
case rtclog::MediaType::ANY:
|
||||
return MediaType::ANY;
|
||||
case rtclog::MediaType::AUDIO:
|
||||
return MediaType::AUDIO;
|
||||
case rtclog::MediaType::VIDEO:
|
||||
return MediaType::VIDEO;
|
||||
case rtclog::MediaType::DATA:
|
||||
return MediaType::DATA;
|
||||
}
|
||||
RTC_NOTREACHED();
|
||||
return MediaType::ANY;
|
||||
}
|
||||
|
||||
RtcpMode GetRuntimeRtcpMode(rtclog::VideoReceiveConfig::RtcpMode rtcp_mode) {
|
||||
switch (rtcp_mode) {
|
||||
case rtclog::VideoReceiveConfig::RTCP_COMPOUND:
|
||||
@ -179,7 +163,8 @@ bool ParsedRtcEventLog::ParseStream(std::istream& stream) {
|
||||
|
||||
// Read the next message tag. The tag number is defined as
|
||||
// (fieldnumber << 3) | wire_type. In our case, the field number is
|
||||
// supposed to be 1 and the wire type for an length-delimited field is 2.
|
||||
// supposed to be 1 and the wire type for an
|
||||
// length-delimited field is 2.
|
||||
const uint64_t kExpectedTag = (1 << 3) | 2;
|
||||
std::tie(tag, success) = ParseVarInt(stream);
|
||||
if (!success) {
|
||||
@ -213,6 +198,48 @@ bool ParsedRtcEventLog::ParseStream(std::istream& stream) {
|
||||
LOG(LS_WARNING) << "Failed to parse protobuf message.";
|
||||
return false;
|
||||
}
|
||||
|
||||
EventType type = GetRuntimeEventType(event.type());
|
||||
switch (type) {
|
||||
case VIDEO_RECEIVER_CONFIG_EVENT: {
|
||||
rtclog::StreamConfig config;
|
||||
GetVideoReceiveConfig(event, &config);
|
||||
streams_.emplace_back(config.remote_ssrc, MediaType::VIDEO,
|
||||
kIncomingPacket);
|
||||
streams_.emplace_back(config.local_ssrc, MediaType::VIDEO,
|
||||
kOutgoingPacket);
|
||||
break;
|
||||
}
|
||||
case VIDEO_SENDER_CONFIG_EVENT: {
|
||||
rtclog::StreamConfig config;
|
||||
GetVideoSendConfig(event, &config);
|
||||
streams_.emplace_back(config.local_ssrc, MediaType::VIDEO,
|
||||
kOutgoingPacket);
|
||||
|
||||
streams_.emplace_back(config.rtx_ssrc, MediaType::VIDEO,
|
||||
kOutgoingPacket);
|
||||
break;
|
||||
}
|
||||
case AUDIO_RECEIVER_CONFIG_EVENT: {
|
||||
rtclog::StreamConfig config;
|
||||
GetAudioReceiveConfig(event, &config);
|
||||
streams_.emplace_back(config.remote_ssrc, MediaType::AUDIO,
|
||||
kIncomingPacket);
|
||||
streams_.emplace_back(config.local_ssrc, MediaType::AUDIO,
|
||||
kOutgoingPacket);
|
||||
break;
|
||||
}
|
||||
case AUDIO_SENDER_CONFIG_EVENT: {
|
||||
rtclog::StreamConfig config;
|
||||
GetAudioSendConfig(event, &config);
|
||||
streams_.emplace_back(config.local_ssrc, MediaType::AUDIO,
|
||||
kOutgoingPacket);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
events_.push_back(event);
|
||||
}
|
||||
}
|
||||
@ -239,7 +266,6 @@ ParsedRtcEventLog::EventType ParsedRtcEventLog::GetEventType(
|
||||
// The header must have space for at least IP_PACKET_SIZE bytes.
|
||||
void ParsedRtcEventLog::GetRtpHeader(size_t index,
|
||||
PacketDirection* incoming,
|
||||
MediaType* media_type,
|
||||
uint8_t* header,
|
||||
size_t* header_length,
|
||||
size_t* total_length) const {
|
||||
@ -254,11 +280,6 @@ void ParsedRtcEventLog::GetRtpHeader(size_t index,
|
||||
if (incoming != nullptr) {
|
||||
*incoming = rtp_packet.incoming() ? kIncomingPacket : kOutgoingPacket;
|
||||
}
|
||||
// Get media type.
|
||||
RTC_CHECK(rtp_packet.has_type());
|
||||
if (media_type != nullptr) {
|
||||
*media_type = GetRuntimeMediaType(rtp_packet.type());
|
||||
}
|
||||
// Get packet length.
|
||||
RTC_CHECK(rtp_packet.has_packet_length());
|
||||
if (total_length != nullptr) {
|
||||
@ -282,7 +303,6 @@ void ParsedRtcEventLog::GetRtpHeader(size_t index,
|
||||
// The packet must have space for at least IP_PACKET_SIZE bytes.
|
||||
void ParsedRtcEventLog::GetRtcpPacket(size_t index,
|
||||
PacketDirection* incoming,
|
||||
MediaType* media_type,
|
||||
uint8_t* packet,
|
||||
size_t* length) const {
|
||||
RTC_CHECK_LT(index, GetNumberOfEvents());
|
||||
@ -296,11 +316,6 @@ void ParsedRtcEventLog::GetRtcpPacket(size_t index,
|
||||
if (incoming != nullptr) {
|
||||
*incoming = rtcp_packet.incoming() ? kIncomingPacket : kOutgoingPacket;
|
||||
}
|
||||
// Get media type.
|
||||
RTC_CHECK(rtcp_packet.has_type());
|
||||
if (media_type != nullptr) {
|
||||
*media_type = GetRuntimeMediaType(rtcp_packet.type());
|
||||
}
|
||||
// Get packet length.
|
||||
RTC_CHECK(rtcp_packet.has_packet_data());
|
||||
if (length != nullptr) {
|
||||
@ -319,7 +334,12 @@ void ParsedRtcEventLog::GetVideoReceiveConfig(
|
||||
size_t index,
|
||||
rtclog::StreamConfig* config) const {
|
||||
RTC_CHECK_LT(index, GetNumberOfEvents());
|
||||
const rtclog::Event& event = events_[index];
|
||||
GetVideoReceiveConfig(events_[index], config);
|
||||
}
|
||||
|
||||
void ParsedRtcEventLog::GetVideoReceiveConfig(
|
||||
const rtclog::Event& event,
|
||||
rtclog::StreamConfig* config) const {
|
||||
RTC_CHECK(config != nullptr);
|
||||
RTC_CHECK(event.has_type());
|
||||
RTC_CHECK_EQ(event.type(), rtclog::Event::VIDEO_RECEIVER_CONFIG_EVENT);
|
||||
@ -381,7 +401,10 @@ void ParsedRtcEventLog::GetVideoReceiveConfig(
|
||||
void ParsedRtcEventLog::GetVideoSendConfig(size_t index,
|
||||
rtclog::StreamConfig* config) const {
|
||||
RTC_CHECK_LT(index, GetNumberOfEvents());
|
||||
const rtclog::Event& event = events_[index];
|
||||
GetVideoSendConfig(events_[index], config);
|
||||
}
|
||||
void ParsedRtcEventLog::GetVideoSendConfig(const rtclog::Event& event,
|
||||
rtclog::StreamConfig* config) const {
|
||||
RTC_CHECK(config != nullptr);
|
||||
RTC_CHECK(event.has_type());
|
||||
RTC_CHECK_EQ(event.type(), rtclog::Event::VIDEO_SENDER_CONFIG_EVENT);
|
||||
@ -419,7 +442,12 @@ void ParsedRtcEventLog::GetAudioReceiveConfig(
|
||||
size_t index,
|
||||
rtclog::StreamConfig* config) const {
|
||||
RTC_CHECK_LT(index, GetNumberOfEvents());
|
||||
const rtclog::Event& event = events_[index];
|
||||
GetAudioReceiveConfig(events_[index], config);
|
||||
}
|
||||
|
||||
void ParsedRtcEventLog::GetAudioReceiveConfig(
|
||||
const rtclog::Event& event,
|
||||
rtclog::StreamConfig* config) const {
|
||||
RTC_CHECK(config != nullptr);
|
||||
RTC_CHECK(event.has_type());
|
||||
RTC_CHECK_EQ(event.type(), rtclog::Event::AUDIO_RECEIVER_CONFIG_EVENT);
|
||||
@ -439,7 +467,11 @@ void ParsedRtcEventLog::GetAudioReceiveConfig(
|
||||
void ParsedRtcEventLog::GetAudioSendConfig(size_t index,
|
||||
rtclog::StreamConfig* config) const {
|
||||
RTC_CHECK_LT(index, GetNumberOfEvents());
|
||||
const rtclog::Event& event = events_[index];
|
||||
GetAudioSendConfig(events_[index], config);
|
||||
}
|
||||
|
||||
void ParsedRtcEventLog::GetAudioSendConfig(const rtclog::Event& event,
|
||||
rtclog::StreamConfig* config) const {
|
||||
RTC_CHECK(config != nullptr);
|
||||
RTC_CHECK(event.has_type());
|
||||
RTC_CHECK_EQ(event.type(), rtclog::Event::AUDIO_SENDER_CONFIG_EVENT);
|
||||
@ -588,4 +620,16 @@ ParsedRtcEventLog::BweProbeResultEvent ParsedRtcEventLog::GetBweProbeResult(
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// Returns the MediaType for registered SSRCs. Search from the end to use last
|
||||
// registered types first.
|
||||
ParsedRtcEventLog::MediaType ParsedRtcEventLog::GetMediaType(
|
||||
uint32_t ssrc,
|
||||
PacketDirection direction) const {
|
||||
for (auto rit = streams_.rbegin(); rit != streams_.rend(); ++rit) {
|
||||
if (rit->ssrc == ssrc && rit->direction == direction)
|
||||
return rit->media_type;
|
||||
}
|
||||
return MediaType::ANY;
|
||||
}
|
||||
} // namespace webrtc
|
||||
|
||||
@ -74,6 +74,8 @@ class ParsedRtcEventLog {
|
||||
BWE_PROBE_RESULT_EVENT = 18
|
||||
};
|
||||
|
||||
enum class MediaType { ANY, AUDIO, VIDEO, DATA };
|
||||
|
||||
// Reads an RtcEventLog file and returns true if parsing was successful.
|
||||
bool ParseFile(const std::string& file_name);
|
||||
|
||||
@ -92,25 +94,23 @@ class ParsedRtcEventLog {
|
||||
// Reads the event type of the rtclog::Event at |index|.
|
||||
EventType GetEventType(size_t index) const;
|
||||
|
||||
// Reads the header, direction, media type, 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.
|
||||
// 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.
|
||||
void GetRtpHeader(size_t index,
|
||||
PacketDirection* incoming,
|
||||
MediaType* media_type,
|
||||
uint8_t* header,
|
||||
size_t* header_length,
|
||||
size_t* total_length) const;
|
||||
|
||||
// Reads packet, direction, media type and packet length from the RTCP event
|
||||
// at |index|, and stores the values in the corresponding output parameters.
|
||||
// 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,
|
||||
MediaType* media_type,
|
||||
uint8_t* packet,
|
||||
size_t* length) const;
|
||||
|
||||
@ -158,13 +158,36 @@ class ParsedRtcEventLog {
|
||||
void GetAudioNetworkAdaptation(size_t index,
|
||||
AudioEncoderRuntimeConfig* config) const;
|
||||
|
||||
ParsedRtcEventLog::BweProbeClusterCreatedEvent GetBweProbeClusterCreated(
|
||||
size_t index) const;
|
||||
BweProbeClusterCreatedEvent GetBweProbeClusterCreated(size_t index) const;
|
||||
|
||||
ParsedRtcEventLog::BweProbeResultEvent GetBweProbeResult(size_t index) const;
|
||||
BweProbeResultEvent GetBweProbeResult(size_t index) const;
|
||||
|
||||
MediaType GetMediaType(uint32_t ssrc, PacketDirection direction) const;
|
||||
|
||||
private:
|
||||
void GetVideoReceiveConfig(const rtclog::Event& event,
|
||||
rtclog::StreamConfig* config) const;
|
||||
void GetVideoSendConfig(const rtclog::Event& event,
|
||||
rtclog::StreamConfig* config) const;
|
||||
void GetAudioReceiveConfig(const rtclog::Event& event,
|
||||
rtclog::StreamConfig* config) const;
|
||||
void GetAudioSendConfig(const rtclog::Event& event,
|
||||
rtclog::StreamConfig* config) const;
|
||||
|
||||
std::vector<rtclog::Event> events_;
|
||||
|
||||
struct Stream {
|
||||
Stream(uint32_t ssrc,
|
||||
MediaType media_type,
|
||||
webrtc::PacketDirection direction)
|
||||
: ssrc(ssrc), media_type(media_type), direction(direction) {}
|
||||
uint32_t ssrc;
|
||||
MediaType media_type;
|
||||
webrtc::PacketDirection direction;
|
||||
};
|
||||
|
||||
// All configured streams found in the event log.
|
||||
std::vector<Stream> streams_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -306,13 +306,11 @@ void LogSessionAndReadBack(size_t rtp_count,
|
||||
for (size_t i = 1; i <= rtp_count; i++) {
|
||||
log_dumper->LogRtpHeader(
|
||||
(i % 2 == 0) ? kIncomingPacket : kOutgoingPacket,
|
||||
(i % 3 == 0) ? MediaType::AUDIO : MediaType::VIDEO,
|
||||
rtp_packets[i - 1].data(), rtp_packets[i - 1].size());
|
||||
fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000));
|
||||
if (i * rtcp_count >= rtcp_index * rtp_count) {
|
||||
log_dumper->LogRtcpPacket(
|
||||
(rtcp_index % 2 == 0) ? kIncomingPacket : kOutgoingPacket,
|
||||
rtcp_index % 3 == 0 ? MediaType::AUDIO : MediaType::VIDEO,
|
||||
rtcp_packets[rtcp_index - 1].data(),
|
||||
rtcp_packets[rtcp_index - 1].size());
|
||||
rtcp_index++;
|
||||
@ -368,7 +366,6 @@ void LogSessionAndReadBack(size_t rtp_count,
|
||||
RtcEventLogTestHelper::VerifyRtpEvent(
|
||||
parsed_log, event_index,
|
||||
(i % 2 == 0) ? kIncomingPacket : kOutgoingPacket,
|
||||
(i % 3 == 0) ? MediaType::AUDIO : MediaType::VIDEO,
|
||||
rtp_packets[i - 1].data(), rtp_packets[i - 1].headers_size(),
|
||||
rtp_packets[i - 1].size());
|
||||
event_index++;
|
||||
@ -376,7 +373,6 @@ void LogSessionAndReadBack(size_t rtp_count,
|
||||
RtcEventLogTestHelper::VerifyRtcpEvent(
|
||||
parsed_log, event_index,
|
||||
rtcp_index % 2 == 0 ? kIncomingPacket : kOutgoingPacket,
|
||||
rtcp_index % 3 == 0 ? MediaType::AUDIO : MediaType::VIDEO,
|
||||
rtcp_packets[rtcp_index - 1].data(),
|
||||
rtcp_packets[rtcp_index - 1].size());
|
||||
event_index++;
|
||||
@ -454,15 +450,15 @@ TEST(RtcEventLogTest, LogEventAndReadBack) {
|
||||
fake_clock.SetTimeMicros(prng.Rand<uint32_t>());
|
||||
std::unique_ptr<RtcEventLog> log_dumper(RtcEventLog::Create());
|
||||
|
||||
log_dumper->LogRtpHeader(kIncomingPacket, MediaType::VIDEO, rtp_packet.data(),
|
||||
log_dumper->LogRtpHeader(kIncomingPacket, rtp_packet.data(),
|
||||
rtp_packet.size());
|
||||
fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000));
|
||||
|
||||
log_dumper->StartLogging(temp_filename, 10000000);
|
||||
fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000));
|
||||
|
||||
log_dumper->LogRtcpPacket(kOutgoingPacket, MediaType::VIDEO,
|
||||
rtcp_packet.data(), rtcp_packet.size());
|
||||
log_dumper->LogRtcpPacket(kOutgoingPacket, rtcp_packet.data(),
|
||||
rtcp_packet.size());
|
||||
fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000));
|
||||
|
||||
log_dumper->StopLogging();
|
||||
@ -478,12 +474,11 @@ TEST(RtcEventLogTest, LogEventAndReadBack) {
|
||||
RtcEventLogTestHelper::VerifyLogStartEvent(parsed_log, 0);
|
||||
|
||||
RtcEventLogTestHelper::VerifyRtpEvent(
|
||||
parsed_log, 1, kIncomingPacket, MediaType::VIDEO, rtp_packet.data(),
|
||||
parsed_log, 1, kIncomingPacket, rtp_packet.data(),
|
||||
rtp_packet.headers_size(), rtp_packet.size());
|
||||
|
||||
RtcEventLogTestHelper::VerifyRtcpEvent(parsed_log, 2, kOutgoingPacket,
|
||||
MediaType::VIDEO, rtcp_packet.data(),
|
||||
rtcp_packet.size());
|
||||
RtcEventLogTestHelper::VerifyRtcpEvent(
|
||||
parsed_log, 2, kOutgoingPacket, rtcp_packet.data(), rtcp_packet.size());
|
||||
|
||||
RtcEventLogTestHelper::VerifyLogEndEvent(parsed_log, 3);
|
||||
|
||||
|
||||
@ -30,20 +30,6 @@
|
||||
namespace webrtc {
|
||||
|
||||
namespace {
|
||||
MediaType GetRuntimeMediaType(rtclog::MediaType media_type) {
|
||||
switch (media_type) {
|
||||
case rtclog::MediaType::ANY:
|
||||
return MediaType::ANY;
|
||||
case rtclog::MediaType::AUDIO:
|
||||
return MediaType::AUDIO;
|
||||
case rtclog::MediaType::VIDEO:
|
||||
return MediaType::VIDEO;
|
||||
case rtclog::MediaType::DATA:
|
||||
return MediaType::DATA;
|
||||
}
|
||||
RTC_NOTREACHED();
|
||||
return MediaType::ANY;
|
||||
}
|
||||
|
||||
BandwidthUsage GetRuntimeDetectorState(
|
||||
rtclog::DelayBasedBweUpdate::DetectorState detector_state) {
|
||||
@ -367,7 +353,6 @@ void RtcEventLogTestHelper::VerifyAudioSendStreamConfig(
|
||||
void RtcEventLogTestHelper::VerifyRtpEvent(const ParsedRtcEventLog& parsed_log,
|
||||
size_t index,
|
||||
PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* header,
|
||||
size_t header_size,
|
||||
size_t total_size) {
|
||||
@ -377,8 +362,6 @@ void RtcEventLogTestHelper::VerifyRtpEvent(const ParsedRtcEventLog& parsed_log,
|
||||
const rtclog::RtpPacket& rtp_packet = event.rtp_packet();
|
||||
ASSERT_TRUE(rtp_packet.has_incoming());
|
||||
EXPECT_EQ(direction == kIncomingPacket, rtp_packet.incoming());
|
||||
ASSERT_TRUE(rtp_packet.has_type());
|
||||
EXPECT_EQ(media_type, GetRuntimeMediaType(rtp_packet.type()));
|
||||
ASSERT_TRUE(rtp_packet.has_packet_length());
|
||||
EXPECT_EQ(total_size, rtp_packet.packet_length());
|
||||
ASSERT_TRUE(rtp_packet.has_header());
|
||||
@ -389,14 +372,11 @@ void RtcEventLogTestHelper::VerifyRtpEvent(const ParsedRtcEventLog& parsed_log,
|
||||
|
||||
// Check consistency of the parser.
|
||||
PacketDirection parsed_direction;
|
||||
MediaType parsed_media_type;
|
||||
uint8_t parsed_header[1500];
|
||||
size_t parsed_header_size, parsed_total_size;
|
||||
parsed_log.GetRtpHeader(index, &parsed_direction, &parsed_media_type,
|
||||
parsed_header, &parsed_header_size,
|
||||
&parsed_total_size);
|
||||
parsed_log.GetRtpHeader(index, &parsed_direction, parsed_header,
|
||||
&parsed_header_size, &parsed_total_size);
|
||||
EXPECT_EQ(direction, parsed_direction);
|
||||
EXPECT_EQ(media_type, parsed_media_type);
|
||||
ASSERT_EQ(header_size, parsed_header_size);
|
||||
EXPECT_EQ(0, std::memcmp(header, parsed_header, header_size));
|
||||
EXPECT_EQ(total_size, parsed_total_size);
|
||||
@ -405,7 +385,6 @@ void RtcEventLogTestHelper::VerifyRtpEvent(const ParsedRtcEventLog& parsed_log,
|
||||
void RtcEventLogTestHelper::VerifyRtcpEvent(const ParsedRtcEventLog& parsed_log,
|
||||
size_t index,
|
||||
PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* packet,
|
||||
size_t total_size) {
|
||||
const rtclog::Event& event = parsed_log.events_[index];
|
||||
@ -414,8 +393,6 @@ void RtcEventLogTestHelper::VerifyRtcpEvent(const ParsedRtcEventLog& parsed_log,
|
||||
const rtclog::RtcpPacket& rtcp_packet = event.rtcp_packet();
|
||||
ASSERT_TRUE(rtcp_packet.has_incoming());
|
||||
EXPECT_EQ(direction == kIncomingPacket, rtcp_packet.incoming());
|
||||
ASSERT_TRUE(rtcp_packet.has_type());
|
||||
EXPECT_EQ(media_type, GetRuntimeMediaType(rtcp_packet.type()));
|
||||
ASSERT_TRUE(rtcp_packet.has_packet_data());
|
||||
ASSERT_EQ(total_size, rtcp_packet.packet_data().size());
|
||||
for (size_t i = 0; i < total_size; i++) {
|
||||
@ -424,13 +401,11 @@ void RtcEventLogTestHelper::VerifyRtcpEvent(const ParsedRtcEventLog& parsed_log,
|
||||
|
||||
// Check consistency of the parser.
|
||||
PacketDirection parsed_direction;
|
||||
MediaType parsed_media_type;
|
||||
uint8_t parsed_packet[1500];
|
||||
size_t parsed_total_size;
|
||||
parsed_log.GetRtcpPacket(index, &parsed_direction, &parsed_media_type,
|
||||
parsed_packet, &parsed_total_size);
|
||||
parsed_log.GetRtcpPacket(index, &parsed_direction, parsed_packet,
|
||||
&parsed_total_size);
|
||||
EXPECT_EQ(direction, parsed_direction);
|
||||
EXPECT_EQ(media_type, parsed_media_type);
|
||||
ASSERT_EQ(total_size, parsed_total_size);
|
||||
EXPECT_EQ(0, std::memcmp(packet, parsed_packet, total_size));
|
||||
}
|
||||
|
||||
@ -35,14 +35,12 @@ class RtcEventLogTestHelper {
|
||||
static void VerifyRtpEvent(const ParsedRtcEventLog& parsed_log,
|
||||
size_t index,
|
||||
PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* header,
|
||||
size_t header_size,
|
||||
size_t total_size);
|
||||
static void VerifyRtcpEvent(const ParsedRtcEventLog& parsed_log,
|
||||
size_t index,
|
||||
PacketDirection direction,
|
||||
MediaType media_type,
|
||||
const uint8_t* packet,
|
||||
size_t total_size);
|
||||
static void VerifyPlayoutEvent(const ParsedRtcEventLog& parsed_log,
|
||||
|
||||
@ -39,38 +39,45 @@ bool RtcEventLogSource::RegisterRtpHeaderExtension(RTPExtensionType type,
|
||||
}
|
||||
|
||||
std::unique_ptr<Packet> RtcEventLogSource::NextPacket() {
|
||||
while (rtp_packet_index_ < parsed_stream_.GetNumberOfEvents()) {
|
||||
for (; rtp_packet_index_ < parsed_stream_.GetNumberOfEvents();
|
||||
rtp_packet_index_++) {
|
||||
if (parsed_stream_.GetEventType(rtp_packet_index_) ==
|
||||
ParsedRtcEventLog::RTP_EVENT) {
|
||||
PacketDirection direction;
|
||||
MediaType media_type;
|
||||
size_t header_length;
|
||||
size_t packet_length;
|
||||
uint64_t timestamp_us = parsed_stream_.GetTimestamp(rtp_packet_index_);
|
||||
parsed_stream_.GetRtpHeader(rtp_packet_index_, &direction, &media_type,
|
||||
nullptr, &header_length, &packet_length);
|
||||
if (direction == kIncomingPacket && media_type == MediaType::AUDIO) {
|
||||
uint8_t* packet_header = new uint8_t[header_length];
|
||||
parsed_stream_.GetRtpHeader(rtp_packet_index_, nullptr, nullptr,
|
||||
packet_header, nullptr, nullptr);
|
||||
std::unique_ptr<Packet> packet(new Packet(
|
||||
packet_header, header_length, packet_length,
|
||||
static_cast<double>(timestamp_us) / 1000, *parser_.get()));
|
||||
if (packet->valid_header()) {
|
||||
// Check if the packet should not be filtered out.
|
||||
if (!filter_.test(packet->header().payloadType) &&
|
||||
!(use_ssrc_filter_ && packet->header().ssrc != ssrc_)) {
|
||||
rtp_packet_index_++;
|
||||
return packet;
|
||||
}
|
||||
} else {
|
||||
std::cout << "Warning: Packet with index " << rtp_packet_index_
|
||||
<< " has an invalid header and will be ignored."
|
||||
<< std::endl;
|
||||
}
|
||||
parsed_stream_.GetRtpHeader(rtp_packet_index_, &direction, nullptr,
|
||||
&header_length, &packet_length);
|
||||
|
||||
if (direction != kIncomingPacket) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uint8_t* packet_header = new uint8_t[header_length];
|
||||
parsed_stream_.GetRtpHeader(rtp_packet_index_, nullptr, packet_header,
|
||||
nullptr, nullptr);
|
||||
std::unique_ptr<Packet> packet(
|
||||
new Packet(packet_header, header_length, packet_length,
|
||||
static_cast<double>(timestamp_us) / 1000, *parser_.get()));
|
||||
|
||||
if (!packet->valid_header()) {
|
||||
std::cout << "Warning: Packet with index " << rtp_packet_index_
|
||||
<< " has an invalid header and will be ignored." << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (parsed_stream_.GetMediaType(packet->header().ssrc, direction) !=
|
||||
webrtc::ParsedRtcEventLog::MediaType::AUDIO) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if the packet should not be filtered out.
|
||||
if (!filter_.test(packet->header().payloadType) &&
|
||||
!(use_ssrc_filter_ && packet->header().ssrc != ssrc_)) {
|
||||
return packet;
|
||||
}
|
||||
}
|
||||
rtp_packet_index_++;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -86,6 +86,7 @@ if (rtc_include_tests) {
|
||||
deps = [
|
||||
":congestion_controller",
|
||||
":mock_congestion_controller",
|
||||
"../../base:rtc_base",
|
||||
"../../base:rtc_base_approved",
|
||||
"../../system_wrappers:system_wrappers",
|
||||
"../../test:field_trial",
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
|
||||
#include "webrtc/base/socket.h"
|
||||
#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
|
||||
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
|
||||
#include "webrtc/modules/congestion_controller/congestion_controller_unittests_helper.h"
|
||||
@ -16,6 +17,7 @@
|
||||
#include "webrtc/modules/pacing/mock/mock_paced_sender.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_observer.h"
|
||||
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
|
||||
#include "webrtc/system_wrappers/include/clock.h"
|
||||
#include "webrtc/test/gmock.h"
|
||||
|
||||
@ -100,8 +100,7 @@ class PacketContainer : public rtcp::CompoundPacket,
|
||||
if (transport_->SendRtcp(data, length)) {
|
||||
bytes_sent_ += length;
|
||||
if (event_log_) {
|
||||
event_log_->LogRtcpPacket(kOutgoingPacket, MediaType::ANY, data,
|
||||
length);
|
||||
event_log_->LogRtcpPacket(kOutgoingPacket, data, length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -987,8 +986,7 @@ bool RTCPSender::SendFeedbackPacket(const rtcp::TransportFeedback& packet) {
|
||||
void OnPacketReady(uint8_t* data, size_t length) override {
|
||||
if (transport_->SendRtcp(data, length)) {
|
||||
if (event_log_) {
|
||||
event_log_->LogRtcpPacket(kOutgoingPacket, MediaType::ANY, data,
|
||||
length);
|
||||
event_log_->LogRtcpPacket(kOutgoingPacket, data, length);
|
||||
}
|
||||
} else {
|
||||
send_failure_ = true;
|
||||
|
||||
@ -631,8 +631,8 @@ bool RTPSender::SendPacketToNetwork(const RtpPacketToSend& packet,
|
||||
? static_cast<int>(packet.size())
|
||||
: -1;
|
||||
if (event_log_ && bytes_sent > 0) {
|
||||
event_log_->LogRtpHeader(kOutgoingPacket, MediaType::ANY, packet.data(),
|
||||
packet.size(), pacing_info.probe_cluster_id);
|
||||
event_log_->LogRtpHeader(kOutgoingPacket, packet.data(), packet.size(),
|
||||
pacing_info.probe_cluster_id);
|
||||
}
|
||||
}
|
||||
TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"),
|
||||
|
||||
@ -464,7 +464,7 @@ TEST_P(RtpSenderTest, TrafficSmoothingWithExtensions) {
|
||||
EXPECT_CALL(mock_paced_sender_, InsertPacket(RtpPacketSender::kNormalPriority,
|
||||
kSsrc, kSeqNum, _, _, _));
|
||||
EXPECT_CALL(mock_rtc_event_log_,
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _, _));
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _));
|
||||
|
||||
rtp_sender_->SetStorePacketsStatus(true, 10);
|
||||
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
|
||||
@ -509,7 +509,7 @@ TEST_P(RtpSenderTest, TrafficSmoothingRetransmits) {
|
||||
EXPECT_CALL(mock_paced_sender_, InsertPacket(RtpPacketSender::kNormalPriority,
|
||||
kSsrc, kSeqNum, _, _, _));
|
||||
EXPECT_CALL(mock_rtc_event_log_,
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _, _));
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _));
|
||||
|
||||
rtp_sender_->SetStorePacketsStatus(true, 10);
|
||||
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
|
||||
@ -563,7 +563,7 @@ TEST_P(RtpSenderTest, SendPadding) {
|
||||
EXPECT_CALL(mock_paced_sender_, InsertPacket(RtpPacketSender::kNormalPriority,
|
||||
kSsrc, kSeqNum, _, _, _));
|
||||
EXPECT_CALL(mock_rtc_event_log_,
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _, _))
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _))
|
||||
.Times(1 + 4 + 1);
|
||||
|
||||
uint16_t seq_num = kSeqNum;
|
||||
@ -764,7 +764,7 @@ TEST_P(RtpSenderTest, SendRedundantPayloads) {
|
||||
InsertPacket(RtpPacketSender::kNormalPriority, kSsrc, _, _, _, _))
|
||||
.Times(kNumPayloadSizes);
|
||||
EXPECT_CALL(mock_rtc_event_log_,
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _, _))
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _))
|
||||
.Times(kNumPayloadSizes);
|
||||
|
||||
// Send 10 packets of increasing size.
|
||||
@ -778,7 +778,7 @@ TEST_P(RtpSenderTest, SendRedundantPayloads) {
|
||||
}
|
||||
|
||||
EXPECT_CALL(mock_rtc_event_log_,
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _, _))
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _))
|
||||
.Times(::testing::AtLeast(4));
|
||||
|
||||
// The amount of padding to send it too small to send a payload packet.
|
||||
@ -875,7 +875,7 @@ TEST_P(RtpSenderTest, SendFlexfecPackets) {
|
||||
.WillOnce(testing::SaveArg<2>(&flexfec_seq_num));
|
||||
SendGenericPayload();
|
||||
EXPECT_CALL(mock_rtc_event_log_,
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _, _))
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _))
|
||||
.Times(2);
|
||||
EXPECT_TRUE(rtp_sender_->TimeToSendPacket(kMediaSsrc, kSeqNum,
|
||||
fake_clock_.TimeInMilliseconds(),
|
||||
@ -923,7 +923,7 @@ TEST_P(RtpSenderTestWithoutPacer, SendFlexfecPackets) {
|
||||
rtp_sender_->SetFecParameters(params, params);
|
||||
|
||||
EXPECT_CALL(mock_rtc_event_log_,
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _, _))
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _))
|
||||
.Times(2);
|
||||
SendGenericPayload();
|
||||
ASSERT_EQ(2, transport_.packets_sent());
|
||||
|
||||
@ -373,9 +373,8 @@ EventLogAnalyzer::EventLogAnalyzer(const ParsedRtcEventLog& log)
|
||||
break;
|
||||
}
|
||||
case ParsedRtcEventLog::RTP_EVENT: {
|
||||
MediaType media_type;
|
||||
parsed_log_.GetRtpHeader(i, &direction, &media_type, header,
|
||||
&header_length, &total_length);
|
||||
parsed_log_.GetRtpHeader(i, &direction, header, &header_length,
|
||||
&total_length);
|
||||
// Parse header to get SSRC.
|
||||
RtpUtility::RtpHeaderParser rtp_parser(header, header_length);
|
||||
RTPHeader parsed_header;
|
||||
@ -399,9 +398,7 @@ EventLogAnalyzer::EventLogAnalyzer(const ParsedRtcEventLog& log)
|
||||
}
|
||||
case ParsedRtcEventLog::RTCP_EVENT: {
|
||||
uint8_t packet[IP_PACKET_SIZE];
|
||||
MediaType media_type;
|
||||
parsed_log_.GetRtcpPacket(i, &direction, &media_type, packet,
|
||||
&total_length);
|
||||
parsed_log_.GetRtcpPacket(i, &direction, packet, &total_length);
|
||||
// Currently incoming RTCP packets are logged twice, both for audio and
|
||||
// video. Only act on one of them. Compare against the previous parsed
|
||||
// incoming RTCP packet.
|
||||
@ -905,8 +902,7 @@ void EventLogAnalyzer::CreateTotalBitrateGraph(
|
||||
for (size_t i = 0; i < parsed_log_.GetNumberOfEvents(); i++) {
|
||||
ParsedRtcEventLog::EventType event_type = parsed_log_.GetEventType(i);
|
||||
if (event_type == ParsedRtcEventLog::RTP_EVENT) {
|
||||
parsed_log_.GetRtpHeader(i, &direction, nullptr, nullptr, nullptr,
|
||||
&total_length);
|
||||
parsed_log_.GetRtpHeader(i, &direction, nullptr, nullptr, &total_length);
|
||||
if (direction == desired_direction) {
|
||||
uint64_t timestamp = parsed_log_.GetTimestamp(i);
|
||||
packets.push_back(TimestampSize(timestamp, total_length));
|
||||
|
||||
@ -101,32 +101,28 @@ class RtcEventLogProxy final : public webrtc::RtcEventLog {
|
||||
}
|
||||
|
||||
void LogRtpHeader(webrtc::PacketDirection direction,
|
||||
webrtc::MediaType media_type,
|
||||
const uint8_t* header,
|
||||
size_t packet_length) override {
|
||||
LogRtpHeader(direction, media_type, header, packet_length,
|
||||
PacedPacketInfo::kNotAProbe);
|
||||
LogRtpHeader(direction, header, packet_length, PacedPacketInfo::kNotAProbe);
|
||||
}
|
||||
|
||||
void LogRtpHeader(webrtc::PacketDirection direction,
|
||||
webrtc::MediaType media_type,
|
||||
const uint8_t* header,
|
||||
size_t packet_length,
|
||||
int probe_cluster_id) override {
|
||||
rtc::CritScope lock(&crit_);
|
||||
if (event_log_) {
|
||||
event_log_->LogRtpHeader(direction, media_type, header, packet_length,
|
||||
event_log_->LogRtpHeader(direction, header, packet_length,
|
||||
probe_cluster_id);
|
||||
}
|
||||
}
|
||||
|
||||
void LogRtcpPacket(webrtc::PacketDirection direction,
|
||||
webrtc::MediaType media_type,
|
||||
const uint8_t* packet,
|
||||
size_t length) override {
|
||||
rtc::CritScope lock(&crit_);
|
||||
if (event_log_) {
|
||||
event_log_->LogRtcpPacket(direction, media_type, packet, length);
|
||||
event_log_->LogRtcpPacket(direction, packet, length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user