VCM:Accounting for bounds when inserting packets. We currently receive indicators to the first and last packets of the frame, but not have any sanity to verify that all packets are indeed within the bounds (when available). This cl attempts to fix that,
BUG= R=marpan@google.com Review URL: https://webrtc-codereview.appspot.com/2077004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4614 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
c9fa0fede5
commit
f31a47abdc
@ -32,7 +32,7 @@ TEST(TestDecodingState, FrameContinuity) {
|
||||
VCMFrameBuffer frame;
|
||||
VCMFrameBuffer frame_key;
|
||||
VCMPacket* packet = new VCMPacket();
|
||||
packet->isFirstPacket = 1;
|
||||
packet->isFirstPacket = true;
|
||||
packet->timestamp = 1;
|
||||
packet->seqNum = 0xffff;
|
||||
packet->frameType = kVideoFrameDelta;
|
||||
@ -41,40 +41,41 @@ TEST(TestDecodingState, FrameContinuity) {
|
||||
FrameData frame_data;
|
||||
frame_data.rtt_ms = 0;
|
||||
frame_data.rolling_average_packets_per_frame = -1;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
// Always start with a key frame.
|
||||
dec_state.Reset();
|
||||
EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
|
||||
packet->frameType = kVideoFrameKey;
|
||||
frame_key.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame_key.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
EXPECT_TRUE(dec_state.ContinuousFrame(&frame_key));
|
||||
dec_state.SetState(&frame);
|
||||
frame.Reset();
|
||||
packet->frameType = kVideoFrameDelta;
|
||||
// Use pictureId
|
||||
packet->isFirstPacket = false;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 0x0002;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
|
||||
frame.Reset();
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 0;
|
||||
packet->seqNum = 10;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
|
||||
|
||||
// Use sequence numbers.
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = kNoPictureId;
|
||||
frame.Reset();
|
||||
packet->seqNum = dec_state.sequence_num() - 1u;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
|
||||
frame.Reset();
|
||||
packet->seqNum = dec_state.sequence_num() + 1u;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
// Insert another packet to this frame
|
||||
packet->seqNum++;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
// Verify wrap.
|
||||
EXPECT_EQ(dec_state.sequence_num(), 0xffff);
|
||||
EXPECT_LE(dec_state.sequence_num(), 0xffff);
|
||||
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
|
||||
dec_state.SetState(&frame);
|
||||
|
||||
@ -87,7 +88,7 @@ TEST(TestDecodingState, FrameContinuity) {
|
||||
packet->seqNum = 1;
|
||||
packet->timestamp = 1;
|
||||
EXPECT_TRUE(dec_state.full_sync());
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
dec_state.SetState(&frame);
|
||||
EXPECT_TRUE(dec_state.full_sync());
|
||||
frame.Reset();
|
||||
@ -97,7 +98,7 @@ TEST(TestDecodingState, FrameContinuity) {
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 1;
|
||||
packet->seqNum = 2;
|
||||
packet->timestamp = 2;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
|
||||
dec_state.SetState(&frame);
|
||||
EXPECT_TRUE(dec_state.full_sync());
|
||||
@ -108,7 +109,7 @@ TEST(TestDecodingState, FrameContinuity) {
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 3;
|
||||
packet->seqNum = 4;
|
||||
packet->timestamp = 4;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
|
||||
// Now insert the next non-base layer (belonging to a next tl0PicId).
|
||||
frame.Reset();
|
||||
@ -117,7 +118,7 @@ TEST(TestDecodingState, FrameContinuity) {
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 4;
|
||||
packet->seqNum = 5;
|
||||
packet->timestamp = 5;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
// Checking continuity and not updating the state - this should not trigger
|
||||
// an update of sync state.
|
||||
EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
|
||||
@ -129,7 +130,7 @@ TEST(TestDecodingState, FrameContinuity) {
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 5;
|
||||
packet->seqNum = 6;
|
||||
packet->timestamp = 6;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
|
||||
dec_state.SetState(&frame);
|
||||
EXPECT_FALSE(dec_state.full_sync());
|
||||
@ -141,7 +142,7 @@ TEST(TestDecodingState, FrameContinuity) {
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 6;
|
||||
packet->seqNum = 7;
|
||||
packet->timestamp = 7;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
dec_state.SetState(&frame);
|
||||
EXPECT_FALSE(dec_state.full_sync());
|
||||
frame.Reset();
|
||||
@ -150,7 +151,7 @@ TEST(TestDecodingState, FrameContinuity) {
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 7;
|
||||
packet->seqNum = 8;
|
||||
packet->timestamp = 8;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
|
||||
// The current frame is not continuous
|
||||
dec_state.SetState(&frame);
|
||||
@ -170,7 +171,7 @@ TEST(TestDecodingState, UpdateOldPacket) {
|
||||
FrameData frame_data;
|
||||
frame_data.rtt_ms = 0;
|
||||
frame_data.rolling_average_packets_per_frame = -1;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
dec_state.SetState(&frame);
|
||||
EXPECT_EQ(dec_state.sequence_num(), 1);
|
||||
// Insert an empty packet that does not belong to the same frame.
|
||||
@ -222,7 +223,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
FrameData frame_data;
|
||||
frame_data.rtt_ms = 0;
|
||||
frame_data.rolling_average_packets_per_frame = -1;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
dec_state.SetState(&frame);
|
||||
// tl0PicIdx 0, temporal id 1.
|
||||
frame.Reset();
|
||||
@ -231,7 +232,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
packet->codecSpecificHeader.codecHeader.VP8.tl0PicIdx = 0;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.temporalIdx = 1;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 1;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
|
||||
dec_state.SetState(&frame);
|
||||
EXPECT_TRUE(dec_state.full_sync());
|
||||
@ -243,7 +244,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
packet->codecSpecificHeader.codecHeader.VP8.tl0PicIdx = 0;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.temporalIdx = 3;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 3;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
|
||||
dec_state.SetState(&frame);
|
||||
EXPECT_FALSE(dec_state.full_sync());
|
||||
@ -254,7 +255,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
packet->codecSpecificHeader.codecHeader.VP8.tl0PicIdx = 1;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.temporalIdx = 0;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 4;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
|
||||
dec_state.SetState(&frame);
|
||||
EXPECT_FALSE(dec_state.full_sync());
|
||||
@ -268,7 +269,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
packet->codecSpecificHeader.codecHeader.VP8.tl0PicIdx = 2;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.temporalIdx = 0;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 5;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
|
||||
dec_state.SetState(&frame);
|
||||
EXPECT_TRUE(dec_state.full_sync());
|
||||
@ -281,7 +282,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
packet->codecSpecificHeader.codecHeader.VP8.tl0PicIdx = 3;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.temporalIdx = 0;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 6;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
|
||||
EXPECT_TRUE(dec_state.full_sync());
|
||||
frame.Reset();
|
||||
@ -292,7 +293,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
packet->codecSpecificHeader.codecHeader.VP8.tl0PicIdx = 4;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.temporalIdx = 0;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 8;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
|
||||
EXPECT_TRUE(dec_state.full_sync());
|
||||
dec_state.SetState(&frame);
|
||||
@ -308,7 +309,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
packet->codecSpecificHeader.codecHeader.VP8.temporalIdx = 2;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 9;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.layerSync = true;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
dec_state.SetState(&frame);
|
||||
EXPECT_TRUE(dec_state.full_sync());
|
||||
|
||||
@ -329,7 +330,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
packet->codecSpecificHeader.codecHeader.VP8.temporalIdx = 0;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 0;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.layerSync = false;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
dec_state.SetState(&frame);
|
||||
EXPECT_TRUE(dec_state.full_sync());
|
||||
// Layer 2 - 2 packets (insert one, lose one).
|
||||
@ -343,7 +344,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
packet->codecSpecificHeader.codecHeader.VP8.temporalIdx = 2;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 1;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.layerSync = true;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
|
||||
// Layer 1
|
||||
frame.Reset();
|
||||
@ -356,7 +357,7 @@ TEST(TestDecodingState, MultiLayerBehavior) {
|
||||
packet->codecSpecificHeader.codecHeader.VP8.temporalIdx = 1;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.pictureId = 2;
|
||||
packet->codecSpecificHeader.codecHeader.VP8.layerSync = true;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
|
||||
EXPECT_TRUE(dec_state.full_sync());
|
||||
|
||||
@ -378,7 +379,7 @@ TEST(TestDecodingState, DiscontinuousPicIdContinuousSeqNum) {
|
||||
FrameData frame_data;
|
||||
frame_data.rtt_ms = 0;
|
||||
frame_data.rolling_average_packets_per_frame = -1;
|
||||
frame.InsertPacket(packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
|
||||
dec_state.SetState(&frame);
|
||||
EXPECT_TRUE(dec_state.full_sync());
|
||||
|
||||
@ -390,7 +391,7 @@ TEST(TestDecodingState, DiscontinuousPicIdContinuousSeqNum) {
|
||||
++packet.seqNum;
|
||||
packet.codecSpecificHeader.codecHeader.VP8.temporalIdx = 1;
|
||||
packet.codecSpecificHeader.codecHeader.VP8.pictureId = 2;
|
||||
frame.InsertPacket(packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
|
||||
EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
|
||||
dec_state.SetState(&frame);
|
||||
EXPECT_FALSE(dec_state.full_sync());
|
||||
@ -407,7 +408,7 @@ TEST(TestDecodingState, OldInput) {
|
||||
FrameData frame_data;
|
||||
frame_data.rtt_ms = 0;
|
||||
frame_data.rolling_average_packets_per_frame = -1;
|
||||
frame.InsertPacket(*packet, 0, kNoErrors, frame_data);
|
||||
EXPECT_LE(0, frame.InsertPacket(*packet, 0, kNoErrors, frame_data));
|
||||
dec_state.SetState(&frame);
|
||||
packet->timestamp = 9;
|
||||
EXPECT_TRUE(dec_state.IsOldPacket(packet));
|
||||
|
@ -148,6 +148,8 @@ VCMFrameBuffer::InsertPacket(const VCMPacket& packet,
|
||||
return kSizeError;
|
||||
} else if (retVal == -2) {
|
||||
return kDuplicatePacket;
|
||||
} else if (retVal == -3) {
|
||||
return kOutOfBoundsPacket;
|
||||
}
|
||||
// update length
|
||||
_length = Length() + static_cast<uint32_t>(retVal);
|
||||
|
@ -798,6 +798,7 @@ VCMFrameBufferEnum VCMJitterBuffer::InsertPacket(const VCMPacket& packet,
|
||||
break;
|
||||
}
|
||||
case kNoError:
|
||||
case kOutOfBoundsPacket:
|
||||
case kDuplicatePacket: {
|
||||
break;
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ enum VCMJitterBufferEnum {
|
||||
};
|
||||
|
||||
enum VCMFrameBufferEnum {
|
||||
kOutOfBoundsPacket = -7,
|
||||
kNotInitialized = -6,
|
||||
kOldPacket = -5,
|
||||
kGeneralError = -4,
|
||||
|
@ -30,7 +30,9 @@ VCMSessionInfo::VCMSessionInfo()
|
||||
packets_(),
|
||||
empty_seq_num_low_(-1),
|
||||
empty_seq_num_high_(-1),
|
||||
packets_not_decodable_(0) {
|
||||
packets_not_decodable_(0),
|
||||
first_packet_seq_num_(-1),
|
||||
last_packet_seq_num_(-1) {
|
||||
}
|
||||
|
||||
void VCMSessionInfo::UpdateDataPointers(const uint8_t* old_base_ptr,
|
||||
@ -100,6 +102,8 @@ void VCMSessionInfo::Reset() {
|
||||
empty_seq_num_low_ = -1;
|
||||
empty_seq_num_high_ = -1;
|
||||
packets_not_decodable_ = 0;
|
||||
first_packet_seq_num_ = -1;
|
||||
last_packet_seq_num_ = -1;
|
||||
}
|
||||
|
||||
int VCMSessionInfo::SessionLength() const {
|
||||
@ -164,7 +168,7 @@ void VCMSessionInfo::ShiftSubsequentPackets(PacketIterator it,
|
||||
}
|
||||
|
||||
void VCMSessionInfo::UpdateCompleteSession() {
|
||||
if (packets_.front().isFirstPacket && packets_.back().markerBit) {
|
||||
if (HaveFirstPacket() && HaveLastPacket()) {
|
||||
// Do we have all the packets in this session?
|
||||
bool complete_session = true;
|
||||
PacketIterator it = packets_.begin();
|
||||
@ -383,12 +387,12 @@ void VCMSessionInfo::SetNotDecodableIfIncomplete() {
|
||||
|
||||
bool
|
||||
VCMSessionInfo::HaveFirstPacket() const {
|
||||
return !packets_.empty() && packets_.front().isFirstPacket;
|
||||
return !packets_.empty() && (first_packet_seq_num_ != -1);
|
||||
}
|
||||
|
||||
bool
|
||||
VCMSessionInfo::HaveLastPacket() const {
|
||||
return (!packets_.empty() && packets_.back().markerBit);
|
||||
return !packets_.empty() && (last_packet_seq_num_ != -1);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -400,14 +404,6 @@ int VCMSessionInfo::InsertPacket(const VCMPacket& packet,
|
||||
uint8_t* frame_buffer,
|
||||
VCMDecodeErrorMode decode_error_mode,
|
||||
const FrameData& frame_data) {
|
||||
// Check if this is first packet (only valid for some codecs)
|
||||
if (packet.isFirstPacket) {
|
||||
// The first packet in a frame signals the frame type.
|
||||
frame_type_ = packet.frameType;
|
||||
} else if (frame_type_ == kFrameEmpty && packet.frameType != kFrameEmpty) {
|
||||
// Update the frame type with the first media packet.
|
||||
frame_type_ = packet.frameType;
|
||||
}
|
||||
if (packet.frameType == kFrameEmpty) {
|
||||
// Update sequence number of an empty packet.
|
||||
// Only media packets are inserted into the packet list.
|
||||
@ -415,8 +411,9 @@ int VCMSessionInfo::InsertPacket(const VCMPacket& packet,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (packets_.size() == kMaxPacketsInSession)
|
||||
if (packets_.size() == kMaxPacketsInSession) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Find the position of this packet in the packet list in sequence number
|
||||
// order and insert it. Loop over the list in reverse order.
|
||||
@ -430,6 +427,32 @@ int VCMSessionInfo::InsertPacket(const VCMPacket& packet,
|
||||
(*rit).seqNum == packet.seqNum && (*rit).sizeBytes > 0)
|
||||
return -2;
|
||||
|
||||
// Only insert media packets between first and last packets (when available).
|
||||
// Placing check here, as to properly account for duplicate packets.
|
||||
// Check if this is first packet (only valid for some codecs)
|
||||
// Should only be set for one packet per session.
|
||||
if (packet.isFirstPacket && first_packet_seq_num_ == -1) {
|
||||
// The first packet in a frame signals the frame type.
|
||||
frame_type_ = packet.frameType;
|
||||
// Store the sequence number for the first packet.
|
||||
first_packet_seq_num_ = static_cast<int>(packet.seqNum);
|
||||
} else if (first_packet_seq_num_ != -1 &&
|
||||
!IsNewerSequenceNumber(packet.seqNum, first_packet_seq_num_)) {
|
||||
return -3;
|
||||
} else if (frame_type_ == kFrameEmpty && packet.frameType != kFrameEmpty) {
|
||||
// Update the frame type with the type of the first media packet.
|
||||
// TODO(mikhal): Can this trigger?
|
||||
frame_type_ = packet.frameType;
|
||||
}
|
||||
|
||||
// Track the marker bit, should only be set for one packet per session.
|
||||
if (packet.markerBit && last_packet_seq_num_ == -1) {
|
||||
last_packet_seq_num_ = static_cast<int>(packet.seqNum);
|
||||
} else if (last_packet_seq_num_ != -1 &&
|
||||
IsNewerSequenceNumber(packet.seqNum, last_packet_seq_num_)) {
|
||||
return -3;
|
||||
}
|
||||
|
||||
// The insert operation invalidates the iterator |rit|.
|
||||
PacketIterator packet_list_it = packets_.insert(rit.base(), packet);
|
||||
|
||||
@ -439,7 +462,6 @@ int VCMSessionInfo::InsertPacket(const VCMPacket& packet,
|
||||
decodable_ = true;
|
||||
else if (decode_error_mode == kSelectiveErrors)
|
||||
UpdateDecodableSession(frame_data);
|
||||
|
||||
return returnLength;
|
||||
}
|
||||
|
||||
|
@ -155,6 +155,14 @@ class VCMSessionInfo {
|
||||
int empty_seq_num_high_;
|
||||
// Number of packets discarded because the decoder can't use them.
|
||||
int packets_not_decodable_;
|
||||
|
||||
// The following two variables correspond to the first and last media packets
|
||||
// in a session defined by the first packet flag and the marker bit.
|
||||
// They are not necessarily equal to the front and back packets, as packets
|
||||
// may enter out of order.
|
||||
// TODO(mikhal): Refactor the list to use a map.
|
||||
int first_packet_seq_num_;
|
||||
int last_packet_seq_num_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -153,7 +153,7 @@ TEST_F(TestSessionInfo, TestSimpleAPIs) {
|
||||
packet_.sizeBytes = packet_buffer_size();
|
||||
packet_.frameType = kVideoFrameKey;
|
||||
FillPacket(0);
|
||||
ASSERT_EQ(packet_buffer_size(),
|
||||
EXPECT_EQ(packet_buffer_size(),
|
||||
session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
@ -164,7 +164,7 @@ TEST_F(TestSessionInfo, TestSimpleAPIs) {
|
||||
packet_.isFirstPacket = false;
|
||||
packet_.markerBit = true;
|
||||
packet_.seqNum += 1;
|
||||
ASSERT_EQ(packet_buffer_size(),
|
||||
EXPECT_EQ(packet_buffer_size(),
|
||||
session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
@ -180,7 +180,7 @@ TEST_F(TestSessionInfo, TestSimpleAPIs) {
|
||||
packet_.seqNum = 2;
|
||||
packet_.sizeBytes = 0;
|
||||
packet_.frameType = kFrameEmpty;
|
||||
ASSERT_EQ(0,
|
||||
EXPECT_EQ(0,
|
||||
session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
@ -193,7 +193,7 @@ TEST_F(TestSessionInfo, NormalOperation) {
|
||||
packet_.isFirstPacket = true;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(0);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -213,7 +213,7 @@ TEST_F(TestSessionInfo, NormalOperation) {
|
||||
packet_.seqNum += 1;
|
||||
packet_.markerBit = true;
|
||||
FillPacket(9);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -232,7 +232,7 @@ TEST_F(TestSessionInfo, ErrorsEqualDecodableState) {
|
||||
packet_.isFirstPacket = false;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(3);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kWithErrors,
|
||||
frame_data),
|
||||
@ -248,7 +248,7 @@ TEST_F(TestSessionInfo, SelectiveDecodableState) {
|
||||
FillPacket(1);
|
||||
frame_data.rolling_average_packets_per_frame = 11;
|
||||
frame_data.rtt_ms = 150;
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kSelectiveErrors,
|
||||
frame_data),
|
||||
@ -259,7 +259,7 @@ TEST_F(TestSessionInfo, SelectiveDecodableState) {
|
||||
packet_.seqNum -= 1;
|
||||
FillPacket(0);
|
||||
packet_.isFirstPacket = true;
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kSelectiveErrors,
|
||||
frame_data),
|
||||
@ -272,7 +272,7 @@ TEST_F(TestSessionInfo, SelectiveDecodableState) {
|
||||
for (int i = 2; i < 8; ++i) {
|
||||
packet_.seqNum += 1;
|
||||
FillPacket(i);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kSelectiveErrors,
|
||||
frame_data),
|
||||
@ -283,7 +283,7 @@ TEST_F(TestSessionInfo, SelectiveDecodableState) {
|
||||
|
||||
packet_.seqNum += 1;
|
||||
FillPacket(8);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kSelectiveErrors,
|
||||
frame_data),
|
||||
@ -292,6 +292,202 @@ TEST_F(TestSessionInfo, SelectiveDecodableState) {
|
||||
EXPECT_TRUE(session_.decodable());
|
||||
}
|
||||
|
||||
TEST_F(TestSessionInfo, OutOfBoundsPackets1PacketFrame) {
|
||||
packet_.seqNum = 0x0001;
|
||||
packet_.isFirstPacket = true;
|
||||
packet_.markerBit = true;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
packet_buffer_size());
|
||||
|
||||
packet_.seqNum = 0x0004;
|
||||
packet_.isFirstPacket = true;
|
||||
packet_.markerBit = true;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(-3, session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
packet_.seqNum = 0x0000;
|
||||
packet_.isFirstPacket = false;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(-3, session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
}
|
||||
|
||||
TEST_F(TestSessionInfo, SetMarkerBitOnce) {
|
||||
packet_.seqNum = 0x0005;
|
||||
packet_.isFirstPacket = false;
|
||||
packet_.markerBit = true;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
packet_buffer_size());
|
||||
++packet_.seqNum;
|
||||
packet_.isFirstPacket = true;
|
||||
packet_.markerBit = true;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(-3, session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
}
|
||||
|
||||
TEST_F(TestSessionInfo, OutOfBoundsPacketsBase) {
|
||||
// Allow packets in the range 5-6.
|
||||
packet_.seqNum = 0x0005;
|
||||
packet_.isFirstPacket = true;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(packet_buffer_size(),
|
||||
session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
// Insert an older packet with a first packet set.
|
||||
packet_.seqNum = 0x0004;
|
||||
packet_.isFirstPacket = true;
|
||||
packet_.markerBit = true;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(-3, session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
packet_.seqNum = 0x0006;
|
||||
packet_.isFirstPacket = true;
|
||||
packet_.markerBit = true;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(packet_buffer_size(),
|
||||
session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
packet_.seqNum = 0x0008;
|
||||
packet_.isFirstPacket = false;
|
||||
packet_.markerBit = true;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(-3, session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
}
|
||||
|
||||
TEST_F(TestSessionInfo, OutOfBoundsPacketsWrap) {
|
||||
packet_.seqNum = 0xFFFE;
|
||||
packet_.isFirstPacket = true;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(packet_buffer_size(),
|
||||
session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
|
||||
packet_.seqNum = 0x0004;
|
||||
packet_.isFirstPacket = false;
|
||||
packet_.markerBit = true;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(packet_buffer_size(),
|
||||
session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
packet_.seqNum = 0x0002;
|
||||
packet_.isFirstPacket = false;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(1);
|
||||
ASSERT_EQ(packet_buffer_size(),
|
||||
session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
packet_.seqNum = 0xFFF0;
|
||||
packet_.isFirstPacket = false;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(-3,
|
||||
session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
packet_.seqNum = 0x0006;
|
||||
packet_.isFirstPacket = false;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(-3,
|
||||
session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
}
|
||||
|
||||
TEST_F(TestSessionInfo, OutOfBoundsOutOfOrder) {
|
||||
// Insert out of bound regular packets, and then the first and last packet.
|
||||
// Verify that correct bounds are maintained.
|
||||
packet_.seqNum = 0x0003;
|
||||
packet_.isFirstPacket = false;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(packet_buffer_size(),
|
||||
session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
// Insert an older packet with a first packet set.
|
||||
packet_.seqNum = 0x0005;
|
||||
packet_.isFirstPacket = true;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(packet_buffer_size(),
|
||||
session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
packet_.seqNum = 0x0004;
|
||||
packet_.isFirstPacket = false;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(-3, session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
packet_.seqNum = 0x0010;
|
||||
packet_.isFirstPacket = false;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(packet_buffer_size(),
|
||||
session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
packet_.seqNum = 0x0008;
|
||||
packet_.isFirstPacket = false;
|
||||
packet_.markerBit = true;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(packet_buffer_size(),
|
||||
session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
|
||||
packet_.seqNum = 0x0009;
|
||||
packet_.isFirstPacket = false;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(1);
|
||||
EXPECT_EQ(-3, session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
}
|
||||
|
||||
TEST_F(TestVP8Partitions, TwoPartitionsOneLoss) {
|
||||
// Partition 0 | Partition 1
|
||||
// [ 0 ] [ 2 ] | [ 3 ]
|
||||
@ -303,7 +499,7 @@ TEST_F(TestVP8Partitions, TwoPartitionsOneLoss) {
|
||||
FillPacket(0);
|
||||
VCMPacket* packet = new VCMPacket(packet_buffer_, packet_buffer_size(),
|
||||
packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -317,7 +513,7 @@ TEST_F(TestVP8Partitions, TwoPartitionsOneLoss) {
|
||||
packet_header_.header.sequenceNumber += 2;
|
||||
FillPacket(2);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -331,7 +527,7 @@ TEST_F(TestVP8Partitions, TwoPartitionsOneLoss) {
|
||||
packet_header_.header.sequenceNumber += 1;
|
||||
FillPacket(3);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -360,7 +556,7 @@ TEST_F(TestVP8Partitions, TwoPartitionsOneLoss2) {
|
||||
FillPacket(1);
|
||||
VCMPacket* packet = new VCMPacket(packet_buffer_, packet_buffer_size(),
|
||||
packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -374,7 +570,7 @@ TEST_F(TestVP8Partitions, TwoPartitionsOneLoss2) {
|
||||
packet_header_.header.sequenceNumber += 1;
|
||||
FillPacket(2);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -388,7 +584,7 @@ TEST_F(TestVP8Partitions, TwoPartitionsOneLoss2) {
|
||||
packet_header_.header.sequenceNumber += 1;
|
||||
FillPacket(3);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -402,7 +598,7 @@ TEST_F(TestVP8Partitions, TwoPartitionsOneLoss2) {
|
||||
packet_header_.header.sequenceNumber += 2;
|
||||
FillPacket(5);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -432,7 +628,7 @@ TEST_F(TestVP8Partitions, TwoPartitionsNoLossWrap) {
|
||||
FillPacket(0);
|
||||
VCMPacket* packet = new VCMPacket(packet_buffer_, packet_buffer_size(),
|
||||
packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -446,7 +642,7 @@ TEST_F(TestVP8Partitions, TwoPartitionsNoLossWrap) {
|
||||
packet_header_.header.sequenceNumber += 1;
|
||||
FillPacket(1);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -460,7 +656,7 @@ TEST_F(TestVP8Partitions, TwoPartitionsNoLossWrap) {
|
||||
packet_header_.header.sequenceNumber += 1;
|
||||
FillPacket(2);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -474,7 +670,7 @@ TEST_F(TestVP8Partitions, TwoPartitionsNoLossWrap) {
|
||||
packet_header_.header.sequenceNumber += 1;
|
||||
FillPacket(3);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -504,7 +700,7 @@ TEST_F(TestVP8Partitions, TwoPartitionsLossWrap) {
|
||||
FillPacket(0);
|
||||
VCMPacket* packet = new VCMPacket(packet_buffer_, packet_buffer_size(),
|
||||
packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -518,7 +714,7 @@ TEST_F(TestVP8Partitions, TwoPartitionsLossWrap) {
|
||||
packet_header_.header.sequenceNumber += 1;
|
||||
FillPacket(1);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -532,7 +728,7 @@ TEST_F(TestVP8Partitions, TwoPartitionsLossWrap) {
|
||||
packet_header_.header.sequenceNumber += 1;
|
||||
FillPacket(2);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -546,7 +742,7 @@ TEST_F(TestVP8Partitions, TwoPartitionsLossWrap) {
|
||||
packet_header_.header.sequenceNumber += 2;
|
||||
FillPacket(3);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -577,7 +773,7 @@ TEST_F(TestVP8Partitions, ThreePartitionsOneMissing) {
|
||||
FillPacket(1);
|
||||
VCMPacket* packet = new VCMPacket(packet_buffer_, packet_buffer_size(),
|
||||
packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -591,7 +787,7 @@ TEST_F(TestVP8Partitions, ThreePartitionsOneMissing) {
|
||||
packet_header_.header.sequenceNumber += 1;
|
||||
FillPacket(2);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -605,7 +801,7 @@ TEST_F(TestVP8Partitions, ThreePartitionsOneMissing) {
|
||||
packet_header_.header.sequenceNumber += 3;
|
||||
FillPacket(5);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -619,7 +815,7 @@ TEST_F(TestVP8Partitions, ThreePartitionsOneMissing) {
|
||||
packet_header_.header.sequenceNumber += 1;
|
||||
FillPacket(6);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -649,7 +845,7 @@ TEST_F(TestVP8Partitions, ThreePartitionsLossInSecond) {
|
||||
FillPacket(1);
|
||||
VCMPacket* packet = new VCMPacket(packet_buffer_, packet_buffer_size(),
|
||||
packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -664,7 +860,7 @@ TEST_F(TestVP8Partitions, ThreePartitionsLossInSecond) {
|
||||
FillPacket(2);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(),
|
||||
packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -678,7 +874,7 @@ TEST_F(TestVP8Partitions, ThreePartitionsLossInSecond) {
|
||||
packet_header_.header.sequenceNumber += 2;
|
||||
FillPacket(4);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -692,7 +888,7 @@ TEST_F(TestVP8Partitions, ThreePartitionsLossInSecond) {
|
||||
packet_header_.header.sequenceNumber += 1;
|
||||
FillPacket(5);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -706,7 +902,7 @@ TEST_F(TestVP8Partitions, ThreePartitionsLossInSecond) {
|
||||
packet_header_.header.sequenceNumber += 1;
|
||||
FillPacket(6);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -720,7 +916,7 @@ TEST_F(TestVP8Partitions, ThreePartitionsLossInSecond) {
|
||||
packet_header_.header.sequenceNumber += 1;
|
||||
FillPacket(7);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -750,7 +946,7 @@ TEST_F(TestVP8Partitions, AggregationOverTwoPackets) {
|
||||
FillPacket(0);
|
||||
VCMPacket* packet = new VCMPacket(packet_buffer_, packet_buffer_size(),
|
||||
packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -764,7 +960,7 @@ TEST_F(TestVP8Partitions, AggregationOverTwoPackets) {
|
||||
packet_header_.header.sequenceNumber += 1;
|
||||
FillPacket(1);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -778,7 +974,7 @@ TEST_F(TestVP8Partitions, AggregationOverTwoPackets) {
|
||||
packet_header_.header.sequenceNumber += 1;
|
||||
FillPacket(2);
|
||||
packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
|
||||
ASSERT_EQ(session_.InsertPacket(*packet,
|
||||
EXPECT_EQ(session_.InsertPacket(*packet,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -807,7 +1003,7 @@ TEST_F(TestNalUnits, OnlyReceivedEmptyPacket) {
|
||||
packet_.sizeBytes = 0;
|
||||
packet_.seqNum = 0;
|
||||
packet_.markerBit = false;
|
||||
ASSERT_EQ(0, session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(0, session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data));
|
||||
@ -823,7 +1019,7 @@ TEST_F(TestNalUnits, OneIsolatedNaluLoss) {
|
||||
packet_.seqNum = 0;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(0);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -834,7 +1030,7 @@ TEST_F(TestNalUnits, OneIsolatedNaluLoss) {
|
||||
packet_.seqNum += 2;
|
||||
packet_.markerBit = true;
|
||||
FillPacket(2);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -855,7 +1051,7 @@ TEST_F(TestNalUnits, LossInMiddleOfNalu) {
|
||||
packet_.seqNum = 0;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(0);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -866,7 +1062,7 @@ TEST_F(TestNalUnits, LossInMiddleOfNalu) {
|
||||
packet_.seqNum += 2;
|
||||
packet_.markerBit = true;
|
||||
FillPacket(2);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -885,7 +1081,7 @@ TEST_F(TestNalUnits, StartAndEndOfLastNalUnitLost) {
|
||||
packet_.seqNum = 0;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(0);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -896,7 +1092,7 @@ TEST_F(TestNalUnits, StartAndEndOfLastNalUnitLost) {
|
||||
packet_.seqNum += 2;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(1);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -916,7 +1112,7 @@ TEST_F(TestNalUnits, ReorderWrapNoLoss) {
|
||||
packet_.seqNum += 1;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(1);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -927,7 +1123,7 @@ TEST_F(TestNalUnits, ReorderWrapNoLoss) {
|
||||
packet_.seqNum -= 1;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(0);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -938,7 +1134,7 @@ TEST_F(TestNalUnits, ReorderWrapNoLoss) {
|
||||
packet_.seqNum += 2;
|
||||
packet_.markerBit = true;
|
||||
FillPacket(2);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -957,7 +1153,7 @@ TEST_F(TestNalUnits, WrapLosses) {
|
||||
packet_.completeNALU = kNaluIncomplete;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(1);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -968,7 +1164,7 @@ TEST_F(TestNalUnits, WrapLosses) {
|
||||
packet_.seqNum += 2;
|
||||
packet_.markerBit = true;
|
||||
FillPacket(2);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -987,7 +1183,7 @@ TEST_F(TestNalUnits, ReorderWrapLosses) {
|
||||
packet_.seqNum += 2;
|
||||
packet_.markerBit = true;
|
||||
FillPacket(2);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
@ -998,7 +1194,7 @@ TEST_F(TestNalUnits, ReorderWrapLosses) {
|
||||
packet_.completeNALU = kNaluIncomplete;
|
||||
packet_.markerBit = false;
|
||||
FillPacket(1);
|
||||
ASSERT_EQ(session_.InsertPacket(packet_,
|
||||
EXPECT_EQ(session_.InsertPacket(packet_,
|
||||
frame_buffer_,
|
||||
kNoErrors,
|
||||
frame_data),
|
||||
|
Loading…
Reference in New Issue
Block a user