From 4ce0ba00de6004673f484083a6bd2b8f4597be2a Mon Sep 17 00:00:00 2001 From: "stefan@webrtc.org" Date: Tue, 28 Feb 2012 12:09:09 +0000 Subject: [PATCH] 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 --- .../video_coding/main/source/session_info.cc | 3 +++ .../main/source/session_info_unittest.cc | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) 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;