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

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

Issue 3005483002: Replace remaining gflags usages with rtc_base/flags (Closed)
Patch Set: Rebase Created 3 years, 4 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_log2stats.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 23d69416e72b63718946976cd0fc3ed1e2bfb745..4275e5933ffe5e17af6b7705e0e84da6c13791d3 100644
--- a/webrtc/logging/rtc_event_log/rtc_event_log2rtp_dump.cc
+++ b/webrtc/logging/rtc_event_log/rtc_event_log2rtp_dump.cc
@@ -8,17 +8,19 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <string.h>
+
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
-#include "gflags/gflags.h"
#include "webrtc/logging/rtc_event_log/rtc_event_log.h"
#include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
#include "webrtc/rtc_base/checks.h"
+#include "webrtc/rtc_base/flags.h"
#include "webrtc/test/rtp_file_writer.h"
namespace {
@@ -44,6 +46,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,
@@ -73,22 +76,25 @@ int main(int argc, char* argv[]) {
"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;
+ if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true) ||
+ FLAG_help || argc != 3) {
+ std::cout << usage;
+ if (FLAG_help) {
+ rtc::FlagList::Print(nullptr, false);
+ return 0;
+ }
+ return 1;
}
+
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 (strlen(FLAG_ssrc) > 0)
+ RTC_CHECK(ParseSsrc(FLAG_ssrc, &ssrc_filter))
<< "Flag verification has failed.";
webrtc::ParsedRtcEventLog parsed_stream;
@@ -116,7 +122,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;
@@ -137,13 +143,13 @@ int main(int argc, char* argv[]) {
rtp_parser.Parse(&parsed_header);
MediaType media_type =
parsed_stream.GetMediaType(parsed_header.ssrc, direction);
- if (FLAGS_noaudio && media_type == MediaType::AUDIO)
+ if (FLAG_noaudio && media_type == MediaType::AUDIO)
continue;
- if (FLAGS_novideo && media_type == MediaType::VIDEO)
+ if (FLAG_novideo && media_type == MediaType::VIDEO)
continue;
- if (FLAGS_nodata && media_type == MediaType::DATA)
+ if (FLAG_nodata && media_type == MediaType::DATA)
continue;
- if (!FLAGS_ssrc.empty()) {
+ if (strlen(FLAG_ssrc) > 0) {
const uint32_t packet_ssrc =
webrtc::ByteReader<uint32_t>::ReadBigEndian(
reinterpret_cast<const uint8_t*>(packet.data + 8));
@@ -154,7 +160,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;
@@ -175,13 +181,13 @@ int main(int argc, char* argv[]) {
const uint32_t packet_ssrc = webrtc::ByteReader<uint32_t>::ReadBigEndian(
reinterpret_cast<const uint8_t*>(packet.data + 4));
MediaType media_type = parsed_stream.GetMediaType(packet_ssrc, direction);
- if (FLAGS_noaudio && media_type == MediaType::AUDIO)
+ if (FLAG_noaudio && media_type == MediaType::AUDIO)
continue;
- if (FLAGS_novideo && media_type == MediaType::VIDEO)
+ if (FLAG_novideo && media_type == MediaType::VIDEO)
continue;
- if (FLAGS_nodata && media_type == MediaType::DATA)
+ if (FLAG_nodata && media_type == MediaType::DATA)
continue;
- if (!FLAGS_ssrc.empty()) {
+ if (strlen(FLAG_ssrc) > 0) {
if (packet_ssrc != ssrc_filter)
continue;
}
« no previous file with comments | « webrtc/logging/BUILD.gn ('k') | webrtc/logging/rtc_event_log/rtc_event_log2stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698