Update talk to 50918584.
Together with Stefan's http://review.webrtc.org/1960004/.
R=mallinath@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/2048004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@4556 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/modules/rtp_rtcp/source/nack_rtx_unittest.cc b/modules/rtp_rtcp/source/nack_rtx_unittest.cc
index e780f5f..ecf4a07 100644
--- a/modules/rtp_rtcp/source/nack_rtx_unittest.cc
+++ b/modules/rtp_rtcp/source/nack_rtx_unittest.cc
@@ -15,7 +15,10 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/common_types.h"
+#include "webrtc/modules/rtp_rtcp/interface/receive_statistics.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_receiver.h"
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
@@ -30,7 +33,7 @@
const int kTestNumberOfRtxPackets = 149;
const int kNumFrames = 30;
-class VerifyingRtxReceiver : public RtpData
+class VerifyingRtxReceiver : public NullRtpData
{
public:
VerifyingRtxReceiver() {}
@@ -47,6 +50,20 @@
std::list<uint16_t> sequence_numbers_;
};
+class TestRtpFeedback : public NullRtpFeedback {
+ public:
+ TestRtpFeedback(RtpRtcp* rtp_rtcp) : rtp_rtcp_(rtp_rtcp) {}
+ virtual ~TestRtpFeedback() {}
+
+ virtual void OnIncomingSSRCChanged(const int32_t id,
+ const uint32_t SSRC) {
+ rtp_rtcp_->SetRemoteSSRC(SSRC);
+ }
+
+ private:
+ RtpRtcp* rtp_rtcp_;
+};
+
class RtxLoopBackTransport : public webrtc::Transport {
public:
explicit RtxLoopBackTransport(uint32_t rtx_ssrc)
@@ -56,11 +73,17 @@
consecutive_drop_end_(0),
rtx_ssrc_(rtx_ssrc),
count_rtx_ssrc_(0),
+ rtp_payload_registry_(NULL),
+ rtp_receiver_(NULL),
module_(NULL) {
}
- void SetSendModule(RtpRtcp* rtpRtcpModule) {
+ void SetSendModule(RtpRtcp* rtpRtcpModule,
+ RTPPayloadRegistry* rtp_payload_registry,
+ RtpReceiver* receiver) {
module_ = rtpRtcpModule;
+ rtp_payload_registry_ = rtp_payload_registry;
+ rtp_receiver_ = receiver;
}
void DropEveryNthPacket(int n) {
@@ -94,8 +117,14 @@
if (!parser->Parse(static_cast<const uint8_t*>(data), len, &header)) {
return -1;
}
- if (module_->IncomingRtpPacket(static_cast<const uint8_t*>(data), len,
- header) < 0) {
+ PayloadUnion payload_specific;
+ if (!rtp_payload_registry_->GetPayloadSpecifics(header.payloadType,
+ &payload_specific)) {
+ return -1;
+ }
+ if (!rtp_receiver_->IncomingRtpPacket(&header,
+ static_cast<const uint8_t*>(data),
+ len, payload_specific, true)) {
return -1;
}
return len;
@@ -113,6 +142,8 @@
int consecutive_drop_end_;
uint32_t rtx_ssrc_;
int count_rtx_ssrc_;
+ RTPPayloadRegistry* rtp_payload_registry_;
+ RtpReceiver* rtp_receiver_;
RtpRtcp* module_;
std::set<uint16_t> expected_sequence_numbers_;
};
@@ -120,7 +151,8 @@
class RtpRtcpRtxNackTest : public ::testing::Test {
protected:
RtpRtcpRtxNackTest()
- : rtp_rtcp_module_(NULL),
+ : rtp_payload_registry_(0, RTPPayloadStrategy::CreateStrategy(false)),
+ rtp_rtcp_module_(NULL),
transport_(kTestSsrc + 1),
receiver_(),
payload_data_length(sizeof(payload_data)),
@@ -132,19 +164,27 @@
configuration.id = kTestId;
configuration.audio = false;
configuration.clock = &fake_clock;
- configuration.incoming_data = &receiver_;
+ receive_statistics_.reset(ReceiveStatistics::Create(&fake_clock));
+ configuration.receive_statistics = receive_statistics_.get();
configuration.outgoing_transport = &transport_;
rtp_rtcp_module_ = RtpRtcp::CreateRtpRtcp(configuration);
+ rtp_feedback_.reset(new TestRtpFeedback(rtp_rtcp_module_));
+
+ rtp_receiver_.reset(RtpReceiver::CreateVideoReceiver(
+ kTestId, &fake_clock, &receiver_, rtp_feedback_.get(),
+ &rtp_payload_registry_));
+
EXPECT_EQ(0, rtp_rtcp_module_->SetSSRC(kTestSsrc));
EXPECT_EQ(0, rtp_rtcp_module_->SetRTCPStatus(kRtcpCompound));
- EXPECT_EQ(0, rtp_rtcp_module_->SetNACKStatus(kNackRtcp, 450));
+ EXPECT_EQ(0, rtp_receiver_->SetNACKStatus(kNackRtcp, 450));
EXPECT_EQ(0, rtp_rtcp_module_->SetStorePacketsStatus(true, 600));
EXPECT_EQ(0, rtp_rtcp_module_->SetSendingStatus(true));
EXPECT_EQ(0, rtp_rtcp_module_->SetSequenceNumber(kTestSequenceNumber));
EXPECT_EQ(0, rtp_rtcp_module_->SetStartTimestamp(111111));
- transport_.SetSendModule(rtp_rtcp_module_);
+ transport_.SetSendModule(rtp_rtcp_module_, &rtp_payload_registry_,
+ rtp_receiver_.get());
VideoCodec video_codec;
memset(&video_codec, 0, sizeof(video_codec));
@@ -152,7 +192,11 @@
memcpy(video_codec.plName, "I420", 5);
EXPECT_EQ(0, rtp_rtcp_module_->RegisterSendPayload(video_codec));
- EXPECT_EQ(0, rtp_rtcp_module_->RegisterReceivePayload(video_codec));
+ EXPECT_EQ(0, rtp_receiver_->RegisterReceivePayload(video_codec.plName,
+ video_codec.plType,
+ 90000,
+ 0,
+ video_codec.maxBitrate));
for (int n = 0; n < payload_data_length; n++) {
payload_data[n] = n % 10;
@@ -196,7 +240,7 @@
}
void RunRtxTest(RtxMode rtx_method, int loss) {
- EXPECT_EQ(0, rtp_rtcp_module_->SetRTXReceiveStatus(true, kTestSsrc + 1));
+ rtp_receiver_->SetRTXStatus(true, kTestSsrc + 1);
EXPECT_EQ(0, rtp_rtcp_module_->SetRTXSendStatus(rtx_method, true,
kTestSsrc + 1));
transport_.DropEveryNthPacket(loss);
@@ -224,7 +268,11 @@
delete rtp_rtcp_module_;
}
+ scoped_ptr<ReceiveStatistics> receive_statistics_;
+ RTPPayloadRegistry rtp_payload_registry_;
+ scoped_ptr<RtpReceiver> rtp_receiver_;
RtpRtcp* rtp_rtcp_module_;
+ scoped_ptr<TestRtpFeedback> rtp_feedback_;
RtxLoopBackTransport transport_;
VerifyingRtxReceiver receiver_;
uint8_t payload_data[65000];