Fix for issue #254: windows crash of test_fec.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1600 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
marpan@webrtc.org 2012-02-04 02:45:22 +00:00
parent dde977ec83
commit 307c1ff20c

View File

@ -255,7 +255,7 @@ int main() {
(mediaPacket->data[1] & 0x80) != 0; (mediaPacket->data[1] & 0x80) != 0;
} }
mediaPacketIdx++; mediaPacketIdx++;
mediaPacketListItem++; ++mediaPacketListItem;
} }
memset(fecLossMask, 0, sizeof(fecLossMask)); memset(fecLossMask, 0, sizeof(fecLossMask));
std::list<ForwardErrorCorrection::Packet*>::iterator std::list<ForwardErrorCorrection::Packet*>::iterator
@ -288,7 +288,7 @@ int main() {
} }
fecPacketIdx++; fecPacketIdx++;
seqNum++; seqNum++;
fecPacketListItem++; ++fecPacketListItem;
} }
#ifdef VERBOSE_OUTPUT #ifdef VERBOSE_OUTPUT
@ -318,7 +318,7 @@ int main() {
} }
} }
std::list<WebRtc_UWord8*>::iterator itemToDelete = fecMaskIt; std::list<WebRtc_UWord8*>::iterator itemToDelete = fecMaskIt;
fecMaskIt++; ++fecMaskIt;
if (hammingDist == 1) { if (hammingDist == 1) {
// Recovery possible. Restart search. // Recovery possible. Restart search.
@ -356,7 +356,7 @@ int main() {
if (receivedPacket->isFec) { if (receivedPacket->isFec) {
fecPacketReceived = true; fecPacketReceived = true;
} }
toDecodeIt++; ++toDecodeIt;
} }
} }
if (fec.DecodeFEC(&toDecodeList, &recoveredPacketList, seqNum, if (fec.DecodeFEC(&toDecodeList, &recoveredPacketList, seqNum,
@ -422,7 +422,7 @@ int main() {
recoveredPacketList.pop_front(); recoveredPacketList.pop_front();
} }
mediaPacketIdx++; mediaPacketIdx++;
mediaPacketListItem++; ++mediaPacketListItem;
} }
if (!recoveredPacketList.empty()) { if (!recoveredPacketList.empty()) {
printf("Error: excessive number of recovered packets.\n"); printf("Error: excessive number of recovered packets.\n");
@ -434,14 +434,14 @@ int main() {
mediaPacketListItem = mediaPacketList.begin(); mediaPacketListItem = mediaPacketList.begin();
while (mediaPacketListItem != mediaPacketList.end()) { while (mediaPacketListItem != mediaPacketList.end()) {
delete *mediaPacketListItem; delete *mediaPacketListItem;
mediaPacketListItem++; ++mediaPacketListItem;
mediaPacketList.pop_front(); mediaPacketList.pop_front();
} }
assert(mediaPacketList.empty()); assert(mediaPacketList.empty());
fecPacketListItem = fecPacketList.begin(); fecPacketListItem = fecPacketList.begin();
while (fecPacketListItem != fecPacketList.end()) { while (fecPacketListItem != fecPacketList.end()) {
fecPacketListItem++; ++fecPacketListItem;
fecPacketList.pop_front(); fecPacketList.pop_front();
} }
@ -453,7 +453,7 @@ int main() {
receivedPacket = *receivedPacketIt; receivedPacket = *receivedPacketIt;
delete receivedPacket->pkt; delete receivedPacket->pkt;
delete receivedPacket; delete receivedPacket;
receivedPacketIt++; ++receivedPacketIt;
receivedPacketList.pop_front(); receivedPacketList.pop_front();
} }
assert(receivedPacketList.empty()); assert(receivedPacketList.empty());
@ -492,9 +492,9 @@ void ReceivePackets(
// Reorder packets. // Reorder packets.
float randomVariable = static_cast<float>(rand()) / RAND_MAX; float randomVariable = static_cast<float>(rand()) / RAND_MAX;
while (randomVariable < reorderRate) { while (randomVariable < reorderRate) {
it++; ++it;
if (it == receivedPacketList->end()) { if (it == receivedPacketList->end()) {
it++; --it;
break; break;
} }
randomVariable = static_cast<float>(rand()) / RAND_MAX; randomVariable = static_cast<float>(rand()) / RAND_MAX;