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

Unified Diff: webrtc/logging/rtc_event_log/rtc_event_log2rtp_dump.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/BUILD.gn ('k') | webrtc/logging/rtc_event_log/rtc_event_log2text.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/logging/rtc_event_log/rtc_event_log2rtp_dump.cc
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 2336caa284435afcc91df10bdddd952f8f8b9d9d..7b00c080cd7c0845b2d12e05cd5291011ed5d9e3 100644
--- a/webrtc/logging/rtc_event_log/rtc_event_log2rtp_dump.cc
+++ b/webrtc/logging/rtc_event_log/rtc_event_log2rtp_dump.cc
@@ -13,8 +13,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/logging/rtc_event_log/rtc_event_log.h"
#include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h"
@@ -42,6 +42,7 @@ DEFINE_string(ssrc,
"",
"Store only packets with this SSRC (decimal or hex, the latter "
"starting with 0x).");
+DEFINE_bool(help, false, "prints this message");
// Parses the input string for a valid SSRC. If a valid SSRC is found, it is
// written to the output variable |ssrc|, and true is returned. Otherwise,
@@ -67,26 +68,28 @@ bool ParseSsrc(std::string str, uint32_t* ssrc) {
// This utility will convert a stored event log to the rtpdump format.
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 != 3) {
+ std::cout <<
"Tool for converting an RtcEventLog file to an RTP dump file.\n"
"Run " +
program_name +
- " --helpshort for usage.\n"
+ " --help for usage.\n"
"Example usage:\n" +
program_name + " input.rel output.rtp\n";
- google::SetUsageMessage(usage);
- google::ParseCommandLineFlags(&argc, &argv, true);
-
- if (argc != 3) {
- std::cout << google::ProgramUsage();
return 0;
}
std::string input_file = argv[1];
std::string output_file = argv[2];
uint32_t ssrc_filter = 0;
- if (!FLAGS_ssrc.empty())
- RTC_CHECK(ParseSsrc(FLAGS_ssrc, &ssrc_filter))
+ if (FLAG_ssrc)
+ RTC_CHECK(ParseSsrc(FLAG_ssrc, &ssrc_filter))
<< "Flag verification has failed.";
webrtc::ParsedRtcEventLog parsed_stream;
@@ -114,7 +117,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 (!FLAGS_nortp &&
+ if (!FLAG_nortp &&
parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::RTP_EVENT) {
webrtc::test::RtpPacket packet;
webrtc::PacketDirection direction;
@@ -128,13 +131,13 @@ 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)
+ if (FLAG_noaudio && media_type == webrtc::MediaType::AUDIO)
continue;
- if (FLAGS_novideo && media_type == webrtc::MediaType::VIDEO)
+ if (FLAG_novideo && media_type == webrtc::MediaType::VIDEO)
continue;
- if (FLAGS_nodata && media_type == webrtc::MediaType::DATA)
+ if (FLAG_nodata && media_type == webrtc::MediaType::DATA)
continue;
- if (!FLAGS_ssrc.empty()) {
+ if (FLAG_ssrc) {
const uint32_t packet_ssrc =
webrtc::ByteReader<uint32_t>::ReadBigEndian(
reinterpret_cast<const uint8_t*>(packet.data + 8));
@@ -145,7 +148,7 @@ int main(int argc, char* argv[]) {
rtp_writer->WritePacket(&packet);
rtp_counter++;
}
- if (!FLAGS_nortcp &&
+ if (!FLAG_nortcp &&
parsed_stream.GetEventType(i) ==
webrtc::ParsedRtcEventLog::RTCP_EVENT) {
webrtc::test::RtpPacket packet;
@@ -161,13 +164,13 @@ 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)
+ if (FLAG_noaudio && media_type == webrtc::MediaType::AUDIO)
continue;
- if (FLAGS_novideo && media_type == webrtc::MediaType::VIDEO)
+ if (FLAG_novideo && media_type == webrtc::MediaType::VIDEO)
continue;
- if (FLAGS_nodata && media_type == webrtc::MediaType::DATA)
+ if (FLAG_nodata && media_type == webrtc::MediaType::DATA)
continue;
- if (!FLAGS_ssrc.empty()) {
+ if (FLAG_ssrc) {
const uint32_t packet_ssrc =
webrtc::ByteReader<uint32_t>::ReadBigEndian(
reinterpret_cast<const uint8_t*>(packet.data + 4));
« no previous file with comments | « webrtc/logging/BUILD.gn ('k') | webrtc/logging/rtc_event_log/rtc_event_log2text.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698