PacketBuffer now correctly cast sequence numbers to uint16_t.

BUG=webrtc:5514

Review-Url: https://codereview.webrtc.org/2603223002
Cr-Commit-Position: refs/heads/master@{#15885}
This commit is contained in:
philipel 2017-01-03 05:55:34 -08:00 committed by Commit bot
parent d026354410
commit 2c2f34c1ca
2 changed files with 10 additions and 2 deletions

View File

@ -187,7 +187,7 @@ bool PacketBuffer::PotentialNewFrame(uint16_t seq_num) const {
if (!sequence_buffer_[prev_index].used)
return false;
if (sequence_buffer_[prev_index].seq_num !=
sequence_buffer_[index].seq_num - 1) {
static_cast<uint16_t>(sequence_buffer_[index].seq_num - 1)) {
return false;
}
if (sequence_buffer_[prev_index].continuous)

View File

@ -102,11 +102,19 @@ TEST_F(TestPacketBuffer, InsertDuplicatePacket) {
EXPECT_TRUE(Insert(seq_num, kKeyFrame, kFirst, kLast));
}
TEST_F(TestPacketBuffer, SeqNumWrap) {
TEST_F(TestPacketBuffer, SeqNumWrapOneFrame) {
EXPECT_TRUE(Insert(0xFFFF, kKeyFrame, kFirst, kNotLast));
EXPECT_TRUE(Insert(0x0, kKeyFrame, kNotFirst, kLast));
CheckFrame(0xFFFF);
}
TEST_F(TestPacketBuffer, SeqNumWrapTwoFrames) {
EXPECT_TRUE(Insert(0xFFFF, kKeyFrame, kFirst, kLast));
EXPECT_TRUE(Insert(0x0, kKeyFrame, kFirst, kLast));
CheckFrame(0xFFFF);
CheckFrame(0x0);
}
TEST_F(TestPacketBuffer, InsertOldPackets) {