Reduced execution time for CallTest::ReceivesPliAndRecovers, by dropping only one packet and made it predictable by removing rand().

Follow up steps is to support NackConfig.rtp_hostory_ms and/or increase fake encoder bitrate.

R=pbos@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/6109005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5316 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mflodman@webrtc.org 2013-12-18 09:45:45 +00:00
parent 1fa41be66a
commit bcd124cdba

View File

@ -562,9 +562,8 @@ class PliObserver : public test::RtpRtcpObserver, public VideoRenderer {
: test::RtpRtcpObserver(kLongTimeoutMs), : test::RtpRtcpObserver(kLongTimeoutMs),
rtp_header_parser_(RtpHeaderParser::Create()), rtp_header_parser_(RtpHeaderParser::Create()),
nack_enabled_(nack_enabled), nack_enabled_(nack_enabled),
first_retransmitted_timestamp_(0), highest_dropped_timestamp_(0),
last_send_timestamp_(0), frames_to_drop_(0),
rendered_frame_(false),
received_pli_(false) {} received_pli_(false) {}
virtual Action OnSendRtp(const uint8_t* packet, size_t length) OVERRIDE { virtual Action OnSendRtp(const uint8_t* packet, size_t length) OVERRIDE {
@ -572,19 +571,16 @@ class PliObserver : public test::RtpRtcpObserver, public VideoRenderer {
EXPECT_TRUE( EXPECT_TRUE(
rtp_header_parser_->Parse(packet, static_cast<int>(length), &header)); rtp_header_parser_->Parse(packet, static_cast<int>(length), &header));
// Drop all NACK retransmissions. This is to force transmission of a PLI. // Drop all retransmitted packets to force a PLI.
if (header.timestamp < last_send_timestamp_) if (header.timestamp <= highest_dropped_timestamp_)
return DROP_PACKET; return DROP_PACKET;
if (received_pli_) { if (frames_to_drop_ > 0) {
if (first_retransmitted_timestamp_ == 0) { highest_dropped_timestamp_ = header.timestamp;
first_retransmitted_timestamp_ = header.timestamp; --frames_to_drop_;
}
} else if (rendered_frame_ && rand() % kInverseDropProbability == 0) {
return DROP_PACKET; return DROP_PACKET;
} }
last_send_timestamp_ = header.timestamp;
return SEND_PACKET; return SEND_PACKET;
} }
@ -609,22 +605,20 @@ class PliObserver : public test::RtpRtcpObserver, public VideoRenderer {
virtual void RenderFrame(const I420VideoFrame& video_frame, virtual void RenderFrame(const I420VideoFrame& video_frame,
int time_to_render_ms) OVERRIDE { int time_to_render_ms) OVERRIDE {
CriticalSectionScoped crit_(lock_.get()); CriticalSectionScoped crit_(lock_.get());
if (first_retransmitted_timestamp_ != 0 && if (received_pli_ && video_frame.timestamp() > highest_dropped_timestamp_) {
video_frame.timestamp() > first_retransmitted_timestamp_) {
EXPECT_TRUE(received_pli_);
observation_complete_->Set(); observation_complete_->Set();
} }
rendered_frame_ = true; if (!received_pli_)
frames_to_drop_ = kPacketsToDrop;
} }
private: private:
static const int kPacketsToDrop = 1;
scoped_ptr<RtpHeaderParser> rtp_header_parser_; scoped_ptr<RtpHeaderParser> rtp_header_parser_;
bool nack_enabled_; bool nack_enabled_;
uint32_t highest_dropped_timestamp_;
uint32_t first_retransmitted_timestamp_; int frames_to_drop_;
uint32_t last_send_timestamp_;
bool rendered_frame_;
bool received_pli_; bool received_pli_;
}; };