OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
576 | 576 |
577 if(audioFrame->vad_activity_ == AudioFrame::kVadActive) { | 577 if(audioFrame->vad_activity_ == AudioFrame::kVadActive) { |
578 if(!wasMixed) { | 578 if(!wasMixed) { |
579 RampIn(*audioFrame); | 579 RampIn(*audioFrame); |
580 } | 580 } |
581 | 581 |
582 if(activeList.size() >= *maxAudioFrameCounter) { | 582 if(activeList.size() >= *maxAudioFrameCounter) { |
583 // There are already more active participants than should be | 583 // There are already more active participants than should be |
584 // mixed. Only keep the ones with the highest energy. | 584 // mixed. Only keep the ones with the highest energy. |
585 AudioFrameList::iterator replaceItem; | 585 AudioFrameList::iterator replaceItem; |
586 CalculateEnergy(*audioFrame); | 586 uint32_t lowestEnergy = CalculateEnergy(*audioFrame); |
587 uint32_t lowestEnergy = audioFrame->energy_; | |
588 | 587 |
589 bool found_replace_item = false; | 588 bool found_replace_item = false; |
590 for (AudioFrameList::iterator iter = activeList.begin(); | 589 for (AudioFrameList::iterator iter = activeList.begin(); |
591 iter != activeList.end(); | 590 iter != activeList.end(); |
592 ++iter) { | 591 ++iter) { |
593 CalculateEnergy(**iter); | 592 uint32_t energy = CalculateEnergy(**iter); |
hlundin-webrtc
2016/01/19 08:25:02
const
minyue-webrtc
2016/01/22 15:05:50
Done.
| |
594 if((*iter)->energy_ < lowestEnergy) { | 593 if(energy < lowestEnergy) { |
595 replaceItem = iter; | 594 replaceItem = iter; |
596 lowestEnergy = (*iter)->energy_; | 595 lowestEnergy = energy; |
597 found_replace_item = true; | 596 found_replace_item = true; |
598 } | 597 } |
599 } | 598 } |
600 if(found_replace_item) { | 599 if(found_replace_item) { |
601 AudioFrame* replaceFrame = *replaceItem; | 600 AudioFrame* replaceFrame = *replaceItem; |
602 | 601 |
603 bool replaceWasMixed = false; | 602 bool replaceWasMixed = false; |
604 std::map<int, MixerParticipant*>::const_iterator it = | 603 std::map<int, MixerParticipant*>::const_iterator it = |
605 mixParticipantList->find(replaceFrame->id_); | 604 mixParticipantList->find(replaceFrame->id_); |
606 | 605 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
919 | 918 |
920 if(error != _limiter->kNoError) { | 919 if(error != _limiter->kNoError) { |
921 WEBRTC_TRACE(kTraceError, kTraceAudioMixerServer, _id, | 920 WEBRTC_TRACE(kTraceError, kTraceAudioMixerServer, _id, |
922 "Error from AudioProcessing: %d", error); | 921 "Error from AudioProcessing: %d", error); |
923 assert(false); | 922 assert(false); |
924 return false; | 923 return false; |
925 } | 924 } |
926 return true; | 925 return true; |
927 } | 926 } |
928 } // namespace webrtc | 927 } // namespace webrtc |
OLD | NEW |