First incoming packet was not accounted for in receive stats. Changed call order for incoming packet to receive statistics class.
Receive stats is reset if the payload type changes. Update stats after a possible reset. R=mflodman@webrtc.org, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/12549004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6247 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
727ff69829
commit
1457b4737a
@ -1557,4 +1557,52 @@ TEST_F(CallTest, ReceiverReferenceTimeReportDisabled) {
|
||||
TestXrReceiverReferenceTimeReport(false);
|
||||
}
|
||||
|
||||
TEST_F(CallTest, TestReceivedRtpPacketStats) {
|
||||
static const size_t kNumRtpPacketsToSend = 5;
|
||||
class ReceivedRtpStatsObserver : public test::RtpRtcpObserver {
|
||||
public:
|
||||
ReceivedRtpStatsObserver()
|
||||
: test::RtpRtcpObserver(kDefaultTimeoutMs),
|
||||
receive_stream_(NULL),
|
||||
sent_rtp_(0) {}
|
||||
|
||||
void SetReceiveStream(VideoReceiveStream* stream) {
|
||||
receive_stream_ = stream;
|
||||
}
|
||||
|
||||
private:
|
||||
virtual Action OnSendRtp(const uint8_t* packet, size_t length) OVERRIDE {
|
||||
if (sent_rtp_ >= kNumRtpPacketsToSend) {
|
||||
VideoReceiveStream::Stats stats = receive_stream_->GetStats();
|
||||
if (kNumRtpPacketsToSend == stats.rtp_stats.packets) {
|
||||
observation_complete_->Set();
|
||||
}
|
||||
return DROP_PACKET;
|
||||
}
|
||||
++sent_rtp_;
|
||||
return SEND_PACKET;
|
||||
}
|
||||
|
||||
VideoReceiveStream* receive_stream_;
|
||||
uint32_t sent_rtp_;
|
||||
} observer;
|
||||
|
||||
CreateCalls(Call::Config(observer.SendTransport()),
|
||||
Call::Config(observer.ReceiveTransport()));
|
||||
observer.SetReceivers(receiver_call_->Receiver(), sender_call_->Receiver());
|
||||
|
||||
CreateTestConfigs();
|
||||
CreateStreams();
|
||||
observer.SetReceiveStream(receive_stream_);
|
||||
CreateFrameGenerator();
|
||||
StartSending();
|
||||
|
||||
EXPECT_EQ(kEventSignaled, observer.Wait())
|
||||
<< "Timed out while verifying number of received RTP packets.";
|
||||
|
||||
StopSending();
|
||||
observer.StopSending();
|
||||
DestroyStreams();
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -238,12 +238,16 @@ int ViEReceiver::InsertRTPPacket(const uint8_t* rtp_packet,
|
||||
header.payload_type_frequency = kVideoPayloadTypeFrequency;
|
||||
|
||||
bool in_order = IsPacketInOrder(header);
|
||||
rtp_receive_statistics_->IncomingPacket(
|
||||
header, rtp_packet_length, IsPacketRetransmitted(header, in_order));
|
||||
rtp_payload_registry_->SetIncomingPayloadType(header);
|
||||
return ReceivePacket(rtp_packet, rtp_packet_length, header, in_order)
|
||||
int ret = ReceivePacket(rtp_packet, rtp_packet_length, header, in_order)
|
||||
? 0
|
||||
: -1;
|
||||
// Update receive statistics after ReceivePacket.
|
||||
// Receive statistics will be reset if the payload type changes (make sure
|
||||
// that the first packet is included in the stats).
|
||||
rtp_receive_statistics_->IncomingPacket(
|
||||
header, rtp_packet_length, IsPacketRetransmitted(header, in_order));
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ViEReceiver::ReceivePacket(const uint8_t* packet,
|
||||
|
Loading…
x
Reference in New Issue
Block a user