Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(779)

Unified Diff: webrtc/logging/rtc_event_log/rtc_event_log2text.cc

Issue 2887433004: Remove gflags dependency for rtc_event_log2text and rtc_event_log2rtp_dump (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/logging/rtc_event_log/rtc_event_log2rtp_dump.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b2d537e3b3b0cb2a67158e89038a9126385e9825..1eb5a5c86ec0e5bc2ef1287b40756d266a09b51e 100644
--- a/webrtc/logging/rtc_event_log/rtc_event_log2text.cc
+++ b/webrtc/logging/rtc_event_log/rtc_event_log2text.cc
@@ -12,8 +12,8 @@
#include <sstream>
#include <string>
-#include "gflags/gflags.h"
#include "webrtc/base/checks.h"
+#include "webrtc/base/flags.h"
#include "webrtc/call/call.h"
#include "webrtc/common_types.h"
#include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h"
@@ -51,6 +51,7 @@ DEFINE_string(ssrc,
"",
"Print only packets with this SSRC (decimal or hex, the latter "
"starting with 0x).");
+DEFINE_bool(help, false, "prints this message");
static uint32_t filtered_ssrc = 0;
@@ -76,17 +77,17 @@ bool ParseSsrc(std::string str) {
bool ExcludePacket(webrtc::PacketDirection direction,
webrtc::MediaType media_type,
uint32_t packet_ssrc) {
- if (FLAGS_nooutgoing && direction == webrtc::kOutgoingPacket)
+ if (FLAG_nooutgoing && direction == webrtc::kOutgoingPacket)
return true;
- if (FLAGS_noincoming && direction == webrtc::kIncomingPacket)
+ if (FLAG_noincoming && direction == webrtc::kIncomingPacket)
return true;
- if (FLAGS_noaudio && media_type == webrtc::MediaType::AUDIO)
+ if (FLAG_noaudio && media_type == webrtc::MediaType::AUDIO)
return true;
- if (FLAGS_novideo && media_type == webrtc::MediaType::VIDEO)
+ if (FLAG_novideo && media_type == webrtc::MediaType::VIDEO)
return true;
- if (FLAGS_nodata && media_type == webrtc::MediaType::DATA)
+ if (FLAG_nodata && media_type == webrtc::MediaType::DATA)
return true;
- if (!FLAGS_ssrc.empty() && packet_ssrc != filtered_ssrc)
+ if (FLAG_ssrc && packet_ssrc != filtered_ssrc)
return true;
return false;
}
@@ -298,24 +299,26 @@ void PrintPsFeedback(const webrtc::rtcp::CommonHeader& rtcp_block,
// fields and we attempt to access them. We don't handle this at the moment.
int main(int argc, char* argv[]) {
std::string program_name = argv[0];
- std::string usage =
+ rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
+ if (FLAG_help) {
+ rtc::FlagList::Print(nullptr, false);
+ return 0;
+ }
+
+ if (argc != 2) {
+ std::cout <<
"Tool for printing packet information from an RtcEventLog as text.\n"
"Run " +
program_name +
- " --helpshort for usage.\n"
+ " --help for usage.\n"
"Example usage:\n" +
program_name + " input.rel\n";
- google::SetUsageMessage(usage);
- google::ParseCommandLineFlags(&argc, &argv, true);
-
- if (argc != 2) {
- std::cout << google::ProgramUsage();
return 0;
}
std::string input_file = argv[1];
- if (!FLAGS_ssrc.empty())
- RTC_CHECK(ParseSsrc(FLAGS_ssrc)) << "Flag verification has failed.";
+ if (FLAG_ssrc)
+ RTC_CHECK(ParseSsrc(FLAG_ssrc)) << "Flag verification has failed.";
webrtc::ParsedRtcEventLog parsed_stream;
if (!parsed_stream.ParseFile(input_file)) {
@@ -324,7 +327,7 @@ int main(int argc, char* argv[]) {
}
for (size_t i = 0; i < parsed_stream.GetNumberOfEvents(); i++) {
- if (!FLAGS_noconfig && !FLAGS_novideo && !FLAGS_noincoming &&
+ if (!FLAG_noconfig && !FLAG_novideo && !FLAG_noincoming &&
parsed_stream.GetEventType(i) ==
webrtc::ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT) {
webrtc::VideoReceiveStream::Config config(nullptr);
@@ -333,7 +336,7 @@ int main(int argc, char* argv[]) {
<< "\tssrc=" << config.rtp.remote_ssrc
<< "\tfeedback_ssrc=" << config.rtp.local_ssrc << std::endl;
}
- if (!FLAGS_noconfig && !FLAGS_novideo && !FLAGS_nooutgoing &&
+ if (!FLAG_noconfig && !FLAG_novideo && !FLAG_nooutgoing &&
parsed_stream.GetEventType(i) ==
webrtc::ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT) {
webrtc::VideoSendStream::Config config(nullptr);
@@ -347,7 +350,7 @@ int main(int argc, char* argv[]) {
std::cout << ssrc << ',';
std::cout << std::endl;
}
- if (!FLAGS_noconfig && !FLAGS_noaudio && !FLAGS_noincoming &&
+ if (!FLAG_noconfig && !FLAG_noaudio && !FLAG_noincoming &&
parsed_stream.GetEventType(i) ==
webrtc::ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT) {
webrtc::AudioReceiveStream::Config config;
@@ -356,7 +359,7 @@ int main(int argc, char* argv[]) {
<< "\tssrc=" << config.rtp.remote_ssrc
<< "\tfeedback_ssrc=" << config.rtp.local_ssrc << std::endl;
}
- if (!FLAGS_noconfig && !FLAGS_noaudio && !FLAGS_nooutgoing &&
+ if (!FLAG_noconfig && !FLAG_noaudio && !FLAG_nooutgoing &&
parsed_stream.GetEventType(i) ==
webrtc::ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT) {
webrtc::AudioSendStream::Config config(nullptr);
@@ -364,7 +367,7 @@ int main(int argc, char* argv[]) {
std::cout << parsed_stream.GetTimestamp(i) << "\tAUDIO_SEND_CONFIG"
<< "\tssrc=" << config.rtp.ssrc << std::endl;
}
- if (!FLAGS_nortp &&
+ if (!FLAG_nortp &&
parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::RTP_EVENT) {
size_t header_length;
size_t total_length;
@@ -387,7 +390,7 @@ int main(int argc, char* argv[]) {
<< "\tssrc=" << parsed_header.ssrc
<< "\ttimestamp=" << parsed_header.timestamp << std::endl;
}
- if (!FLAGS_nortcp &&
+ if (!FLAG_nortcp &&
parsed_stream.GetEventType(i) ==
webrtc::ParsedRtcEventLog::RTCP_EVENT) {
size_t length;
« no previous file with comments | « webrtc/logging/rtc_event_log/rtc_event_log2rtp_dump.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698