diff --git a/src/modules/video_coding/main/source/session_info.cc b/src/modules/video_coding/main/source/session_info.cc index 21b80a027..726140386 100644 --- a/src/modules/video_coding/main/source/session_info.cc +++ b/src/modules/video_coding/main/source/session_info.cc @@ -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 || diff --git a/src/modules/video_coding/main/source/session_info_unittest.cc b/src/modules/video_coding/main/source/session_info_unittest.cc index 8c3f9af83..e0177355a 100644 --- a/src/modules/video_coding/main/source/session_info_unittest.cc +++ b/src/modules/video_coding/main/source/session_info_unittest.cc @@ -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;