Add metric for number of packets discarded by JB due to not being decodable

Also fixes a couple of bugs related to sequence number wrap found while
testing.

BUG=
TEST=

Review URL: http://webrtc-codereview.appspot.com/218001

git-svn-id: http://webrtc.googlecode.com/svn/trunk@732 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org
2011-10-13 07:35:37 +00:00
parent 77d7d5455e
commit 4c059d87b3
12 changed files with 305 additions and 164 deletions

View File

@@ -819,6 +819,94 @@ int JitterBufferTest(CmdArgs& args)
TEST(bitRate > 10000000);
jb.Flush();
//
// TEST packet loss. Verify missing packets statistics and not decodable
// packets statistics.
// Insert 10 frames consisting of 4 packets and remove one from all of them.
// The last packet is a empty (non-media) packet
//
// Select a start seqNum which triggers a difficult wrap situation
seqNum = 0xffff - 4;
for (int i=0; i < 10; ++i) {
webrtc::FrameType frametype = kVideoFrameDelta;
if (i == 0)
frametype = kVideoFrameKey;
seqNum++;
timeStamp += 33*90;
packet.frameType = frametype;
if (i == 0)
packet.frameType = frametype;
packet.isFirstPacket = true;
packet.markerBit = false;
packet.seqNum = seqNum;
packet.timestamp = timeStamp;
packet.completeNALU = kNaluStart;
frameIn = jb.GetFrame(packet);
TEST(frameIn != 0);
// Insert a packet into a frame
TEST(kFirstPacket == jb.InsertPacket(frameIn, packet));
// get packet notification
TEST(timeStamp == jb.GetNextTimeStamp(10, incomingFrameType, renderTimeMs));
// check incoming frame type
TEST(incomingFrameType == frametype);
// get the frame
frameOut = jb.GetCompleteFrameForDecoding(10);
// it should not be complete
TEST(frameOut == 0);
seqNum += 2;
packet.isFirstPacket = false;
packet.markerBit = true;
packet.seqNum = seqNum;
packet.completeNALU = kNaluEnd;
frameIn = jb.GetFrame(packet);
TEST(frameIn != 0);
// Insert a packet into a frame
TEST(kIncomplete == jb.InsertPacket(frameIn, packet));
// Insert an empty (non-media) packet
seqNum++;
packet.isFirstPacket = false;
packet.markerBit = false;
packet.seqNum = seqNum;
packet.completeNALU = kNaluEnd;
packet.frameType = kFrameEmpty;
frameIn = jb.GetFrame(packet);
TEST(frameIn != 0);
// Insert a packet into a frame
TEST(kIncomplete == jb.InsertPacket(frameIn, packet));
// get the frame
frameOut = jb.GetFrameForDecoding();
// One of the packets has been discarded by the jitter buffer
CheckOutFrame(frameOut, size, false);
// check the frame type
TEST(frameOut->FrameType() == frametype);
TEST(frameOut->Complete() == false);
TEST(frameOut->MissingFrame() == false);
// Release frame (when done with decoding)
jb.ReleaseFrame(frameOut);
}
TEST(jb.NumNotDecodablePackets() == 10);
// Insert 3 old packets and verify that we have 3 discarded packets
packet.timestamp = timeStamp - 1000;
frameIn = jb.GetFrame(packet);