Rename newapi::Transport::SendRTP()->SendRtp().
Also fit rampup_tests.cc to use internal::TransportAdapter instead of implementing its own. BUG= R=mflodman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/3419004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5138 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
ce90eff345
commit
27326b6a42
@ -57,12 +57,12 @@ void DirectTransport::SetReceiver(PacketReceiver* receiver) {
|
|||||||
receiver_ = receiver;
|
receiver_ = receiver;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DirectTransport::SendRTP(const uint8_t* data, size_t length) {
|
bool DirectTransport::SendRtp(const uint8_t* data, size_t length) {
|
||||||
QueuePacket(data, length, clock_->TimeInMilliseconds() + delay_ms_);
|
QueuePacket(data, length, clock_->TimeInMilliseconds() + delay_ms_);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DirectTransport::SendRTCP(const uint8_t* data, size_t length) {
|
bool DirectTransport::SendRtcp(const uint8_t* data, size_t length) {
|
||||||
QueuePacket(data, length, clock_->TimeInMilliseconds() + delay_ms_);
|
QueuePacket(data, length, clock_->TimeInMilliseconds() + delay_ms_);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,8 @@ class DirectTransport : public newapi::Transport {
|
|||||||
virtual void StopSending();
|
virtual void StopSending();
|
||||||
virtual void SetReceiver(PacketReceiver* receiver);
|
virtual void SetReceiver(PacketReceiver* receiver);
|
||||||
|
|
||||||
virtual bool SendRTP(const uint8_t* data, size_t length) OVERRIDE;
|
virtual bool SendRtp(const uint8_t* data, size_t length) OVERRIDE;
|
||||||
virtual bool SendRTCP(const uint8_t* data, size_t length) OVERRIDE;
|
virtual bool SendRtcp(const uint8_t* data, size_t length) OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Packet {
|
struct Packet {
|
||||||
|
@ -12,11 +12,11 @@
|
|||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
|
||||||
bool NullTransport::SendRTP(const uint8_t* packet, size_t length) {
|
bool NullTransport::SendRtp(const uint8_t* packet, size_t length) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NullTransport::SendRTCP(const uint8_t* packet, size_t length) {
|
bool NullTransport::SendRtcp(const uint8_t* packet, size_t length) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ class PacketReceiver;
|
|||||||
namespace test {
|
namespace test {
|
||||||
class NullTransport : public newapi::Transport {
|
class NullTransport : public newapi::Transport {
|
||||||
public:
|
public:
|
||||||
virtual bool SendRTP(const uint8_t* packet, size_t length) OVERRIDE;
|
virtual bool SendRtp(const uint8_t* packet, size_t length) OVERRIDE;
|
||||||
virtual bool SendRTCP(const uint8_t* packet, size_t length) OVERRIDE;
|
virtual bool SendRtcp(const uint8_t* packet, size_t length) OVERRIDE;
|
||||||
};
|
};
|
||||||
} // namespace test
|
} // namespace test
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -118,7 +118,7 @@ class RtpRtcpObserver {
|
|||||||
on_rtcp_(on_rtcp) {}
|
on_rtcp_(on_rtcp) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool SendRTP(const uint8_t* packet, size_t length) OVERRIDE {
|
virtual bool SendRtp(const uint8_t* packet, size_t length) OVERRIDE {
|
||||||
Action action;
|
Action action;
|
||||||
{
|
{
|
||||||
CriticalSectionScoped crit_(lock_);
|
CriticalSectionScoped crit_(lock_);
|
||||||
@ -129,12 +129,12 @@ class RtpRtcpObserver {
|
|||||||
// Drop packet silently.
|
// Drop packet silently.
|
||||||
return true;
|
return true;
|
||||||
case SEND_PACKET:
|
case SEND_PACKET:
|
||||||
return test::DirectTransport::SendRTP(packet, length);
|
return test::DirectTransport::SendRtp(packet, length);
|
||||||
}
|
}
|
||||||
return true; // Will never happen, makes compiler happy.
|
return true; // Will never happen, makes compiler happy.
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool SendRTCP(const uint8_t* packet, size_t length) OVERRIDE {
|
virtual bool SendRtcp(const uint8_t* packet, size_t length) OVERRIDE {
|
||||||
Action action;
|
Action action;
|
||||||
{
|
{
|
||||||
CriticalSectionScoped crit_(lock_);
|
CriticalSectionScoped crit_(lock_);
|
||||||
@ -145,7 +145,7 @@ class RtpRtcpObserver {
|
|||||||
// Drop packet silently.
|
// Drop packet silently.
|
||||||
return true;
|
return true;
|
||||||
case SEND_PACKET:
|
case SEND_PACKET:
|
||||||
return test::DirectTransport::SendRTCP(packet, length);
|
return test::DirectTransport::SendRtcp(packet, length);
|
||||||
}
|
}
|
||||||
return true; // Will never happen, makes compiler happy.
|
return true; // Will never happen, makes compiler happy.
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@ namespace newapi {
|
|||||||
|
|
||||||
class Transport {
|
class Transport {
|
||||||
public:
|
public:
|
||||||
virtual bool SendRTP(const uint8_t* packet, size_t length) = 0;
|
virtual bool SendRtp(const uint8_t* packet, size_t length) = 0;
|
||||||
virtual bool SendRTCP(const uint8_t* packet, size_t length) = 0;
|
virtual bool SendRtcp(const uint8_t* packet, size_t length) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~Transport() {}
|
virtual ~Transport() {}
|
||||||
|
@ -149,7 +149,7 @@ class VideoAnalyzer : public PacketReceiver,
|
|||||||
input_->PutFrame(video_frame, delta_capture_ms);
|
input_->PutFrame(video_frame, delta_capture_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool SendRTP(const uint8_t* packet, size_t length) OVERRIDE {
|
virtual bool SendRtp(const uint8_t* packet, size_t length) OVERRIDE {
|
||||||
scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
|
scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
|
||||||
RTPHeader header;
|
RTPHeader header;
|
||||||
parser->Parse(packet, static_cast<int>(length), &header);
|
parser->Parse(packet, static_cast<int>(length), &header);
|
||||||
@ -165,11 +165,11 @@ class VideoAnalyzer : public PacketReceiver,
|
|||||||
Clock::GetRealTimeClock()->CurrentNtpInMilliseconds();
|
Clock::GetRealTimeClock()->CurrentNtpInMilliseconds();
|
||||||
}
|
}
|
||||||
|
|
||||||
return transport_->SendRTP(packet, length);
|
return transport_->SendRtp(packet, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool SendRTCP(const uint8_t* packet, size_t length) OVERRIDE {
|
virtual bool SendRtcp(const uint8_t* packet, size_t length) OVERRIDE {
|
||||||
return transport_->SendRTCP(packet, length);
|
return transport_->SendRtcp(packet, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void RenderFrame(const I420VideoFrame& video_frame,
|
virtual void RenderFrame(const I420VideoFrame& video_frame,
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "webrtc/test/fake_encoder.h"
|
#include "webrtc/test/fake_encoder.h"
|
||||||
#include "webrtc/test/frame_generator_capturer.h"
|
#include "webrtc/test/frame_generator_capturer.h"
|
||||||
#include "webrtc/test/generate_ssrcs.h"
|
#include "webrtc/test/generate_ssrcs.h"
|
||||||
|
#include "webrtc/video/transport_adapter.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ class StreamObserver : public newapi::Transport, public RemoteBitrateObserver {
|
|||||||
: critical_section_(CriticalSectionWrapper::CreateCriticalSection()),
|
: critical_section_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
all_ssrcs_sent_(EventWrapper::Create()),
|
all_ssrcs_sent_(EventWrapper::Create()),
|
||||||
rtp_parser_(RtpHeaderParser::Create()),
|
rtp_parser_(RtpHeaderParser::Create()),
|
||||||
feedback_transport_(new TransportWrapper(feedback_transport)),
|
feedback_transport_(feedback_transport),
|
||||||
receive_stats_(ReceiveStatistics::Create(clock)),
|
receive_stats_(ReceiveStatistics::Create(clock)),
|
||||||
clock_(clock),
|
clock_(clock),
|
||||||
num_expected_ssrcs_(num_expected_ssrcs) {
|
num_expected_ssrcs_(num_expected_ssrcs) {
|
||||||
@ -53,7 +54,7 @@ class StreamObserver : public newapi::Transport, public RemoteBitrateObserver {
|
|||||||
// be able to produce an RTCP with REMB.
|
// be able to produce an RTCP with REMB.
|
||||||
RtpRtcp::Configuration config;
|
RtpRtcp::Configuration config;
|
||||||
config.receive_statistics = receive_stats_.get();
|
config.receive_statistics = receive_stats_.get();
|
||||||
config.outgoing_transport = feedback_transport_.get();
|
config.outgoing_transport = &feedback_transport_;
|
||||||
rtp_rtcp_.reset(RtpRtcp::CreateRtpRtcp(config));
|
rtp_rtcp_.reset(RtpRtcp::CreateRtpRtcp(config));
|
||||||
rtp_rtcp_->SetREMBStatus(true);
|
rtp_rtcp_->SetREMBStatus(true);
|
||||||
rtp_rtcp_->SetRTCPStatus(kRtcpNonCompound);
|
rtp_rtcp_->SetRTCPStatus(kRtcpNonCompound);
|
||||||
@ -73,7 +74,7 @@ class StreamObserver : public newapi::Transport, public RemoteBitrateObserver {
|
|||||||
rtp_rtcp_->Process();
|
rtp_rtcp_->Process();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool SendRTP(const uint8_t* packet, size_t length) OVERRIDE {
|
virtual bool SendRtp(const uint8_t* packet, size_t length) OVERRIDE {
|
||||||
CriticalSectionScoped lock(critical_section_.get());
|
CriticalSectionScoped lock(critical_section_.get());
|
||||||
RTPHeader header;
|
RTPHeader header;
|
||||||
EXPECT_TRUE(rtp_parser_->Parse(packet, static_cast<int>(length), &header));
|
EXPECT_TRUE(rtp_parser_->Parse(packet, static_cast<int>(length), &header));
|
||||||
@ -87,43 +88,20 @@ class StreamObserver : public newapi::Transport, public RemoteBitrateObserver {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool SendRTCP(const uint8_t* packet, size_t length) OVERRIDE {
|
virtual bool SendRtcp(const uint8_t* packet, size_t length) OVERRIDE {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
EventTypeWrapper Wait() { return all_ssrcs_sent_->Wait(120 * 1000); }
|
EventTypeWrapper Wait() { return all_ssrcs_sent_->Wait(120 * 1000); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class TransportWrapper : public webrtc::Transport {
|
|
||||||
public:
|
|
||||||
explicit TransportWrapper(newapi::Transport* new_transport)
|
|
||||||
: new_transport_(new_transport) {}
|
|
||||||
|
|
||||||
virtual int SendPacket(int channel, const void* data, int len) OVERRIDE {
|
|
||||||
return new_transport_->SendRTP(static_cast<const uint8_t*>(data), len)
|
|
||||||
? len
|
|
||||||
: -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual int SendRTCPPacket(int channel,
|
|
||||||
const void* data,
|
|
||||||
int len) OVERRIDE {
|
|
||||||
return new_transport_->SendRTCP(static_cast<const uint8_t*>(data), len)
|
|
||||||
? len
|
|
||||||
: -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
newapi::Transport* new_transport_;
|
|
||||||
};
|
|
||||||
|
|
||||||
static const unsigned int kExpectedBitrateBps = 1200000;
|
static const unsigned int kExpectedBitrateBps = 1200000;
|
||||||
|
|
||||||
scoped_ptr<CriticalSectionWrapper> critical_section_;
|
scoped_ptr<CriticalSectionWrapper> critical_section_;
|
||||||
scoped_ptr<EventWrapper> all_ssrcs_sent_;
|
scoped_ptr<EventWrapper> all_ssrcs_sent_;
|
||||||
scoped_ptr<RtpHeaderParser> rtp_parser_;
|
scoped_ptr<RtpHeaderParser> rtp_parser_;
|
||||||
scoped_ptr<RtpRtcp> rtp_rtcp_;
|
scoped_ptr<RtpRtcp> rtp_rtcp_;
|
||||||
scoped_ptr<TransportWrapper> feedback_transport_;
|
internal::TransportAdapter feedback_transport_;
|
||||||
scoped_ptr<ReceiveStatistics> receive_stats_;
|
scoped_ptr<ReceiveStatistics> receive_stats_;
|
||||||
scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_;
|
scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_;
|
||||||
Clock* clock_;
|
Clock* clock_;
|
||||||
|
@ -19,7 +19,7 @@ TransportAdapter::TransportAdapter(newapi::Transport* transport)
|
|||||||
int TransportAdapter::SendPacket(int /*channel*/,
|
int TransportAdapter::SendPacket(int /*channel*/,
|
||||||
const void* packet,
|
const void* packet,
|
||||||
int length) {
|
int length) {
|
||||||
bool success = transport_->SendRTP(static_cast<const uint8_t*>(packet),
|
bool success = transport_->SendRtp(static_cast<const uint8_t*>(packet),
|
||||||
static_cast<size_t>(length));
|
static_cast<size_t>(length));
|
||||||
return success ? length : -1;
|
return success ? length : -1;
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ int TransportAdapter::SendPacket(int /*channel*/,
|
|||||||
int TransportAdapter::SendRTCPPacket(int /*channel*/,
|
int TransportAdapter::SendRTCPPacket(int /*channel*/,
|
||||||
const void* packet,
|
const void* packet,
|
||||||
int length) {
|
int length) {
|
||||||
bool success = transport_->SendRTCP(static_cast<const uint8_t*>(packet),
|
bool success = transport_->SendRtcp(static_cast<const uint8_t*>(packet),
|
||||||
static_cast<size_t>(length));
|
static_cast<size_t>(length));
|
||||||
return success ? length : -1;
|
return success ? length : -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user