Add support for parsing header only RTP dumps with bwe_rtp_play.
Also adds support for printing the original_length in rtp_to_text. R=henrik.lundin@webrtc.org Review URL: https://webrtc-codereview.appspot.com/32289004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7812 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
9f79fe684a
commit
0b38478885
@ -62,47 +62,60 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
// Process the file.
|
// Process the file.
|
||||||
int packet_counter = 0;
|
int packet_counter = 0;
|
||||||
int64_t next_process_time_ms = 0;
|
|
||||||
int64_t next_rtp_time_ms = 0;
|
int64_t next_rtp_time_ms = 0;
|
||||||
int64_t first_rtp_time_ms = -1;
|
int64_t first_rtp_time_ms = -1;
|
||||||
int non_zero_abs_send_time = 0;
|
int abs_send_time_count = 0;
|
||||||
int non_zero_ts_offsets = 0;
|
int ts_offset_count = 0;
|
||||||
|
webrtc::test::RtpPacket packet;
|
||||||
|
if (!rtp_reader->NextPacket(&packet)) {
|
||||||
|
printf("No RTP packet found\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
first_rtp_time_ms = packet.time_ms;
|
||||||
|
packet.time_ms = packet.time_ms - first_rtp_time_ms;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (next_rtp_time_ms <= clock.TimeInMilliseconds()) {
|
if (next_rtp_time_ms <= clock.TimeInMilliseconds()) {
|
||||||
webrtc::test::RtpPacket packet;
|
webrtc::RTPHeader header;
|
||||||
|
parser->Parse(packet.data, packet.length, &header);
|
||||||
|
if (header.extension.hasAbsoluteSendTime)
|
||||||
|
++abs_send_time_count;
|
||||||
|
if (header.extension.hasTransmissionTimeOffset)
|
||||||
|
++ts_offset_count;
|
||||||
|
size_t packet_length = packet.length;
|
||||||
|
// Some RTP dumps only include the header, in which case packet.length
|
||||||
|
// is equal to the header length. In those cases packet.original_length
|
||||||
|
// usually contains the original packet length.
|
||||||
|
if (packet.original_length > 0) {
|
||||||
|
packet_length = packet.original_length;
|
||||||
|
}
|
||||||
|
rbe->IncomingPacket(clock.TimeInMilliseconds(),
|
||||||
|
packet_length - header.headerLength,
|
||||||
|
header);
|
||||||
|
++packet_counter;
|
||||||
if (!rtp_reader->NextPacket(&packet)) {
|
if (!rtp_reader->NextPacket(&packet)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (first_rtp_time_ms == -1)
|
|
||||||
first_rtp_time_ms = packet.time_ms;
|
|
||||||
packet.time_ms = packet.time_ms - first_rtp_time_ms;
|
packet.time_ms = packet.time_ms - first_rtp_time_ms;
|
||||||
webrtc::RTPHeader header;
|
next_rtp_time_ms = packet.time_ms;
|
||||||
parser->Parse(packet.data, packet.length, &header);
|
|
||||||
if (header.extension.absoluteSendTime != 0)
|
|
||||||
++non_zero_abs_send_time;
|
|
||||||
if (header.extension.transmissionTimeOffset != 0)
|
|
||||||
++non_zero_ts_offsets;
|
|
||||||
rbe->IncomingPacket(clock.TimeInMilliseconds(),
|
|
||||||
packet.length - header.headerLength,
|
|
||||||
header);
|
|
||||||
++packet_counter;
|
|
||||||
}
|
}
|
||||||
next_process_time_ms = rbe->TimeUntilNextProcess() +
|
int time_until_process_ms = rbe->TimeUntilNextProcess();
|
||||||
clock.TimeInMilliseconds();
|
if (time_until_process_ms <= 0) {
|
||||||
if (next_process_time_ms <= clock.TimeInMilliseconds()) {
|
|
||||||
rbe->Process();
|
rbe->Process();
|
||||||
}
|
}
|
||||||
int time_until_next_event =
|
int time_until_next_event =
|
||||||
std::min(next_process_time_ms, next_rtp_time_ms) -
|
std::min(rbe->TimeUntilNextProcess(),
|
||||||
clock.TimeInMilliseconds();
|
static_cast<int>(next_rtp_time_ms -
|
||||||
|
clock.TimeInMilliseconds()));
|
||||||
clock.AdvanceTimeMilliseconds(std::max(time_until_next_event, 0));
|
clock.AdvanceTimeMilliseconds(std::max(time_until_next_event, 0));
|
||||||
}
|
}
|
||||||
printf("Parsed %d packets\nTime passed: %u ms\n", packet_counter,
|
printf("Parsed %d packets\nTime passed: %u ms\n", packet_counter,
|
||||||
static_cast<uint32_t>(clock.TimeInMilliseconds()));
|
static_cast<uint32_t>(clock.TimeInMilliseconds()));
|
||||||
printf("Estimator used: %s\n", estimator_used.c_str());
|
printf("Estimator used: %s\n", estimator_used.c_str());
|
||||||
printf("Packets with non-zero absolute send time: %d\n",
|
printf("Packets with absolute send time: %d\n",
|
||||||
non_zero_abs_send_time);
|
abs_send_time_count);
|
||||||
printf("Packets with non-zero timestamp offset: %d\n",
|
printf("Packets with timestamp offset: %d\n",
|
||||||
non_zero_ts_offsets);
|
ts_offset_count);
|
||||||
|
printf("Packets with no extension: %d\n",
|
||||||
|
packet_counter - ts_offset_count - abs_send_time_count);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "webrtc/base/format_macros.h"
|
||||||
#include "webrtc/modules/remote_bitrate_estimator/tools/bwe_rtp.h"
|
#include "webrtc/modules/remote_bitrate_estimator/tools/bwe_rtp.h"
|
||||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h"
|
#include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h"
|
||||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_payload_registry.h"
|
#include "webrtc/modules/rtp_rtcp/interface/rtp_payload_registry.h"
|
||||||
@ -39,7 +40,7 @@ int main(int argc, char** argv) {
|
|||||||
webrtc::scoped_ptr<webrtc::test::RtpFileReader> rtp_reader(reader);
|
webrtc::scoped_ptr<webrtc::test::RtpFileReader> rtp_reader(reader);
|
||||||
webrtc::scoped_ptr<webrtc::RtpHeaderParser> rtp_parser(parser);
|
webrtc::scoped_ptr<webrtc::RtpHeaderParser> rtp_parser(parser);
|
||||||
fprintf(stdout, "seqnum timestamp ts_offset abs_sendtime recvtime "
|
fprintf(stdout, "seqnum timestamp ts_offset abs_sendtime recvtime "
|
||||||
"markerbit ssrc size\n");
|
"markerbit ssrc size original_size\n");
|
||||||
int packet_counter = 0;
|
int packet_counter = 0;
|
||||||
int non_zero_abs_send_time = 0;
|
int non_zero_abs_send_time = 0;
|
||||||
int non_zero_ts_offsets = 0;
|
int non_zero_ts_offsets = 0;
|
||||||
@ -57,7 +58,7 @@ int main(int argc, char** argv) {
|
|||||||
fprintf(stdout, "%s\n", ss.str().c_str());
|
fprintf(stdout, "%s\n", ss.str().c_str());
|
||||||
} else {
|
} else {
|
||||||
fprintf(stdout,
|
fprintf(stdout,
|
||||||
"%u %u %d %u %u %d %u %d\n",
|
"%u %u %d %u %u %d %u %" PRIuS " %" PRIuS "\n",
|
||||||
header.sequenceNumber,
|
header.sequenceNumber,
|
||||||
header.timestamp,
|
header.timestamp,
|
||||||
header.extension.transmissionTimeOffset,
|
header.extension.transmissionTimeOffset,
|
||||||
@ -65,7 +66,8 @@ int main(int argc, char** argv) {
|
|||||||
packet.time_ms,
|
packet.time_ms,
|
||||||
header.markerBit,
|
header.markerBit,
|
||||||
header.ssrc,
|
header.ssrc,
|
||||||
static_cast<int>(packet.length));
|
packet.length,
|
||||||
|
packet.original_length);
|
||||||
}
|
}
|
||||||
++packet_counter;
|
++packet_counter;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user