Move video_coding to new Clock interface and remove fake clock implementations from RTP module tests.
TEST=video_coding_unittests, video_coding_integrationtests, rtp_rtcp_unittests, trybots Review URL: https://webrtc-codereview.appspot.com/1044004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3393 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -22,7 +22,7 @@ using namespace webrtc;
|
||||
|
||||
class RtpRtcpAPITest : public ::testing::Test {
|
||||
protected:
|
||||
RtpRtcpAPITest() {
|
||||
RtpRtcpAPITest() : module(NULL), fake_clock(123456) {
|
||||
test_CSRC[0] = 1234;
|
||||
test_CSRC[1] = 2345;
|
||||
test_id = 123;
|
||||
@ -50,7 +50,7 @@ class RtpRtcpAPITest : public ::testing::Test {
|
||||
WebRtc_UWord32 test_timestamp;
|
||||
WebRtc_UWord16 test_sequence_number;
|
||||
WebRtc_UWord32 test_CSRC[webrtc::kRtpCsrcSize];
|
||||
FakeRtpRtcpClock fake_clock;
|
||||
SimulatedClock fake_clock;
|
||||
};
|
||||
|
||||
TEST_F(RtpRtcpAPITest, Basic) {
|
||||
|
||||
@ -14,31 +14,6 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class FakeRtpRtcpClock : public Clock {
|
||||
public:
|
||||
FakeRtpRtcpClock() {
|
||||
time_in_ms_ = 123456;
|
||||
}
|
||||
// Return a timestamp in milliseconds relative to some arbitrary
|
||||
// source; the source is fixed for this clock.
|
||||
virtual WebRtc_Word64 TimeInMilliseconds() {
|
||||
return time_in_ms_;
|
||||
}
|
||||
virtual int64_t TimeInMicroseconds() {
|
||||
return time_in_ms_ * 1000;
|
||||
}
|
||||
// Retrieve an NTP absolute timestamp.
|
||||
virtual void CurrentNtp(WebRtc_UWord32& secs, WebRtc_UWord32& frac) {
|
||||
secs = time_in_ms_ / 1000;
|
||||
frac = (time_in_ms_ % 1000) * 4294967;
|
||||
}
|
||||
void IncrementTime(WebRtc_UWord32 time_increment_ms) {
|
||||
time_in_ms_ += time_increment_ms;
|
||||
}
|
||||
private:
|
||||
WebRtc_Word64 time_in_ms_;
|
||||
};
|
||||
|
||||
// This class sends all its packet straight to the provided RtpRtcp module.
|
||||
// with optional packet loss.
|
||||
class LoopBackTransport : public webrtc::Transport {
|
||||
|
||||
@ -119,7 +119,7 @@ class AudioFeedback : public RtpAudioFeedback {
|
||||
|
||||
class RtpRtcpAudioTest : public ::testing::Test {
|
||||
protected:
|
||||
RtpRtcpAudioTest() {
|
||||
RtpRtcpAudioTest() : fake_clock(123456) {
|
||||
test_CSRC[0] = 1234;
|
||||
test_CSRC[2] = 2345;
|
||||
test_id = 123;
|
||||
@ -183,7 +183,7 @@ class RtpRtcpAudioTest : public ::testing::Test {
|
||||
WebRtc_UWord32 test_timestamp;
|
||||
WebRtc_UWord16 test_sequence_number;
|
||||
WebRtc_UWord32 test_CSRC[webrtc::kRtpCsrcSize];
|
||||
FakeRtpRtcpClock fake_clock;
|
||||
SimulatedClock fake_clock;
|
||||
};
|
||||
|
||||
TEST_F(RtpRtcpAudioTest, Basic) {
|
||||
@ -317,7 +317,7 @@ TEST_F(RtpRtcpAudioTest, DTMF) {
|
||||
for (;timeStamp <= 250 * 160; timeStamp += 160) {
|
||||
EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96,
|
||||
timeStamp, -1, test, 4));
|
||||
fake_clock.IncrementTime(20);
|
||||
fake_clock.AdvanceTimeMilliseconds(20);
|
||||
module1->Process();
|
||||
}
|
||||
EXPECT_EQ(0, module1->SendTelephoneEventOutband(32, 9000, 10));
|
||||
@ -325,7 +325,7 @@ TEST_F(RtpRtcpAudioTest, DTMF) {
|
||||
for (;timeStamp <= 740 * 160; timeStamp += 160) {
|
||||
EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96,
|
||||
timeStamp, -1, test, 4));
|
||||
fake_clock.IncrementTime(20);
|
||||
fake_clock.AdvanceTimeMilliseconds(20);
|
||||
module1->Process();
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +94,12 @@ class NackLoopBackTransport : public webrtc::Transport {
|
||||
|
||||
class RtpRtcpNackTest : public ::testing::Test {
|
||||
protected:
|
||||
RtpRtcpNackTest() {}
|
||||
RtpRtcpNackTest()
|
||||
: video_module_(NULL),
|
||||
transport_(NULL),
|
||||
nack_receiver_(NULL),
|
||||
payload_data_length(sizeof(payload_data)),
|
||||
fake_clock(123456) {}
|
||||
~RtpRtcpNackTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
@ -127,8 +132,6 @@ class RtpRtcpNackTest : public ::testing::Test {
|
||||
EXPECT_EQ(0, video_module_->RegisterSendPayload(video_codec));
|
||||
EXPECT_EQ(0, video_module_->RegisterReceivePayload(video_codec));
|
||||
|
||||
payload_data_length = sizeof(payload_data);
|
||||
|
||||
for (int n = 0; n < payload_data_length; n++) {
|
||||
payload_data[n] = n % 10;
|
||||
}
|
||||
@ -145,7 +148,7 @@ class RtpRtcpNackTest : public ::testing::Test {
|
||||
VerifyingNackReceiver* nack_receiver_;
|
||||
WebRtc_UWord8 payload_data[65000];
|
||||
int payload_data_length;
|
||||
FakeRtpRtcpClock fake_clock;
|
||||
SimulatedClock fake_clock;
|
||||
};
|
||||
|
||||
TEST_F(RtpRtcpNackTest, RTCP) {
|
||||
@ -185,7 +188,7 @@ TEST_F(RtpRtcpNackTest, RTCP) {
|
||||
nack_list[n++] = (*it);
|
||||
}
|
||||
video_module_->SendNACK(nack_list, n);
|
||||
fake_clock.IncrementTime(33);
|
||||
fake_clock.AdvanceTimeMilliseconds(33);
|
||||
video_module_->Process();
|
||||
|
||||
// Prepare next frame.
|
||||
@ -242,7 +245,7 @@ TEST_F(RtpRtcpNackTest, RTX) {
|
||||
nack_list[n++] = (*it);
|
||||
}
|
||||
video_module_->SendNACK(nack_list, n);
|
||||
fake_clock.IncrementTime(33);
|
||||
fake_clock.AdvanceTimeMilliseconds(33);
|
||||
video_module_->Process();
|
||||
|
||||
// Prepare next frame.
|
||||
|
||||
@ -78,7 +78,7 @@ class RtcpCallback : public RtcpFeedback, public RtcpIntraFrameObserver {
|
||||
|
||||
class RtpRtcpRtcpTest : public ::testing::Test {
|
||||
protected:
|
||||
RtpRtcpRtcpTest() {
|
||||
RtpRtcpRtcpTest() : fake_clock(123456) {
|
||||
test_CSRC[0] = 1234;
|
||||
test_CSRC[1] = 2345;
|
||||
test_id = 123;
|
||||
@ -171,7 +171,7 @@ class RtpRtcpRtcpTest : public ::testing::Test {
|
||||
WebRtc_UWord32 test_timestamp;
|
||||
WebRtc_UWord16 test_sequence_number;
|
||||
WebRtc_UWord32 test_CSRC[webrtc::kRtpCsrcSize];
|
||||
FakeRtpRtcpClock fake_clock;
|
||||
SimulatedClock fake_clock;
|
||||
};
|
||||
|
||||
TEST_F(RtpRtcpRtcpTest, RTCP_PLI_RPSI) {
|
||||
@ -194,9 +194,9 @@ TEST_F(RtpRtcpRtcpTest, RTCP_CNAME) {
|
||||
EXPECT_EQ(0, module1->AddMixedCNAME(test_CSRC[1], "jane@192.168.0.2"));
|
||||
|
||||
// send RTCP packet, triggered by timer
|
||||
fake_clock.IncrementTime(7500);
|
||||
fake_clock.AdvanceTimeMilliseconds(7500);
|
||||
module1->Process();
|
||||
fake_clock.IncrementTime(100);
|
||||
fake_clock.AdvanceTimeMilliseconds(100);
|
||||
module2->Process();
|
||||
|
||||
char cName[RTCP_CNAME_SIZE];
|
||||
@ -251,9 +251,9 @@ TEST_F(RtpRtcpRtcpTest, RTCP) {
|
||||
300));
|
||||
|
||||
// send RTCP packet, triggered by timer
|
||||
fake_clock.IncrementTime(7500);
|
||||
fake_clock.AdvanceTimeMilliseconds(7500);
|
||||
module1->Process();
|
||||
fake_clock.IncrementTime(100);
|
||||
fake_clock.AdvanceTimeMilliseconds(100);
|
||||
module2->Process();
|
||||
|
||||
WebRtc_UWord32 receivedNTPsecs = 0;
|
||||
@ -318,7 +318,7 @@ TEST_F(RtpRtcpRtcpTest, RTCP) {
|
||||
EXPECT_EQ(0, module1->SetSendingStatus(false));
|
||||
|
||||
// Send RTCP packet, triggered by timer.
|
||||
fake_clock.IncrementTime(5000);
|
||||
fake_clock.AdvanceTimeMilliseconds(5000);
|
||||
module1->Process();
|
||||
module2->Process();
|
||||
}
|
||||
@ -330,9 +330,9 @@ TEST_F(RtpRtcpRtcpTest, RemoteRTCPStatRemote) {
|
||||
EXPECT_EQ(0u, report_blocks.size());
|
||||
|
||||
// send RTCP packet, triggered by timer
|
||||
fake_clock.IncrementTime(7500);
|
||||
fake_clock.AdvanceTimeMilliseconds(7500);
|
||||
module1->Process();
|
||||
fake_clock.IncrementTime(100);
|
||||
fake_clock.AdvanceTimeMilliseconds(100);
|
||||
module2->Process();
|
||||
|
||||
EXPECT_EQ(0, module1->RemoteRTCPStat(&report_blocks));
|
||||
|
||||
@ -28,7 +28,8 @@ class RtpRtcpVideoTest : public ::testing::Test {
|
||||
: test_id_(123),
|
||||
test_ssrc_(3456),
|
||||
test_timestamp_(4567),
|
||||
test_sequence_number_(2345) {
|
||||
test_sequence_number_(2345),
|
||||
fake_clock(123456) {
|
||||
}
|
||||
~RtpRtcpVideoTest() {}
|
||||
|
||||
@ -124,7 +125,7 @@ class RtpRtcpVideoTest : public ::testing::Test {
|
||||
WebRtc_UWord16 test_sequence_number_;
|
||||
WebRtc_UWord8 video_frame_[65000];
|
||||
int payload_data_length_;
|
||||
FakeRtpRtcpClock fake_clock;
|
||||
SimulatedClock fake_clock;
|
||||
enum { kPayloadType = 100 };
|
||||
};
|
||||
|
||||
@ -157,7 +158,7 @@ TEST_F(RtpRtcpVideoTest, PaddingOnlyFrames) {
|
||||
EXPECT_EQ(packet_size - 12, receiver_->rtp_header().header.paddingLength);
|
||||
}
|
||||
timestamp += 3000;
|
||||
fake_clock.IncrementTime(33);
|
||||
fake_clock.AdvanceTimeMilliseconds(33);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user