Fix mismatch between different NACK list lengths and packet buffers.

This is a second version of http://review.webrtc.org/1065006/ which passes the parameters via methods instead of via constructors.

BUG=1289

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3456 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org
2013-02-01 15:09:57 +00:00
parent b586507986
commit becf9c897c
36 changed files with 316 additions and 130 deletions

View File

@ -8,12 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtcp_receiver_help.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.h"
#include <string.h> // memset
#include <cassert> // assert
#include "modules/rtp_rtcp/source/rtp_utility.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
namespace webrtc {
using namespace RTCPHelp;
@ -21,8 +21,7 @@ using namespace RTCPHelp;
RTCPPacketInformation::RTCPPacketInformation()
: rtcpPacketTypeFlags(0),
remoteSSRC(0),
nackSequenceNumbers(0),
nackSequenceNumbersLength(0),
nackSequenceNumbers(),
applicationSubType(0),
applicationName(0),
applicationData(),
@ -44,7 +43,6 @@ RTCPPacketInformation::RTCPPacketInformation()
RTCPPacketInformation::~RTCPPacketInformation()
{
delete [] nackSequenceNumbers;
delete [] applicationData;
delete VoIPMetric;
}
@ -84,23 +82,16 @@ void RTCPPacketInformation::AddApplicationData(const WebRtc_UWord8* data,
void
RTCPPacketInformation::ResetNACKPacketIdArray()
{
if (NULL == nackSequenceNumbers)
{
nackSequenceNumbers = new WebRtc_UWord16[NACK_PACKETS_MAX_SIZE];
}
nackSequenceNumbersLength = 0;
nackSequenceNumbers.clear();
}
void
RTCPPacketInformation::AddNACKPacket(const WebRtc_UWord16 packetID)
{
assert(nackSequenceNumbers);
WebRtc_UWord16& idx = nackSequenceNumbersLength;
if (idx < NACK_PACKETS_MAX_SIZE)
{
nackSequenceNumbers[idx++] = packetID;
}
if (nackSequenceNumbers.size() >= kSendSideNackListSizeSanity) {
return;
}
nackSequenceNumbers.push_back(packetID);
}
void