Add option to bwe_rtp_to_text to output arrival times only in nanoseconds.
R=andresp@webrtc.org Review URL: https://webrtc-codereview.appspot.com/9459004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5665 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
a01daf0359
commit
f9e7c9d865
@ -33,17 +33,17 @@ bool ParseArgsAndSetupEstimator(int argc,
|
||||
std::string* estimator_used) {
|
||||
*rtp_reader = webrtc::rtpplayer::CreateRtpFileReader(argv[3]);
|
||||
if (!*rtp_reader) {
|
||||
printf("Cannot open input file %s\n", argv[3]);
|
||||
fprintf(stderr, "Cannot open input file %s\n", argv[3]);
|
||||
return false;
|
||||
}
|
||||
printf("Input file: %s\n\n", argv[3]);
|
||||
fprintf(stderr, "Input file: %s\n\n", argv[3]);
|
||||
webrtc::RTPExtensionType extension = webrtc::kRtpExtensionAbsoluteSendTime;
|
||||
|
||||
if (strncmp("tsoffset", argv[1], 8) == 0) {
|
||||
extension = webrtc::kRtpExtensionTransmissionTimeOffset;
|
||||
printf("Extension: toffset\n");
|
||||
fprintf(stderr, "Extension: toffset\n");
|
||||
} else {
|
||||
printf("Extension: abs\n");
|
||||
fprintf(stderr, "Extension: abs\n");
|
||||
}
|
||||
int id = atoi(argv[2]);
|
||||
|
||||
|
@ -20,13 +20,15 @@
|
||||
using webrtc::rtpplayer::RtpPacketSourceInterface;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (argc < 5) {
|
||||
printf("Usage: rtp_to_text <extension type> <extension id> <input_file.rtp>"
|
||||
" <output_file.rtp>\n");
|
||||
printf("<extension type> can either be:\n"
|
||||
if (argc < 4) {
|
||||
fprintf(stderr, "Usage: rtp_to_text <extension type> <extension id>"
|
||||
" <input_file.rtp> [-t]\n");
|
||||
fprintf(stderr, "<extension type> can either be:\n"
|
||||
" abs for absolute send time or\n"
|
||||
" tsoffset for timestamp offset.\n"
|
||||
"<extension id> is the id associated with the extension.\n");
|
||||
"<extension id> is the id associated with the extension.\n"
|
||||
" -t is an optional flag, if set only packet arrival time will be"
|
||||
" output.\n");
|
||||
return -1;
|
||||
}
|
||||
RtpPacketSourceInterface* reader;
|
||||
@ -35,15 +37,10 @@ int main(int argc, char** argv) {
|
||||
NULL, NULL)) {
|
||||
return -1;
|
||||
}
|
||||
bool arrival_time_only = (argc >= 5 && strncmp(argv[4], "-t", 2) == 0);
|
||||
webrtc::scoped_ptr<RtpPacketSourceInterface> rtp_reader(reader);
|
||||
webrtc::scoped_ptr<webrtc::RtpHeaderParser> rtp_parser(parser);
|
||||
|
||||
FILE* out_file = fopen(argv[4], "wt");
|
||||
if (!out_file)
|
||||
printf("Cannot open output file %s\n", argv[4]);
|
||||
|
||||
printf("Output file: %s\n\n", argv[4]);
|
||||
fprintf(out_file, "seqnum timestamp ts_offset abs_sendtime recvtime "
|
||||
fprintf(stdout, "seqnum timestamp ts_offset abs_sendtime recvtime "
|
||||
"markerbit ssrc size\n");
|
||||
int packet_counter = 0;
|
||||
static const uint32_t kMaxPacketSize = 1500;
|
||||
@ -60,17 +57,21 @@ int main(int argc, char** argv) {
|
||||
++non_zero_abs_send_time;
|
||||
if (header.extension.transmissionTimeOffset != 0)
|
||||
++non_zero_ts_offsets;
|
||||
fprintf(out_file, "%u %u %d %u %u %d %u %u\n", header.sequenceNumber,
|
||||
header.timestamp, header.extension.transmissionTimeOffset,
|
||||
header.extension.absoluteSendTime, time_ms, header.markerBit,
|
||||
header.ssrc, packet_length);
|
||||
if (arrival_time_only) {
|
||||
fprintf(stdout, "%ld\n", static_cast<int64_t>(time_ms) * 1000000);
|
||||
} else {
|
||||
fprintf(stdout, "%u %u %d %u %u %d %u %u\n", header.sequenceNumber,
|
||||
header.timestamp, header.extension.transmissionTimeOffset,
|
||||
header.extension.absoluteSendTime, time_ms, header.markerBit,
|
||||
header.ssrc, packet_length);
|
||||
}
|
||||
packet_length = kMaxPacketSize;
|
||||
++packet_counter;
|
||||
}
|
||||
printf("Parsed %d packets\n", packet_counter);
|
||||
printf("Packets with non-zero absolute send time: %d\n",
|
||||
fprintf(stderr, "Parsed %d packets\n", packet_counter);
|
||||
fprintf(stderr, "Packets with non-zero absolute send time: %d\n",
|
||||
non_zero_abs_send_time);
|
||||
printf("Packets with non-zero timestamp offset: %d\n",
|
||||
fprintf(stderr, "Packets with non-zero timestamp offset: %d\n",
|
||||
non_zero_ts_offsets);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user