 Chromium Code Reviews
 Chromium Code Reviews Issue 2855143002:
  Removed RtcEventLog deps to call:call_interfaces.  (Closed)
    
  
    Issue 2855143002:
  Removed RtcEventLog deps to call:call_interfaces.  (Closed) 
  | Index: webrtc/logging/rtc_event_log/rtc_event_log2text.cc | 
| diff --git a/webrtc/logging/rtc_event_log/rtc_event_log2text.cc b/webrtc/logging/rtc_event_log/rtc_event_log2text.cc | 
| index fab04c9c5751c3883e22169c9d788d5a52a66334..6d38e5b2ce0fbabfc079c3feb37dc57332e7fe68 100644 | 
| --- a/webrtc/logging/rtc_event_log/rtc_event_log2text.cc | 
| +++ b/webrtc/logging/rtc_event_log/rtc_event_log2text.cc | 
| @@ -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)."); | 
| +enum class MediaType { ANY, AUDIO, VIDEO, DATA }; | 
| + | 
| static uint32_t filtered_ssrc = 0; | 
| // Parses the input string for a valid SSRC. If a valid SSRC is found, it is | 
| @@ -75,12 +76,10 @@ bool ParseSsrc(std::string str) { | 
| // Struct used for storing SSRCs used in a Stream. | 
| struct Stream { | 
| - Stream(uint32_t ssrc, | 
| - webrtc::MediaType media_type, | 
| - webrtc::PacketDirection direction) | 
| + Stream(uint32_t ssrc, MediaType media_type, webrtc::PacketDirection direction) | 
| : ssrc(ssrc), media_type(media_type), direction(direction) {} | 
| uint32_t ssrc; | 
| - webrtc::MediaType media_type; | 
| + MediaType media_type; | 
| webrtc::PacketDirection direction; | 
| }; | 
| @@ -89,28 +88,27 @@ 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) { | 
| +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; | 
| + return 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 +116,23 @@ bool ExcludePacket(webrtc::PacketDirection direction, | 
| } | 
| const char* StreamInfo(webrtc::PacketDirection direction, | 
| 
terelius
2017/05/23 11:57:58
This could be a toString() on the Stream object.
 
perkj_webrtc
2017/05/24 12:32:21
Prefer not to. I moved the Stream into the parser.
 | 
| - 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)"; | 
| @@ -148,7 +146,7 @@ void PrintSenderReport(const webrtc::rtcp::CommonHeader& rtcp_block, | 
| webrtc::rtcp::SenderReport sr; | 
| if (!sr.Parse(rtcp_block)) | 
| return; | 
| - webrtc::MediaType media_type = GetMediaType(sr.sender_ssrc(), direction); | 
| + MediaType media_type = GetMediaType(sr.sender_ssrc(), direction); | 
| if (ExcludePacket(direction, media_type, sr.sender_ssrc())) | 
| return; | 
| std::cout << log_timestamp << "\t" | 
| @@ -163,7 +161,7 @@ void PrintReceiverReport(const webrtc::rtcp::CommonHeader& rtcp_block, | 
| webrtc::rtcp::ReceiverReport rr; | 
| if (!rr.Parse(rtcp_block)) | 
| return; | 
| - webrtc::MediaType media_type = GetMediaType(rr.sender_ssrc(), direction); | 
| + MediaType media_type = GetMediaType(rr.sender_ssrc(), direction); | 
| if (ExcludePacket(direction, media_type, rr.sender_ssrc())) | 
| return; | 
| std::cout << log_timestamp << "\t" | 
| @@ -177,7 +175,7 @@ void PrintXr(const webrtc::rtcp::CommonHeader& rtcp_block, | 
| webrtc::rtcp::ExtendedReports xr; | 
| if (!xr.Parse(rtcp_block)) | 
| return; | 
| - webrtc::MediaType media_type = GetMediaType(xr.sender_ssrc(), direction); | 
| + MediaType media_type = GetMediaType(xr.sender_ssrc(), direction); | 
| if (ExcludePacket(direction, media_type, xr.sender_ssrc())) | 
| return; | 
| std::cout << log_timestamp << "\t" | 
| @@ -189,7 +187,7 @@ 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"; | 
| } | 
| @@ -200,7 +198,7 @@ void PrintBye(const webrtc::rtcp::CommonHeader& rtcp_block, | 
| webrtc::rtcp::Bye bye; | 
| if (!bye.Parse(rtcp_block)) | 
| return; | 
| - webrtc::MediaType media_type = GetMediaType(bye.sender_ssrc(), direction); | 
| + MediaType media_type = GetMediaType(bye.sender_ssrc(), direction); | 
| if (ExcludePacket(direction, media_type, bye.sender_ssrc())) | 
| return; | 
| std::cout << log_timestamp << "\t" | 
| @@ -216,8 +214,7 @@ 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 = GetMediaType(nack.sender_ssrc(), direction); | 
| if (ExcludePacket(direction, media_type, nack.sender_ssrc())) | 
| return; | 
| std::cout << log_timestamp << "\t" | 
| @@ -229,8 +226,7 @@ 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 = GetMediaType(tmmbr.sender_ssrc(), direction); | 
| if (ExcludePacket(direction, media_type, tmmbr.sender_ssrc())) | 
| return; | 
| std::cout << log_timestamp << "\t" | 
| @@ -242,8 +238,7 @@ 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 = GetMediaType(tmmbn.sender_ssrc(), direction); | 
| if (ExcludePacket(direction, media_type, tmmbn.sender_ssrc())) | 
| return; | 
| std::cout << log_timestamp << "\t" | 
| @@ -255,8 +250,7 @@ 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 = GetMediaType(sr_req.sender_ssrc(), direction); | 
| if (ExcludePacket(direction, media_type, sr_req.sender_ssrc())) | 
| return; | 
| std::cout << log_timestamp << "\t" | 
| @@ -268,7 +262,7 @@ void PrintRtpFeedback(const webrtc::rtcp::CommonHeader& rtcp_block, | 
| webrtc::rtcp::TransportFeedback transport_feedback; | 
| if (!transport_feedback.Parse(rtcp_block)) | 
| return; | 
| - webrtc::MediaType media_type = | 
| + MediaType media_type = | 
| GetMediaType(transport_feedback.sender_ssrc(), direction); | 
| if (ExcludePacket(direction, media_type, | 
| transport_feedback.sender_ssrc())) | 
| @@ -291,7 +285,7 @@ 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 = GetMediaType(pli.sender_ssrc(), direction); | 
| if (ExcludePacket(direction, media_type, pli.sender_ssrc())) | 
| return; | 
| std::cout << log_timestamp << "\t" | 
| @@ -303,7 +297,7 @@ 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 = GetMediaType(fir.sender_ssrc(), direction); | 
| if (ExcludePacket(direction, media_type, fir.sender_ssrc())) | 
| return; | 
| std::cout << log_timestamp << "\t" | 
| @@ -315,8 +309,7 @@ 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 = GetMediaType(remb.sender_ssrc(), direction); | 
| if (ExcludePacket(direction, media_type, remb.sender_ssrc())) | 
| return; | 
| std::cout << log_timestamp << "\t" | 
| @@ -367,11 +360,9 @@ int main(int argc, char* argv[]) { | 
| webrtc::rtclog::StreamConfig config; | 
| parsed_stream.GetVideoReceiveConfig(i, &config); | 
| - global_streams.emplace_back(config.remote_ssrc, | 
| - webrtc::MediaType::VIDEO, | 
| + global_streams.emplace_back(config.remote_ssrc, MediaType::VIDEO, | 
| webrtc::kIncomingPacket); | 
| - global_streams.emplace_back(config.local_ssrc, | 
| - webrtc::MediaType::VIDEO, | 
| + global_streams.emplace_back(config.local_ssrc, MediaType::VIDEO, | 
| webrtc::kOutgoingPacket); | 
| if (!FLAGS_noconfig && !FLAGS_novideo && !FLAGS_noincoming) { | 
| @@ -384,10 +375,10 @@ int main(int argc, char* argv[]) { | 
| 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, | 
| + global_streams.emplace_back(config.local_ssrc, MediaType::VIDEO, | 
| webrtc::kOutgoingPacket); | 
| - global_streams.emplace_back(config.rtx_ssrc, webrtc::MediaType::VIDEO, | 
| + global_streams.emplace_back(config.rtx_ssrc, MediaType::VIDEO, | 
| webrtc::kOutgoingPacket); | 
| if (!FLAGS_noconfig && !FLAGS_novideo && !FLAGS_nooutgoing) { | 
| @@ -401,11 +392,9 @@ int main(int argc, char* argv[]) { | 
| 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, | 
| + global_streams.emplace_back(config.remote_ssrc, MediaType::AUDIO, | 
| webrtc::kIncomingPacket); | 
| - global_streams.emplace_back(config.local_ssrc, | 
| - webrtc::MediaType::AUDIO, | 
| + global_streams.emplace_back(config.local_ssrc, MediaType::AUDIO, | 
| webrtc::kOutgoingPacket); | 
| if (!FLAGS_noconfig && !FLAGS_noaudio && !FLAGS_noincoming) { | 
| std::cout << parsed_stream.GetTimestamp(i) << "\tAUDIO_RECV_CONFIG" | 
| @@ -417,7 +406,7 @@ int main(int argc, char* argv[]) { | 
| 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, | 
| + global_streams.emplace_back(config.local_ssrc, MediaType::AUDIO, | 
| webrtc::kOutgoingPacket); | 
| if (!FLAGS_noconfig && !FLAGS_noaudio && !FLAGS_nooutgoing) { | 
| std::cout << parsed_stream.GetTimestamp(i) << "\tAUDIO_SEND_CONFIG" | 
| @@ -430,15 +419,15 @@ 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 = GetMediaType(parsed_header.ssrc, direction); | 
| if (ExcludePacket(direction, media_type, parsed_header.ssrc)) | 
| continue; | 
| @@ -454,8 +443,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; |