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

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

Issue 1986093002: Propagate muted info from VoE Channel to AudioConferenceMixer (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@mixer-mod-3
Patch Set: Addressing kwiberg's comments Created 4 years, 7 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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 wasMixed = (*participant)->_mixHistory->WasMixed(); 548 wasMixed = (*participant)->_mixHistory->WasMixed();
549 AudioFrame* audioFrame = NULL; 549 AudioFrame* audioFrame = NULL;
550 if(_audioFramePool->PopMemory(audioFrame) == -1) { 550 if(_audioFramePool->PopMemory(audioFrame) == -1) {
551 WEBRTC_TRACE(kTraceMemory, kTraceAudioMixerServer, _id, 551 WEBRTC_TRACE(kTraceMemory, kTraceAudioMixerServer, _id,
552 "failed PopMemory() call"); 552 "failed PopMemory() call");
553 assert(false); 553 assert(false);
554 return; 554 return;
555 } 555 }
556 audioFrame->sample_rate_hz_ = _outputFrequency; 556 audioFrame->sample_rate_hz_ = _outputFrequency;
557 557
558 bool muted = false; 558 auto ret = (*participant)->GetAudioFrameWithMuted(_id, audioFrame);
559 if((*participant)->GetAudioFrame(_id, audioFrame) != 0) { 559 if (ret == MixerParticipant::AudioFrameInfo::kError) {
560 WEBRTC_TRACE(kTraceWarning, kTraceAudioMixerServer, _id, 560 WEBRTC_TRACE(kTraceWarning, kTraceAudioMixerServer, _id,
561 "failed to GetAudioFrame() from participant"); 561 "failed to GetAudioFrameWithMuted() from participant");
562 _audioFramePool->PushMemory(audioFrame); 562 _audioFramePool->PushMemory(audioFrame);
563 continue; 563 continue;
564 } 564 }
565 const bool muted = (ret == MixerParticipant::AudioFrameInfo::kMuted);
565 if (_participantList.size() != 1) { 566 if (_participantList.size() != 1) {
566 // TODO(wu): Issue 3390, add support for multiple participants case. 567 // TODO(wu): Issue 3390, add support for multiple participants case.
567 audioFrame->ntp_time_ms_ = -1; 568 audioFrame->ntp_time_ms_ = -1;
568 } 569 }
569 570
570 // TODO(henrike): this assert triggers in some test cases where SRTP is 571 // TODO(henrike): this assert triggers in some test cases where SRTP is
571 // used which prevents NetEQ from making a VAD. Temporarily disable this 572 // used which prevents NetEQ from making a VAD. Temporarily disable this
572 // assert until the problem is fixed on a higher level. 573 // assert until the problem is fixed on a higher level.
573 // assert(audioFrame->vad_activity_ != AudioFrame::kVadUnknown); 574 // assert(audioFrame->vad_activity_ != AudioFrame::kVadUnknown);
574 if (audioFrame->vad_activity_ == AudioFrame::kVadUnknown) { 575 if (audioFrame->vad_activity_ == AudioFrame::kVadUnknown) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 delete *iter; 707 delete *iter;
707 } 708 }
708 assert(*maxAudioFrameCounter + mixListStartSize >= mixList->size()); 709 assert(*maxAudioFrameCounter + mixListStartSize >= mixList->size());
709 *maxAudioFrameCounter += mixListStartSize - mixList->size(); 710 *maxAudioFrameCounter += mixListStartSize - mixList->size();
710 } 711 }
711 712
712 void AudioConferenceMixerImpl::GetAdditionalAudio( 713 void AudioConferenceMixerImpl::GetAdditionalAudio(
713 AudioFrameList* additionalFramesList) const { 714 AudioFrameList* additionalFramesList) const {
714 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, 715 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id,
715 "GetAdditionalAudio(additionalFramesList)"); 716 "GetAdditionalAudio(additionalFramesList)");
716 // The GetAudioFrame() callback may result in the participant being removed 717 // The GetAudioFrameWithMuted() callback may result in the participant being
717 // from additionalParticipantList_. If that happens it will invalidate any 718 // removed from additionalParticipantList_. If that happens it will
718 // iterators. Create a copy of the participants list such that the list of 719 // invalidate any iterators. Create a copy of the participants list such
719 // participants can be traversed safely. 720 // that the list of participants can be traversed safely.
720 MixerParticipantList additionalParticipantList; 721 MixerParticipantList additionalParticipantList;
721 additionalParticipantList.insert(additionalParticipantList.begin(), 722 additionalParticipantList.insert(additionalParticipantList.begin(),
722 _additionalParticipantList.begin(), 723 _additionalParticipantList.begin(),
723 _additionalParticipantList.end()); 724 _additionalParticipantList.end());
724 725
725 for (MixerParticipantList::const_iterator participant = 726 for (MixerParticipantList::const_iterator participant =
726 additionalParticipantList.begin(); 727 additionalParticipantList.begin();
727 participant != additionalParticipantList.end(); 728 participant != additionalParticipantList.end();
728 ++participant) { 729 ++participant) {
729 AudioFrame* audioFrame = NULL; 730 AudioFrame* audioFrame = NULL;
730 if(_audioFramePool->PopMemory(audioFrame) == -1) { 731 if(_audioFramePool->PopMemory(audioFrame) == -1) {
731 WEBRTC_TRACE(kTraceMemory, kTraceAudioMixerServer, _id, 732 WEBRTC_TRACE(kTraceMemory, kTraceAudioMixerServer, _id,
732 "failed PopMemory() call"); 733 "failed PopMemory() call");
733 assert(false); 734 assert(false);
734 return; 735 return;
735 } 736 }
736 audioFrame->sample_rate_hz_ = _outputFrequency; 737 audioFrame->sample_rate_hz_ = _outputFrequency;
737 bool muted = false; 738 auto ret = (*participant)->GetAudioFrameWithMuted(_id, audioFrame);
738 if((*participant)->GetAudioFrame(_id, audioFrame) != 0) { 739 if (ret == MixerParticipant::AudioFrameInfo::kError) {
739 WEBRTC_TRACE(kTraceWarning, kTraceAudioMixerServer, _id, 740 WEBRTC_TRACE(kTraceWarning, kTraceAudioMixerServer, _id,
740 "failed to GetAudioFrame() from participant"); 741 "failed to GetAudioFrameWithMuted() from participant");
741 _audioFramePool->PushMemory(audioFrame); 742 _audioFramePool->PushMemory(audioFrame);
742 continue; 743 continue;
743 } 744 }
744 if(audioFrame->samples_per_channel_ == 0) { 745 if(audioFrame->samples_per_channel_ == 0) {
745 // Empty frame. Don't use it. 746 // Empty frame. Don't use it.
746 _audioFramePool->PushMemory(audioFrame); 747 _audioFramePool->PushMemory(audioFrame);
747 continue; 748 continue;
748 } 749 }
749 additionalFramesList->push_back(FrameAndMuteInfo(audioFrame, muted)); 750 additionalFramesList->push_back(FrameAndMuteInfo(
751 audioFrame, ret == MixerParticipant::AudioFrameInfo::kMuted));
750 } 752 }
751 } 753 }
752 754
753 void AudioConferenceMixerImpl::UpdateMixedStatus( 755 void AudioConferenceMixerImpl::UpdateMixedStatus(
754 const std::map<int, MixerParticipant*>& mixedParticipantsMap) const { 756 const std::map<int, MixerParticipant*>& mixedParticipantsMap) const {
755 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, 757 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id,
756 "UpdateMixedStatus(mixedParticipantsMap)"); 758 "UpdateMixedStatus(mixedParticipantsMap)");
757 assert(mixedParticipantsMap.size() <= kMaximumAmountOfMixedParticipants); 759 assert(mixedParticipantsMap.size() <= kMaximumAmountOfMixedParticipants);
758 760
759 // Loop through all participants. If they are in the mix map they 761 // Loop through all participants. If they are in the mix map they
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 937
936 if(error != _limiter->kNoError) { 938 if(error != _limiter->kNoError) {
937 WEBRTC_TRACE(kTraceError, kTraceAudioMixerServer, _id, 939 WEBRTC_TRACE(kTraceError, kTraceAudioMixerServer, _id,
938 "Error from AudioProcessing: %d", error); 940 "Error from AudioProcessing: %d", error);
939 assert(false); 941 assert(false);
940 return false; 942 return false;
941 } 943 }
942 return true; 944 return true;
943 } 945 }
944 } // namespace webrtc 946 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698