From c3d2bfd2443a55f22d84f15f5f64e2ea80daba19 Mon Sep 17 00:00:00 2001 From: terelius Date: Tue, 12 Sep 2017 05:57:36 -0700 Subject: [PATCH] Remove no- prefix from command line flags in rtc_event_log2text and rtc_event_log2rtp_dump and negate their meaning. BUG=webrtc:8202 Review-Url: https://codereview.webrtc.org/3008113002 Cr-Commit-Position: refs/heads/master@{#19798} --- .../rtc_event_log/rtc_event_log2rtp_dump.cc | 54 ++++++++++--------- .../rtc_event_log/rtc_event_log2text.cc | 41 +++++++------- 2 files changed, 49 insertions(+), 46 deletions(-) diff --git a/webrtc/logging/rtc_event_log/rtc_event_log2rtp_dump.cc b/webrtc/logging/rtc_event_log/rtc_event_log2rtp_dump.cc index 4275e5933f..06b250dbbd 100644 --- a/webrtc/logging/rtc_event_log/rtc_event_log2rtp_dump.cc +++ b/webrtc/logging/rtc_event_log/rtc_event_log2rtp_dump.cc @@ -27,21 +27,26 @@ namespace { using MediaType = webrtc::ParsedRtcEventLog::MediaType; -DEFINE_bool(noaudio, - false, - "Excludes audio packets from the converted RTPdump file."); -DEFINE_bool(novideo, - false, - "Excludes video packets from the converted RTPdump file."); -DEFINE_bool(nodata, - false, - "Excludes data packets from the converted RTPdump file."); -DEFINE_bool(nortp, - false, - "Excludes RTP packets from the converted RTPdump file."); -DEFINE_bool(nortcp, - false, - "Excludes RTCP packets from the converted RTPdump file."); +DEFINE_bool( + audio, + true, + "Use --noaudio to exclude audio packets from the converted RTPdump file."); +DEFINE_bool( + video, + true, + "Use --novideo to exclude video packets from the converted RTPdump file."); +DEFINE_bool( + data, + true, + "Use --nodata to exclude data packets from the converted RTPdump file."); +DEFINE_bool( + rtp, + true, + "Use --nortp to exclude RTP packets from the converted RTPdump file."); +DEFINE_bool( + rtcp, + true, + "Use --nortcp to exclude RTCP packets from the converted RTPdump file."); DEFINE_string(ssrc, "", "Store only packets with this SSRC (decimal or hex, the latter " @@ -122,7 +127,7 @@ int main(int argc, char* argv[]) { // some required fields and we attempt to access them. We could consider // a softer failure option, but it does not seem useful to generate // RTP dumps based on broken event logs. - if (!FLAG_nortp && + if (FLAG_rtp && parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::RTP_EVENT) { webrtc::test::RtpPacket packet; webrtc::PacketDirection direction; @@ -143,11 +148,11 @@ int main(int argc, char* argv[]) { rtp_parser.Parse(&parsed_header); MediaType media_type = parsed_stream.GetMediaType(parsed_header.ssrc, direction); - if (FLAG_noaudio && media_type == MediaType::AUDIO) + if (!FLAG_audio && media_type == MediaType::AUDIO) continue; - if (FLAG_novideo && media_type == MediaType::VIDEO) + if (!FLAG_video && media_type == MediaType::VIDEO) continue; - if (FLAG_nodata && media_type == MediaType::DATA) + if (!FLAG_data && media_type == MediaType::DATA) continue; if (strlen(FLAG_ssrc) > 0) { const uint32_t packet_ssrc = @@ -160,9 +165,8 @@ int main(int argc, char* argv[]) { rtp_writer->WritePacket(&packet); rtp_counter++; } - if (!FLAG_nortcp && - parsed_stream.GetEventType(i) == - webrtc::ParsedRtcEventLog::RTCP_EVENT) { + if (FLAG_rtcp && parsed_stream.GetEventType(i) == + webrtc::ParsedRtcEventLog::RTCP_EVENT) { webrtc::test::RtpPacket packet; webrtc::PacketDirection direction; parsed_stream.GetRtcpPacket(i, &direction, packet.data, &packet.length); @@ -181,11 +185,11 @@ int main(int argc, char* argv[]) { const uint32_t packet_ssrc = webrtc::ByteReader::ReadBigEndian( reinterpret_cast(packet.data + 4)); MediaType media_type = parsed_stream.GetMediaType(packet_ssrc, direction); - if (FLAG_noaudio && media_type == MediaType::AUDIO) + if (!FLAG_audio && media_type == MediaType::AUDIO) continue; - if (FLAG_novideo && media_type == MediaType::VIDEO) + if (!FLAG_video && media_type == MediaType::VIDEO) continue; - if (FLAG_nodata && media_type == MediaType::DATA) + if (!FLAG_data && media_type == MediaType::DATA) continue; if (strlen(FLAG_ssrc) > 0) { if (packet_ssrc != ssrc_filter) diff --git a/webrtc/logging/rtc_event_log/rtc_event_log2text.cc b/webrtc/logging/rtc_event_log/rtc_event_log2text.cc index bba6aceee8..0f9d674ece 100644 --- a/webrtc/logging/rtc_event_log/rtc_event_log2text.cc +++ b/webrtc/logging/rtc_event_log/rtc_event_log2text.cc @@ -40,17 +40,17 @@ namespace { -DEFINE_bool(noconfig, false, "Excludes stream configurations."); -DEFINE_bool(noincoming, false, "Excludes incoming packets."); -DEFINE_bool(nooutgoing, false, "Excludes outgoing packets."); +DEFINE_bool(config, true, "Use --noconfig to exclude stream configurations."); +DEFINE_bool(incoming, true, "Use --noincoming to exclude incoming packets."); +DEFINE_bool(outgoing, true, "Use --nooutgoing to exclude packets."); // TODO(terelius): Note that the media type doesn't work with outgoing packets. -DEFINE_bool(noaudio, false, "Excludes audio packets."); +DEFINE_bool(audio, true, "Use --noaudio to exclude audio packets."); // TODO(terelius): Note that the media type doesn't work with outgoing packets. -DEFINE_bool(novideo, false, "Excludes video packets."); +DEFINE_bool(video, true, "Use --novideo to exclude video packets."); // TODO(terelius): Note that the media type doesn't work with outgoing packets. -DEFINE_bool(nodata, false, "Excludes data packets."); -DEFINE_bool(nortp, false, "Excludes RTP packets."); -DEFINE_bool(nortcp, false, "Excludes RTCP packets."); +DEFINE_bool(data, true, "Use --nodata to exclude data packets."); +DEFINE_bool(rtp, true, "Use --nortp to exclude RTP packets."); +DEFINE_bool(rtcp, true, "Use --nortcp to exclude RTCP packets."); // TODO(terelius): Allow a list of SSRCs. DEFINE_string(ssrc, "", @@ -84,15 +84,15 @@ bool ParseSsrc(std::string str) { bool ExcludePacket(webrtc::PacketDirection direction, MediaType media_type, uint32_t packet_ssrc) { - if (FLAG_nooutgoing && direction == webrtc::kOutgoingPacket) + if (!FLAG_outgoing && direction == webrtc::kOutgoingPacket) return true; - if (FLAG_noincoming && direction == webrtc::kIncomingPacket) + if (!FLAG_incoming && direction == webrtc::kIncomingPacket) return true; - if (FLAG_noaudio && media_type == MediaType::AUDIO) + if (!FLAG_audio && media_type == MediaType::AUDIO) return true; - if (FLAG_novideo && media_type == MediaType::VIDEO) + if (!FLAG_video && media_type == MediaType::VIDEO) return true; - if (FLAG_nodata && media_type == MediaType::DATA) + if (!FLAG_data && media_type == MediaType::DATA) return true; if (strlen(FLAG_ssrc) > 0 && packet_ssrc != filtered_ssrc) return true; @@ -386,7 +386,7 @@ int main(int argc, char* argv[]) { } for (size_t i = 0; i < parsed_stream.GetNumberOfEvents(); i++) { - if (!FLAG_noconfig && !FLAG_novideo && !FLAG_noincoming && + if (FLAG_config && FLAG_video && FLAG_incoming && parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT) { webrtc::rtclog::StreamConfig config = @@ -407,7 +407,7 @@ int main(int argc, char* argv[]) { } std::cout << "}" << std::endl; } - if (!FLAG_noconfig && !FLAG_novideo && !FLAG_nooutgoing && + if (FLAG_config && FLAG_video && FLAG_outgoing && parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT) { std::vector configs = @@ -430,7 +430,7 @@ int main(int argc, char* argv[]) { std::cout << "}" << std::endl; } } - if (!FLAG_noconfig && !FLAG_noaudio && !FLAG_noincoming && + if (FLAG_config && FLAG_audio && FLAG_incoming && parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT) { webrtc::rtclog::StreamConfig config = @@ -451,7 +451,7 @@ int main(int argc, char* argv[]) { } std::cout << "}" << std::endl; } - if (!FLAG_noconfig && !FLAG_noaudio && !FLAG_nooutgoing && + if (FLAG_config && FLAG_audio && FLAG_outgoing && parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT) { webrtc::rtclog::StreamConfig config = parsed_stream.GetAudioSendConfig(i); @@ -470,7 +470,7 @@ int main(int argc, char* argv[]) { } std::cout << "}" << std::endl; } - if (!FLAG_nortp && + if (FLAG_rtp && parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::RTP_EVENT) { size_t header_length; size_t total_length; @@ -521,9 +521,8 @@ int main(int argc, char* argv[]) { } std::cout << std::endl; } - if (!FLAG_nortcp && - parsed_stream.GetEventType(i) == - webrtc::ParsedRtcEventLog::RTCP_EVENT) { + if (FLAG_rtcp && parsed_stream.GetEventType(i) == + webrtc::ParsedRtcEventLog::RTCP_EVENT) { size_t length; uint8_t packet[IP_PACKET_SIZE]; webrtc::PacketDirection direction;