diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /third_party/libwebrtc/modules/remote_bitrate_estimator/tools/rtp_to_text.cc | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/modules/remote_bitrate_estimator/tools/rtp_to_text.cc')
-rw-r--r-- | third_party/libwebrtc/modules/remote_bitrate_estimator/tools/rtp_to_text.cc | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/third_party/libwebrtc/modules/remote_bitrate_estimator/tools/rtp_to_text.cc b/third_party/libwebrtc/modules/remote_bitrate_estimator/tools/rtp_to_text.cc new file mode 100644 index 0000000000..e8dc59f740 --- /dev/null +++ b/third_party/libwebrtc/modules/remote_bitrate_estimator/tools/rtp_to_text.cc @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#include <stdio.h> + +#include <memory> + +#include "modules/remote_bitrate_estimator/tools/bwe_rtp.h" +#include "modules/rtp_rtcp/include/rtp_header_extension_map.h" +#include "modules/rtp_rtcp/source/rtp_header_extensions.h" +#include "modules/rtp_rtcp/source/rtp_packet.h" +#include "rtc_base/strings/string_builder.h" +#include "test/rtp_file_reader.h" + +int main(int argc, char* argv[]) { + std::unique_ptr<webrtc::test::RtpFileReader> reader; + webrtc::RtpHeaderExtensionMap rtp_header_extensions; + if (!ParseArgsAndSetupRtpReader(argc, argv, reader, rtp_header_extensions)) { + return -1; + } + + bool arrival_time_only = (argc >= 5 && strncmp(argv[4], "-t", 2) == 0); + + fprintf(stdout, + "seqnum timestamp ts_offset abs_sendtime recvtime " + "markerbit ssrc size original_size\n"); + int packet_counter = 0; + int non_zero_abs_send_time = 0; + int non_zero_ts_offsets = 0; + webrtc::test::RtpPacket packet; + while (reader->NextPacket(&packet)) { + webrtc::RtpPacket header(&rtp_header_extensions); + header.Parse(packet.data, packet.length); + uint32_t abs_send_time = 0; + if (header.GetExtension<webrtc::AbsoluteSendTime>(&abs_send_time) && + abs_send_time != 0) + ++non_zero_abs_send_time; + int32_t toffset = 0; + if (header.GetExtension<webrtc::TransmissionOffset>(&toffset) && + toffset != 0) + ++non_zero_ts_offsets; + if (arrival_time_only) { + rtc::StringBuilder ss; + ss << static_cast<int64_t>(packet.time_ms) * 1000000; + fprintf(stdout, "%s\n", ss.str().c_str()); + } else { + fprintf(stdout, "%u %u %d %u %u %d %u %zu %zu\n", header.SequenceNumber(), + header.Timestamp(), toffset, abs_send_time, packet.time_ms, + header.Marker(), header.Ssrc(), packet.length, + packet.original_length); + } + ++packet_counter; + } + fprintf(stderr, "Parsed %d packets\n", packet_counter); + fprintf(stderr, "Packets with non-zero absolute send time: %d\n", + non_zero_abs_send_time); + fprintf(stderr, "Packets with non-zero timestamp offset: %d\n", + non_zero_ts_offsets); + return 0; +} |