Fix crash in SessionInfo::BuildSoftNackList.

BUG=259
TEST=

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1609 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org
2012-02-06 14:06:39 +00:00
parent a39621ee1b
commit 94355e0a59

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 * 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 * that can be found in the LICENSE file in the root of the source
@ -421,7 +421,8 @@ int VCMSessionInfo::BuildSoftNackList(int* seq_num_list,
base_available = true; base_available = true;
} }
} }
bool allow_nack = (!packets_.front().isFirstPacket || !base_available); bool allow_nack = ((packets_.size() > 0 && !packets_.front().isFirstPacket)
|| !base_available);
// Zero out between first entry and end point. // Zero out between first entry and end point.
@ -447,6 +448,7 @@ int VCMSessionInfo::BuildSoftNackList(int* seq_num_list,
float rtt_score = 1.0f; float rtt_score = 1.0f;
float score_multiplier = rtt_score * layer_score; float score_multiplier = rtt_score * layer_score;
// Zero out between first entry and end point. // Zero out between first entry and end point.
if (!packets_.empty()) {
PacketIterator it = packets_.begin(); PacketIterator it = packets_.begin();
PacketIterator prev_it = it; PacketIterator prev_it = it;
++index; ++index;
@ -478,6 +480,7 @@ int VCMSessionInfo::BuildSoftNackList(int* seq_num_list,
prev_it = it; prev_it = it;
++it; ++it;
} }
}
// Empty packets follow the data packets, and therefore have a higher // Empty packets follow the data packets, and therefore have a higher
// sequence number. We do not want to NACK empty packets. // sequence number. We do not want to NACK empty packets.