Fix issue 310.

BUG=310
TEST=session_info_unittest.cc

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1782 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org 2012-02-28 12:09:09 +00:00
parent 14b0247f01
commit 4ce0ba00de
2 changed files with 18 additions and 1 deletions

View File

@ -325,6 +325,9 @@ bool VCMSessionInfo::InSequence(const PacketIterator& packet_it,
int VCMSessionInfo::MakeDecodable() {
int return_length = 0;
if (packets_.empty()) {
return 0;
}
PacketIterator it = packets_.begin();
// Make sure we remove the first NAL unit if it's not decodable.
if ((*it).completeNALU == kNaluIncomplete ||

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -622,6 +622,20 @@ TEST_F(TestVP8Partitions, AggregationOverTwoPackets) {
EXPECT_TRUE(VerifyPartition(2, 1, 2));
}
TEST_F(TestNalUnits, OnlyReceivedEmptyPacket) {
packet_.isFirstPacket = false;
packet_.completeNALU = kNaluComplete;
packet_.frameType = kFrameEmpty;
packet_.sizeBytes = 0;
packet_.seqNum = 0;
packet_.markerBit = false;
ASSERT_EQ(0, session_.InsertPacket(packet_, frame_buffer_, false, 0));
EXPECT_EQ(0, session_.MakeDecodable());
EXPECT_EQ(0, session_.SessionLength());
EXPECT_EQ(0, session_.packets_not_decodable());
}
TEST_F(TestNalUnits, OneIsolatedNaluLoss) {
packet_.isFirstPacket = true;
packet_.completeNALU = kNaluComplete;