RTP video playback tool using Call APIs.
Plays back rtpdump files from Wireshark in realtime as well as save the resulting raw video to file. Unlike the RTP playback tool it doesn't support faster-than-realtime playback/rendering, but it instead utilizes the same path as production code and also contains support for playing back FEC. BUG= R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/16969004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6838 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -19,12 +19,11 @@
|
||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_receiver.h"
|
||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
|
||||
#include "webrtc/modules/video_coding/main/source/internal_defines.h"
|
||||
#include "webrtc/modules/video_coding/main/test/pcap_file_reader.h"
|
||||
#include "webrtc/modules/video_coding/main/test/rtp_file_reader.h"
|
||||
#include "webrtc/modules/video_coding/main/test/test_util.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||
#include "webrtc/test/rtp_file_reader.h"
|
||||
|
||||
#if 1
|
||||
# define DEBUG_LOG1(text, arg)
|
||||
@ -323,7 +322,7 @@ class RtpPlayerImpl : public RtpPlayerInterface {
|
||||
public:
|
||||
RtpPlayerImpl(PayloadSinkFactoryInterface* payload_sink_factory,
|
||||
const PayloadTypes& payload_types, Clock* clock,
|
||||
scoped_ptr<RtpPacketSourceInterface>* packet_source,
|
||||
scoped_ptr<test::RtpFileReader>* packet_source,
|
||||
float loss_rate, uint32_t rtt_ms, bool reordering)
|
||||
: ssrc_handlers_(payload_sink_factory, payload_types),
|
||||
clock_(clock),
|
||||
@ -337,9 +336,7 @@ class RtpPlayerImpl : public RtpPlayerInterface {
|
||||
no_loss_startup_(100),
|
||||
end_of_file_(false),
|
||||
reordering_(false),
|
||||
reorder_buffer_(),
|
||||
next_packet_(),
|
||||
next_packet_length_(0) {
|
||||
reorder_buffer_() {
|
||||
assert(clock);
|
||||
assert(packet_source);
|
||||
assert(packet_source->get());
|
||||
@ -368,22 +365,23 @@ class RtpPlayerImpl : public RtpPlayerInterface {
|
||||
// Send any packets from packet source.
|
||||
if (!end_of_file_ && (TimeUntilNextPacket() == 0 || first_packet_)) {
|
||||
if (first_packet_) {
|
||||
next_packet_length_ = sizeof(next_packet_);
|
||||
if (packet_source_->NextPacket(next_packet_, &next_packet_length_,
|
||||
&next_rtp_time_) != 0) {
|
||||
if (!packet_source_->NextPacket(&next_packet_))
|
||||
return 0;
|
||||
}
|
||||
first_packet_rtp_time_ = next_rtp_time_;
|
||||
first_packet_rtp_time_ = next_packet_.time_ms;
|
||||
first_packet_time_ms_ = clock_->TimeInMilliseconds();
|
||||
first_packet_ = false;
|
||||
}
|
||||
|
||||
if (reordering_ && reorder_buffer_.get() == NULL) {
|
||||
reorder_buffer_.reset(new RawRtpPacket(next_packet_,
|
||||
next_packet_length_, 0, 0));
|
||||
reorder_buffer_.reset(
|
||||
new RawRtpPacket(next_packet_.data,
|
||||
static_cast<uint32_t>(next_packet_.length),
|
||||
0,
|
||||
0));
|
||||
return 0;
|
||||
}
|
||||
int ret = SendPacket(next_packet_, next_packet_length_);
|
||||
int ret = SendPacket(next_packet_.data,
|
||||
static_cast<uint32_t>(next_packet_.length));
|
||||
if (reorder_buffer_.get()) {
|
||||
SendPacket(reorder_buffer_->data(), reorder_buffer_->length());
|
||||
reorder_buffer_.reset(NULL);
|
||||
@ -392,13 +390,11 @@ class RtpPlayerImpl : public RtpPlayerInterface {
|
||||
return ret;
|
||||
}
|
||||
|
||||
next_packet_length_ = sizeof(next_packet_);
|
||||
if (packet_source_->NextPacket(next_packet_, &next_packet_length_,
|
||||
&next_rtp_time_) != 0) {
|
||||
if (!packet_source_->NextPacket(&next_packet_)) {
|
||||
end_of_file_ = true;
|
||||
return 0;
|
||||
}
|
||||
else if (next_packet_length_ == 0) {
|
||||
else if (next_packet_.length == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -456,7 +452,8 @@ class RtpPlayerImpl : public RtpPlayerInterface {
|
||||
|
||||
SsrcHandlers ssrc_handlers_;
|
||||
Clock* clock_;
|
||||
scoped_ptr<RtpPacketSourceInterface> packet_source_;
|
||||
scoped_ptr<test::RtpFileReader> packet_source_;
|
||||
test::RtpFileReader::Packet next_packet_;
|
||||
uint32_t next_rtp_time_;
|
||||
bool first_packet_;
|
||||
int64_t first_packet_rtp_time_;
|
||||
@ -468,8 +465,6 @@ class RtpPlayerImpl : public RtpPlayerInterface {
|
||||
bool end_of_file_;
|
||||
bool reordering_;
|
||||
scoped_ptr<RawRtpPacket> reorder_buffer_;
|
||||
uint8_t next_packet_[kMaxPacketBufferSize];
|
||||
uint32_t next_packet_length_;
|
||||
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(RtpPlayerImpl);
|
||||
};
|
||||
@ -478,10 +473,11 @@ RtpPlayerInterface* Create(const std::string& input_filename,
|
||||
PayloadSinkFactoryInterface* payload_sink_factory, Clock* clock,
|
||||
const PayloadTypes& payload_types, float loss_rate, uint32_t rtt_ms,
|
||||
bool reordering) {
|
||||
scoped_ptr<RtpPacketSourceInterface> packet_source(
|
||||
CreateRtpFileReader(input_filename));
|
||||
scoped_ptr<test::RtpFileReader> packet_source(test::RtpFileReader::Create(
|
||||
test::RtpFileReader::kRtpDump, input_filename));
|
||||
if (packet_source.get() == NULL) {
|
||||
packet_source.reset(CreatePcapFileReader(input_filename));
|
||||
packet_source.reset(test::RtpFileReader::Create(test::RtpFileReader::kPcap,
|
||||
input_filename));
|
||||
if (packet_source.get() == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user