Fixes a coverity warning in the mixer module.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1688 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrike@webrtc.org 2012-02-15 00:04:27 +00:00
parent 132261446b
commit b38a66aaac

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
@ -803,15 +803,23 @@ void AudioConferenceMixerImpl::UpdateToMix(
bool replaceWasMixed = false; bool replaceWasMixed = false;
MapItem* replaceParticipant = mixParticipantList.Find( MapItem* replaceParticipant = mixParticipantList.Find(
replaceFrame->_id); replaceFrame->_id);
// When a frame is pushed to |activeList| it is also pushed
// to mixParticipantList with the frame's id. This means
// that the Find call above should never fail.
if(replaceParticipant == NULL)
{
assert(false);
} else {
static_cast<MixerParticipant*>( static_cast<MixerParticipant*>(
replaceParticipant->GetItem())->_mixHistory->WasMixed( replaceParticipant->GetItem())->_mixHistory->
replaceWasMixed); WasMixed(replaceWasMixed);
mixParticipantList.Erase(replaceFrame->_id); mixParticipantList.Erase(replaceFrame->_id);
activeList.Erase(replaceItem); activeList.Erase(replaceItem);
activeList.PushFront(static_cast<void*>(audioFrame)); activeList.PushFront(static_cast<void*>(audioFrame));
mixParticipantList.Insert(audioFrame->_id, mixParticipantList.Insert(
audioFrame->_id,
static_cast<void*>(participant)); static_cast<void*>(participant));
assert(mixParticipantList.Size() <= assert(mixParticipantList.Size() <=
kMaximumAmountOfMixedParticipants); kMaximumAmountOfMixedParticipants);
@ -819,12 +827,14 @@ void AudioConferenceMixerImpl::UpdateToMix(
if(replaceWasMixed) if(replaceWasMixed)
{ {
RampOut(*replaceFrame); RampOut(*replaceFrame);
rampOutList.PushBack(static_cast<void*>(replaceFrame)); rampOutList.PushBack(
static_cast<void*>(replaceFrame));
assert(rampOutList.GetSize() <= assert(rampOutList.GetSize() <=
kMaximumAmountOfMixedParticipants); kMaximumAmountOfMixedParticipants);
} else { } else {
_audioFramePool->PushMemory(replaceFrame); _audioFramePool->PushMemory(replaceFrame);
} }
}
} else { } else {
if(wasMixed) if(wasMixed)
{ {