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}
This commit is contained in:
terelius
2017-09-12 05:57:36 -07:00
committed by Commit Bot
parent 661d94996b
commit c3d2bfd244
2 changed files with 49 additions and 46 deletions

View File

@ -27,21 +27,26 @@ namespace {
using MediaType = webrtc::ParsedRtcEventLog::MediaType; using MediaType = webrtc::ParsedRtcEventLog::MediaType;
DEFINE_bool(noaudio, DEFINE_bool(
false, audio,
"Excludes audio packets from the converted RTPdump file."); true,
DEFINE_bool(novideo, "Use --noaudio to exclude audio packets from the converted RTPdump file.");
false, DEFINE_bool(
"Excludes video packets from the converted RTPdump file."); video,
DEFINE_bool(nodata, true,
false, "Use --novideo to exclude video packets from the converted RTPdump file.");
"Excludes data packets from the converted RTPdump file."); DEFINE_bool(
DEFINE_bool(nortp, data,
false, true,
"Excludes RTP packets from the converted RTPdump file."); "Use --nodata to exclude data packets from the converted RTPdump file.");
DEFINE_bool(nortcp, DEFINE_bool(
false, rtp,
"Excludes RTCP packets from the converted RTPdump file."); 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, DEFINE_string(ssrc,
"", "",
"Store only packets with this SSRC (decimal or hex, the latter " "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 // some required fields and we attempt to access them. We could consider
// a softer failure option, but it does not seem useful to generate // a softer failure option, but it does not seem useful to generate
// RTP dumps based on broken event logs. // RTP dumps based on broken event logs.
if (!FLAG_nortp && if (FLAG_rtp &&
parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::RTP_EVENT) { parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::RTP_EVENT) {
webrtc::test::RtpPacket packet; webrtc::test::RtpPacket packet;
webrtc::PacketDirection direction; webrtc::PacketDirection direction;
@ -143,11 +148,11 @@ int main(int argc, char* argv[]) {
rtp_parser.Parse(&parsed_header); rtp_parser.Parse(&parsed_header);
MediaType media_type = MediaType media_type =
parsed_stream.GetMediaType(parsed_header.ssrc, direction); parsed_stream.GetMediaType(parsed_header.ssrc, direction);
if (FLAG_noaudio && media_type == MediaType::AUDIO) if (!FLAG_audio && media_type == MediaType::AUDIO)
continue; continue;
if (FLAG_novideo && media_type == MediaType::VIDEO) if (!FLAG_video && media_type == MediaType::VIDEO)
continue; continue;
if (FLAG_nodata && media_type == MediaType::DATA) if (!FLAG_data && media_type == MediaType::DATA)
continue; continue;
if (strlen(FLAG_ssrc) > 0) { if (strlen(FLAG_ssrc) > 0) {
const uint32_t packet_ssrc = const uint32_t packet_ssrc =
@ -160,8 +165,7 @@ int main(int argc, char* argv[]) {
rtp_writer->WritePacket(&packet); rtp_writer->WritePacket(&packet);
rtp_counter++; rtp_counter++;
} }
if (!FLAG_nortcp && if (FLAG_rtcp && parsed_stream.GetEventType(i) ==
parsed_stream.GetEventType(i) ==
webrtc::ParsedRtcEventLog::RTCP_EVENT) { webrtc::ParsedRtcEventLog::RTCP_EVENT) {
webrtc::test::RtpPacket packet; webrtc::test::RtpPacket packet;
webrtc::PacketDirection direction; webrtc::PacketDirection direction;
@ -181,11 +185,11 @@ int main(int argc, char* argv[]) {
const uint32_t packet_ssrc = webrtc::ByteReader<uint32_t>::ReadBigEndian( const uint32_t packet_ssrc = webrtc::ByteReader<uint32_t>::ReadBigEndian(
reinterpret_cast<const uint8_t*>(packet.data + 4)); reinterpret_cast<const uint8_t*>(packet.data + 4));
MediaType media_type = parsed_stream.GetMediaType(packet_ssrc, direction); MediaType media_type = parsed_stream.GetMediaType(packet_ssrc, direction);
if (FLAG_noaudio && media_type == MediaType::AUDIO) if (!FLAG_audio && media_type == MediaType::AUDIO)
continue; continue;
if (FLAG_novideo && media_type == MediaType::VIDEO) if (!FLAG_video && media_type == MediaType::VIDEO)
continue; continue;
if (FLAG_nodata && media_type == MediaType::DATA) if (!FLAG_data && media_type == MediaType::DATA)
continue; continue;
if (strlen(FLAG_ssrc) > 0) { if (strlen(FLAG_ssrc) > 0) {
if (packet_ssrc != ssrc_filter) if (packet_ssrc != ssrc_filter)

View File

@ -40,17 +40,17 @@
namespace { namespace {
DEFINE_bool(noconfig, false, "Excludes stream configurations."); DEFINE_bool(config, true, "Use --noconfig to exclude stream configurations.");
DEFINE_bool(noincoming, false, "Excludes incoming packets."); DEFINE_bool(incoming, true, "Use --noincoming to exclude incoming packets.");
DEFINE_bool(nooutgoing, false, "Excludes outgoing packets."); DEFINE_bool(outgoing, true, "Use --nooutgoing to exclude packets.");
// TODO(terelius): Note that the media type doesn't work with outgoing 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. // 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. // TODO(terelius): Note that the media type doesn't work with outgoing packets.
DEFINE_bool(nodata, false, "Excludes data packets."); DEFINE_bool(data, true, "Use --nodata to exclude data packets.");
DEFINE_bool(nortp, false, "Excludes RTP packets."); DEFINE_bool(rtp, true, "Use --nortp to exclude RTP packets.");
DEFINE_bool(nortcp, false, "Excludes RTCP packets."); DEFINE_bool(rtcp, true, "Use --nortcp to exclude RTCP packets.");
// TODO(terelius): Allow a list of SSRCs. // TODO(terelius): Allow a list of SSRCs.
DEFINE_string(ssrc, DEFINE_string(ssrc,
"", "",
@ -84,15 +84,15 @@ bool ParseSsrc(std::string str) {
bool ExcludePacket(webrtc::PacketDirection direction, bool ExcludePacket(webrtc::PacketDirection direction,
MediaType media_type, MediaType media_type,
uint32_t packet_ssrc) { uint32_t packet_ssrc) {
if (FLAG_nooutgoing && direction == webrtc::kOutgoingPacket) if (!FLAG_outgoing && direction == webrtc::kOutgoingPacket)
return true; return true;
if (FLAG_noincoming && direction == webrtc::kIncomingPacket) if (!FLAG_incoming && direction == webrtc::kIncomingPacket)
return true; return true;
if (FLAG_noaudio && media_type == MediaType::AUDIO) if (!FLAG_audio && media_type == MediaType::AUDIO)
return true; return true;
if (FLAG_novideo && media_type == MediaType::VIDEO) if (!FLAG_video && media_type == MediaType::VIDEO)
return true; return true;
if (FLAG_nodata && media_type == MediaType::DATA) if (!FLAG_data && media_type == MediaType::DATA)
return true; return true;
if (strlen(FLAG_ssrc) > 0 && packet_ssrc != filtered_ssrc) if (strlen(FLAG_ssrc) > 0 && packet_ssrc != filtered_ssrc)
return true; return true;
@ -386,7 +386,7 @@ int main(int argc, char* argv[]) {
} }
for (size_t i = 0; i < parsed_stream.GetNumberOfEvents(); i++) { 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) == parsed_stream.GetEventType(i) ==
webrtc::ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT) { webrtc::ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT) {
webrtc::rtclog::StreamConfig config = webrtc::rtclog::StreamConfig config =
@ -407,7 +407,7 @@ int main(int argc, char* argv[]) {
} }
std::cout << "}" << std::endl; std::cout << "}" << std::endl;
} }
if (!FLAG_noconfig && !FLAG_novideo && !FLAG_nooutgoing && if (FLAG_config && FLAG_video && FLAG_outgoing &&
parsed_stream.GetEventType(i) == parsed_stream.GetEventType(i) ==
webrtc::ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT) { webrtc::ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT) {
std::vector<webrtc::rtclog::StreamConfig> configs = std::vector<webrtc::rtclog::StreamConfig> configs =
@ -430,7 +430,7 @@ int main(int argc, char* argv[]) {
std::cout << "}" << std::endl; std::cout << "}" << std::endl;
} }
} }
if (!FLAG_noconfig && !FLAG_noaudio && !FLAG_noincoming && if (FLAG_config && FLAG_audio && FLAG_incoming &&
parsed_stream.GetEventType(i) == parsed_stream.GetEventType(i) ==
webrtc::ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT) { webrtc::ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT) {
webrtc::rtclog::StreamConfig config = webrtc::rtclog::StreamConfig config =
@ -451,7 +451,7 @@ int main(int argc, char* argv[]) {
} }
std::cout << "}" << std::endl; std::cout << "}" << std::endl;
} }
if (!FLAG_noconfig && !FLAG_noaudio && !FLAG_nooutgoing && if (FLAG_config && FLAG_audio && FLAG_outgoing &&
parsed_stream.GetEventType(i) == parsed_stream.GetEventType(i) ==
webrtc::ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT) { webrtc::ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT) {
webrtc::rtclog::StreamConfig config = parsed_stream.GetAudioSendConfig(i); webrtc::rtclog::StreamConfig config = parsed_stream.GetAudioSendConfig(i);
@ -470,7 +470,7 @@ int main(int argc, char* argv[]) {
} }
std::cout << "}" << std::endl; std::cout << "}" << std::endl;
} }
if (!FLAG_nortp && if (FLAG_rtp &&
parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::RTP_EVENT) { parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::RTP_EVENT) {
size_t header_length; size_t header_length;
size_t total_length; size_t total_length;
@ -521,8 +521,7 @@ int main(int argc, char* argv[]) {
} }
std::cout << std::endl; std::cout << std::endl;
} }
if (!FLAG_nortcp && if (FLAG_rtcp && parsed_stream.GetEventType(i) ==
parsed_stream.GetEventType(i) ==
webrtc::ParsedRtcEventLog::RTCP_EVENT) { webrtc::ParsedRtcEventLog::RTCP_EVENT) {
size_t length; size_t length;
uint8_t packet[IP_PACKET_SIZE]; uint8_t packet[IP_PACKET_SIZE];