Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: webrtc/modules/audio_conference_mixer/source/audio_conference_mixer_impl.cc

Issue 1589953002: Removing webrtc::AudioFrame::energy_. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: after review Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 const uint32_t energy = CalculateEnergy(**iter);
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, 775 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id,
777 "ClearAudioFrameList(audioFrameList)"); 776 "ClearAudioFrameList(audioFrameList)");
778 for (AudioFrameList::iterator iter = audioFrameList->begin(); 777 for (AudioFrameList::iterator iter = audioFrameList->begin();
779 iter != audioFrameList->end(); 778 iter != audioFrameList->end();
780 ++iter) { 779 ++iter) {
781 _audioFramePool->PushMemory(*iter); 780 _audioFramePool->PushMemory(*iter);
782 } 781 }
783 audioFrameList->clear(); 782 audioFrameList->clear();
784 } 783 }
785 784
786 void AudioConferenceMixerImpl::UpdateVADPositiveParticipants(
787 AudioFrameList* mixList) const {
788 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id,
789 "UpdateVADPositiveParticipants(mixList)");
790
791 for (AudioFrameList::const_iterator iter = mixList->begin();
792 iter != mixList->end();
793 ++iter) {
794 CalculateEnergy(**iter);
795 }
796 }
797
798 bool AudioConferenceMixerImpl::IsParticipantInList( 785 bool AudioConferenceMixerImpl::IsParticipantInList(
799 const MixerParticipant& participant, 786 const MixerParticipant& participant,
800 const MixerParticipantList& participantList) const { 787 const MixerParticipantList& participantList) const {
801 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, 788 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id,
802 "IsParticipantInList(participant,participantList)"); 789 "IsParticipantInList(participant,participantList)");
803 for (MixerParticipantList::const_iterator iter = participantList.begin(); 790 for (MixerParticipantList::const_iterator iter = participantList.begin();
804 iter != participantList.end(); 791 iter != participantList.end();
805 ++iter) { 792 ++iter) {
806 if(&participant == *iter) { 793 if(&participant == *iter) {
807 return true; 794 return true;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 906
920 if(error != _limiter->kNoError) { 907 if(error != _limiter->kNoError) {
921 WEBRTC_TRACE(kTraceError, kTraceAudioMixerServer, _id, 908 WEBRTC_TRACE(kTraceError, kTraceAudioMixerServer, _id,
922 "Error from AudioProcessing: %d", error); 909 "Error from AudioProcessing: %d", error);
923 assert(false); 910 assert(false);
924 return false; 911 return false;
925 } 912 }
926 return true; 913 return true;
927 } 914 }
928 } // namespace webrtc 915 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698