From 5a216d0489b2374a778c90e657fb71a6def5d1a1 Mon Sep 17 00:00:00 2001 From: "henrik.lundin" Date: Wed, 18 May 2016 02:34:17 -0700 Subject: [PATCH] Add muted parameter to audio_frame_manipulator methods BUG=webrtc:5609 NOTRY=True Review-Url: https://codereview.webrtc.org/1983023002 Cr-Commit-Position: refs/heads/master@{#12788} --- .../source/audio_conference_mixer_impl.cc | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/webrtc/modules/audio_conference_mixer/source/audio_conference_mixer_impl.cc b/webrtc/modules/audio_conference_mixer/source/audio_conference_mixer_impl.cc index 552d9c4f3c..b7bf1bae13 100644 --- a/webrtc/modules/audio_conference_mixer/source/audio_conference_mixer_impl.cc +++ b/webrtc/modules/audio_conference_mixer/source/audio_conference_mixer_impl.cc @@ -577,7 +577,7 @@ void AudioConferenceMixerImpl::UpdateToMix( } if(audioFrame->vad_activity_ == AudioFrame::kVadActive) { - if(!wasMixed) { + if(!wasMixed && !muted) { RampIn(*audioFrame); } @@ -585,13 +585,15 @@ void AudioConferenceMixerImpl::UpdateToMix( // There are already more active participants than should be // mixed. Only keep the ones with the highest energy. AudioFrameList::iterator replaceItem; - uint32_t lowestEnergy = CalculateEnergy(*audioFrame); + uint32_t lowestEnergy = + muted ? 0 : CalculateEnergy(*audioFrame); bool found_replace_item = false; for (AudioFrameList::iterator iter = activeList.begin(); iter != activeList.end(); ++iter) { - const uint32_t energy = CalculateEnergy(*iter->frame); + const uint32_t energy = + muted ? 0 : CalculateEnergy(*iter->frame); if(energy < lowestEnergy) { replaceItem = iter; lowestEnergy = energy; @@ -599,6 +601,7 @@ void AudioConferenceMixerImpl::UpdateToMix( } } if(found_replace_item) { + RTC_DCHECK(!muted); // Cannot replace with a muted frame. FrameAndMuteInfo replaceFrame = *replaceItem; bool replaceWasMixed = false; @@ -620,7 +623,9 @@ void AudioConferenceMixerImpl::UpdateToMix( kMaximumAmountOfMixedParticipants); if (replaceWasMixed) { - RampOut(*replaceFrame.frame); + if (!replaceFrame.muted) { + RampOut(*replaceFrame.frame); + } rampOutList->push_back(replaceFrame); assert(rampOutList->size() <= kMaximumAmountOfMixedParticipants); @@ -629,7 +634,9 @@ void AudioConferenceMixerImpl::UpdateToMix( } } else { if(wasMixed) { - RampOut(*audioFrame); + if (!muted) { + RampOut(*audioFrame); + } rampOutList->push_back(FrameAndMuteInfo(audioFrame, muted)); assert(rampOutList->size() <= @@ -650,7 +657,9 @@ void AudioConferenceMixerImpl::UpdateToMix( new ParticipantFrameStruct(*participant, audioFrame, muted); passiveWasMixedList.push_back(part_struct); } else if(mustAddToPassiveList) { - RampIn(*audioFrame); + if (!muted) { + RampIn(*audioFrame); + } ParticipantFrameStruct* part_struct = new ParticipantFrameStruct(*participant, audioFrame, muted); passiveWasNotMixedList.push_back(part_struct);