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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 delete *iter; | 714 delete *iter; |
714 } | 715 } |
715 assert(*maxAudioFrameCounter + mixListStartSize >= mixList->size()); | 716 assert(*maxAudioFrameCounter + mixListStartSize >= mixList->size()); |
716 *maxAudioFrameCounter += mixListStartSize - mixList->size(); | 717 *maxAudioFrameCounter += mixListStartSize - mixList->size(); |
717 } | 718 } |
718 | 719 |
719 void AudioConferenceMixerImpl::GetAdditionalAudio( | 720 void AudioConferenceMixerImpl::GetAdditionalAudio( |
720 AudioFrameList* additionalFramesList) const { | 721 AudioFrameList* additionalFramesList) const { |
721 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, | 722 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, |
722 "GetAdditionalAudio(additionalFramesList)"); | 723 "GetAdditionalAudio(additionalFramesList)"); |
723 // The GetAudioFrame() callback may result in the participant being removed | 724 // The GetAudioFrameWithMuted() callback may result in the participant being |
724 // from additionalParticipantList_. If that happens it will invalidate any | 725 // removed from additionalParticipantList_. If that happens it will |
725 // iterators. Create a copy of the participants list such that the list of | 726 // invalidate any iterators. Create a copy of the participants list such |
726 // participants can be traversed safely. | 727 // that the list of participants can be traversed safely. |
727 MixerParticipantList additionalParticipantList; | 728 MixerParticipantList additionalParticipantList; |
728 additionalParticipantList.insert(additionalParticipantList.begin(), | 729 additionalParticipantList.insert(additionalParticipantList.begin(), |
729 _additionalParticipantList.begin(), | 730 _additionalParticipantList.begin(), |
730 _additionalParticipantList.end()); | 731 _additionalParticipantList.end()); |
731 | 732 |
732 for (MixerParticipantList::const_iterator participant = | 733 for (MixerParticipantList::const_iterator participant = |
733 additionalParticipantList.begin(); | 734 additionalParticipantList.begin(); |
734 participant != additionalParticipantList.end(); | 735 participant != additionalParticipantList.end(); |
735 ++participant) { | 736 ++participant) { |
736 AudioFrame* audioFrame = NULL; | 737 AudioFrame* audioFrame = NULL; |
737 if(_audioFramePool->PopMemory(audioFrame) == -1) { | 738 if(_audioFramePool->PopMemory(audioFrame) == -1) { |
738 WEBRTC_TRACE(kTraceMemory, kTraceAudioMixerServer, _id, | 739 WEBRTC_TRACE(kTraceMemory, kTraceAudioMixerServer, _id, |
739 "failed PopMemory() call"); | 740 "failed PopMemory() call"); |
740 assert(false); | 741 assert(false); |
741 return; | 742 return; |
742 } | 743 } |
743 audioFrame->sample_rate_hz_ = _outputFrequency; | 744 audioFrame->sample_rate_hz_ = _outputFrequency; |
744 bool muted = false; | 745 auto ret = (*participant)->GetAudioFrameWithMuted(_id, audioFrame); |
745 if((*participant)->GetAudioFrame(_id, audioFrame) != 0) { | 746 if (ret == MixerParticipant::AudioFrameInfo::kError) { |
746 WEBRTC_TRACE(kTraceWarning, kTraceAudioMixerServer, _id, | 747 WEBRTC_TRACE(kTraceWarning, kTraceAudioMixerServer, _id, |
747 "failed to GetAudioFrame() from participant"); | 748 "failed to GetAudioFrameWithMuted() from participant"); |
748 _audioFramePool->PushMemory(audioFrame); | 749 _audioFramePool->PushMemory(audioFrame); |
749 continue; | 750 continue; |
750 } | 751 } |
751 if(audioFrame->samples_per_channel_ == 0) { | 752 if(audioFrame->samples_per_channel_ == 0) { |
752 // Empty frame. Don't use it. | 753 // Empty frame. Don't use it. |
753 _audioFramePool->PushMemory(audioFrame); | 754 _audioFramePool->PushMemory(audioFrame); |
754 continue; | 755 continue; |
755 } | 756 } |
756 additionalFramesList->push_back(FrameAndMuteInfo(audioFrame, muted)); | 757 additionalFramesList->push_back(FrameAndMuteInfo( |
| 758 audioFrame, ret == MixerParticipant::AudioFrameInfo::kMuted)); |
757 } | 759 } |
758 } | 760 } |
759 | 761 |
760 void AudioConferenceMixerImpl::UpdateMixedStatus( | 762 void AudioConferenceMixerImpl::UpdateMixedStatus( |
761 const std::map<int, MixerParticipant*>& mixedParticipantsMap) const { | 763 const std::map<int, MixerParticipant*>& mixedParticipantsMap) const { |
762 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, | 764 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, |
763 "UpdateMixedStatus(mixedParticipantsMap)"); | 765 "UpdateMixedStatus(mixedParticipantsMap)"); |
764 assert(mixedParticipantsMap.size() <= kMaximumAmountOfMixedParticipants); | 766 assert(mixedParticipantsMap.size() <= kMaximumAmountOfMixedParticipants); |
765 | 767 |
766 // Loop through all participants. If they are in the mix map they | 768 // Loop through all participants. If they are in the mix map they |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 | 926 |
925 if(error != _limiter->kNoError) { | 927 if(error != _limiter->kNoError) { |
926 WEBRTC_TRACE(kTraceError, kTraceAudioMixerServer, _id, | 928 WEBRTC_TRACE(kTraceError, kTraceAudioMixerServer, _id, |
927 "Error from AudioProcessing: %d", error); | 929 "Error from AudioProcessing: %d", error); |
928 assert(false); | 930 assert(false); |
929 return false; | 931 return false; |
930 } | 932 } |
931 return true; | 933 return true; |
932 } | 934 } |
933 } // namespace webrtc | 935 } // namespace webrtc |
OLD | NEW |