| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 *mixed_frame += *frame; | 52 *mixed_frame += *frame; |
| 53 } | 53 } |
| 54 | 54 |
| 55 // Return the max number of channels from a |list| composed of AudioFrames. | 55 // Return the max number of channels from a |list| composed of AudioFrames. |
| 56 size_t MaxNumChannels(const AudioFrameList* list) { | 56 size_t MaxNumChannels(const AudioFrameList* list) { |
| 57 size_t max_num_channels = 1; | 57 size_t max_num_channels = 1; |
| 58 for (AudioFrameList::const_iterator iter = list->begin(); | 58 for (AudioFrameList::const_iterator iter = list->begin(); |
| 59 iter != list->end(); | 59 iter != list->end(); |
| 60 ++iter) { | 60 ++iter) { |
| 61 max_num_channels = std::max(max_num_channels, (*iter)->num_channels_); | 61 max_num_channels = std::max(max_num_channels, (*iter).frame->num_channels_); |
| 62 } | 62 } |
| 63 return max_num_channels; | 63 return max_num_channels; |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace | 66 } // namespace |
| 67 | 67 |
| 68 MixerParticipant::MixerParticipant() | 68 MixerParticipant::MixerParticipant() |
| 69 : _mixHistory(new MixHistory()) { | 69 : _mixHistory(new MixHistory()) { |
| 70 } | 70 } |
| 71 | 71 |
| (...skipping 476 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 if((*participant)->GetAudioFrame(_id, audioFrame) != 0) { | 559 if((*participant)->GetAudioFrame(_id, audioFrame) != 0) { |
| 559 WEBRTC_TRACE(kTraceWarning, kTraceAudioMixerServer, _id, | 560 WEBRTC_TRACE(kTraceWarning, kTraceAudioMixerServer, _id, |
| 560 "failed to GetAudioFrame() from participant"); | 561 "failed to GetAudioFrame() from participant"); |
| 561 _audioFramePool->PushMemory(audioFrame); | 562 _audioFramePool->PushMemory(audioFrame); |
| 562 continue; | 563 continue; |
| 563 } | 564 } |
| 564 if (_participantList.size() != 1) { | 565 if (_participantList.size() != 1) { |
| 565 // TODO(wu): Issue 3390, add support for multiple participants case. | 566 // TODO(wu): Issue 3390, add support for multiple participants case. |
| 566 audioFrame->ntp_time_ms_ = -1; | 567 audioFrame->ntp_time_ms_ = -1; |
| 567 } | 568 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 583 if(activeList.size() >= *maxAudioFrameCounter) { | 584 if(activeList.size() >= *maxAudioFrameCounter) { |
| 584 // There are already more active participants than should be | 585 // There are already more active participants than should be |
| 585 // mixed. Only keep the ones with the highest energy. | 586 // mixed. Only keep the ones with the highest energy. |
| 586 AudioFrameList::iterator replaceItem; | 587 AudioFrameList::iterator replaceItem; |
| 587 uint32_t lowestEnergy = CalculateEnergy(*audioFrame); | 588 uint32_t lowestEnergy = CalculateEnergy(*audioFrame); |
| 588 | 589 |
| 589 bool found_replace_item = false; | 590 bool found_replace_item = false; |
| 590 for (AudioFrameList::iterator iter = activeList.begin(); | 591 for (AudioFrameList::iterator iter = activeList.begin(); |
| 591 iter != activeList.end(); | 592 iter != activeList.end(); |
| 592 ++iter) { | 593 ++iter) { |
| 593 const uint32_t energy = CalculateEnergy(**iter); | 594 const uint32_t energy = CalculateEnergy(*iter->frame); |
| 594 if(energy < lowestEnergy) { | 595 if(energy < lowestEnergy) { |
| 595 replaceItem = iter; | 596 replaceItem = iter; |
| 596 lowestEnergy = energy; | 597 lowestEnergy = energy; |
| 597 found_replace_item = true; | 598 found_replace_item = true; |
| 598 } | 599 } |
| 599 } | 600 } |
| 600 if(found_replace_item) { | 601 if(found_replace_item) { |
| 601 AudioFrame* replaceFrame = *replaceItem; | 602 FrameAndMuteInfo replaceFrame = *replaceItem; |
| 602 | 603 |
| 603 bool replaceWasMixed = false; | 604 bool replaceWasMixed = false; |
| 604 std::map<int, MixerParticipant*>::const_iterator it = | 605 std::map<int, MixerParticipant*>::const_iterator it = |
| 605 mixParticipantList->find(replaceFrame->id_); | 606 mixParticipantList->find(replaceFrame.frame->id_); |
| 606 | 607 |
| 607 // When a frame is pushed to |activeList| it is also pushed | 608 // When a frame is pushed to |activeList| it is also pushed |
| 608 // to mixParticipantList with the frame's id. This means | 609 // to mixParticipantList with the frame's id. This means |
| 609 // that the Find call above should never fail. | 610 // that the Find call above should never fail. |
| 610 assert(it != mixParticipantList->end()); | 611 assert(it != mixParticipantList->end()); |
| 611 replaceWasMixed = it->second->_mixHistory->WasMixed(); | 612 replaceWasMixed = it->second->_mixHistory->WasMixed(); |
| 612 | 613 |
| 613 mixParticipantList->erase(replaceFrame->id_); | 614 mixParticipantList->erase(replaceFrame.frame->id_); |
| 614 activeList.erase(replaceItem); | 615 activeList.erase(replaceItem); |
| 615 | 616 |
| 616 activeList.push_front(audioFrame); | 617 activeList.push_front(FrameAndMuteInfo(audioFrame, muted)); |
| 617 (*mixParticipantList)[audioFrame->id_] = *participant; | 618 (*mixParticipantList)[audioFrame->id_] = *participant; |
| 618 assert(mixParticipantList->size() <= | 619 assert(mixParticipantList->size() <= |
| 619 kMaximumAmountOfMixedParticipants); | 620 kMaximumAmountOfMixedParticipants); |
| 620 | 621 |
| 621 if (replaceWasMixed) { | 622 if (replaceWasMixed) { |
| 622 RampOut(*replaceFrame); | 623 RampOut(*replaceFrame.frame); |
| 623 rampOutList->push_back(replaceFrame); | 624 rampOutList->push_back(replaceFrame); |
| 624 assert(rampOutList->size() <= | 625 assert(rampOutList->size() <= |
| 625 kMaximumAmountOfMixedParticipants); | 626 kMaximumAmountOfMixedParticipants); |
| 626 } else { | 627 } else { |
| 627 _audioFramePool->PushMemory(replaceFrame); | 628 _audioFramePool->PushMemory(replaceFrame.frame); |
| 628 } | 629 } |
| 629 } else { | 630 } else { |
| 630 if(wasMixed) { | 631 if(wasMixed) { |
| 631 RampOut(*audioFrame); | 632 RampOut(*audioFrame); |
| 632 rampOutList->push_back(audioFrame); | 633 rampOutList->push_back(FrameAndMuteInfo(audioFrame, |
| 634 muted)); |
| 633 assert(rampOutList->size() <= | 635 assert(rampOutList->size() <= |
| 634 kMaximumAmountOfMixedParticipants); | 636 kMaximumAmountOfMixedParticipants); |
| 635 } else { | 637 } else { |
| 636 _audioFramePool->PushMemory(audioFrame); | 638 _audioFramePool->PushMemory(audioFrame); |
| 637 } | 639 } |
| 638 } | 640 } |
| 639 } else { | 641 } else { |
| 640 activeList.push_front(audioFrame); | 642 activeList.push_front(FrameAndMuteInfo(audioFrame, muted)); |
| 641 (*mixParticipantList)[audioFrame->id_] = *participant; | 643 (*mixParticipantList)[audioFrame->id_] = *participant; |
| 642 assert(mixParticipantList->size() <= | 644 assert(mixParticipantList->size() <= |
| 643 kMaximumAmountOfMixedParticipants); | 645 kMaximumAmountOfMixedParticipants); |
| 644 } | 646 } |
| 645 } else { | 647 } else { |
| 646 if(wasMixed) { | 648 if(wasMixed) { |
| 647 ParticipantFrameStruct* part_struct = | 649 ParticipantFrameStruct* part_struct = |
| 648 new ParticipantFrameStruct(*participant, audioFrame, false); | 650 new ParticipantFrameStruct(*participant, audioFrame, muted); |
| 649 passiveWasMixedList.push_back(part_struct); | 651 passiveWasMixedList.push_back(part_struct); |
| 650 } else if(mustAddToPassiveList) { | 652 } else if(mustAddToPassiveList) { |
| 651 RampIn(*audioFrame); | 653 RampIn(*audioFrame); |
| 652 ParticipantFrameStruct* part_struct = | 654 ParticipantFrameStruct* part_struct = |
| 653 new ParticipantFrameStruct(*participant, audioFrame, false); | 655 new ParticipantFrameStruct(*participant, audioFrame, muted); |
| 654 passiveWasNotMixedList.push_back(part_struct); | 656 passiveWasNotMixedList.push_back(part_struct); |
| 655 } else { | 657 } else { |
| 656 _audioFramePool->PushMemory(audioFrame); | 658 _audioFramePool->PushMemory(audioFrame); |
| 657 } | 659 } |
| 658 } | 660 } |
| 659 } | 661 } |
| 660 assert(activeList.size() <= *maxAudioFrameCounter); | 662 assert(activeList.size() <= *maxAudioFrameCounter); |
| 661 // At this point it is known which participants should be mixed. Transfer | 663 // At this point it is known which participants should be mixed. Transfer |
| 662 // this information to this functions output parameters. | 664 // this information to this functions output parameters. |
| 663 for (AudioFrameList::const_iterator iter = activeList.begin(); | 665 for (AudioFrameList::const_iterator iter = activeList.begin(); |
| 664 iter != activeList.end(); | 666 iter != activeList.end(); |
| 665 ++iter) { | 667 ++iter) { |
| 666 mixList->push_back(*iter); | 668 mixList->push_back(*iter); |
| 667 } | 669 } |
| 668 activeList.clear(); | 670 activeList.clear(); |
| 669 // Always mix a constant number of AudioFrames. If there aren't enough | 671 // Always mix a constant number of AudioFrames. If there aren't enough |
| 670 // active participants mix passive ones. Starting with those that was mixed | 672 // active participants mix passive ones. Starting with those that was mixed |
| 671 // last iteration. | 673 // last iteration. |
| 672 for (ParticipantFrameStructList::const_iterator | 674 for (ParticipantFrameStructList::const_iterator |
| 673 iter = passiveWasMixedList.begin(); iter != passiveWasMixedList.end(); | 675 iter = passiveWasMixedList.begin(); iter != passiveWasMixedList.end(); |
| 674 ++iter) { | 676 ++iter) { |
| 675 if(mixList->size() < *maxAudioFrameCounter + mixListStartSize) { | 677 if(mixList->size() < *maxAudioFrameCounter + mixListStartSize) { |
| 676 mixList->push_back((*iter)->audioFrame); | 678 mixList->push_back(FrameAndMuteInfo((*iter)->audioFrame, |
| 679 (*iter)->muted)); |
| 677 (*mixParticipantList)[(*iter)->audioFrame->id_] = | 680 (*mixParticipantList)[(*iter)->audioFrame->id_] = |
| 678 (*iter)->participant; | 681 (*iter)->participant; |
| 679 assert(mixParticipantList->size() <= | 682 assert(mixParticipantList->size() <= |
| 680 kMaximumAmountOfMixedParticipants); | 683 kMaximumAmountOfMixedParticipants); |
| 681 } else { | 684 } else { |
| 682 _audioFramePool->PushMemory((*iter)->audioFrame); | 685 _audioFramePool->PushMemory((*iter)->audioFrame); |
| 683 } | 686 } |
| 684 delete *iter; | 687 delete *iter; |
| 685 } | 688 } |
| 686 // And finally the ones that have not been mixed for a while. | 689 // And finally the ones that have not been mixed for a while. |
| 687 for (ParticipantFrameStructList::const_iterator iter = | 690 for (ParticipantFrameStructList::const_iterator iter = |
| 688 passiveWasNotMixedList.begin(); | 691 passiveWasNotMixedList.begin(); |
| 689 iter != passiveWasNotMixedList.end(); | 692 iter != passiveWasNotMixedList.end(); |
| 690 ++iter) { | 693 ++iter) { |
| 691 if(mixList->size() < *maxAudioFrameCounter + mixListStartSize) { | 694 if(mixList->size() < *maxAudioFrameCounter + mixListStartSize) { |
| 692 mixList->push_back((*iter)->audioFrame); | 695 mixList->push_back(FrameAndMuteInfo((*iter)->audioFrame, |
| 696 (*iter)->muted)); |
| 693 (*mixParticipantList)[(*iter)->audioFrame->id_] = | 697 (*mixParticipantList)[(*iter)->audioFrame->id_] = |
| 694 (*iter)->participant; | 698 (*iter)->participant; |
| 695 assert(mixParticipantList->size() <= | 699 assert(mixParticipantList->size() <= |
| 696 kMaximumAmountOfMixedParticipants); | 700 kMaximumAmountOfMixedParticipants); |
| 697 } else { | 701 } else { |
| 698 _audioFramePool->PushMemory((*iter)->audioFrame); | 702 _audioFramePool->PushMemory((*iter)->audioFrame); |
| 699 } | 703 } |
| 700 delete *iter; | 704 delete *iter; |
| 701 } | 705 } |
| 702 assert(*maxAudioFrameCounter + mixListStartSize >= mixList->size()); | 706 assert(*maxAudioFrameCounter + mixListStartSize >= mixList->size()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 721 participant != additionalParticipantList.end(); | 725 participant != additionalParticipantList.end(); |
| 722 ++participant) { | 726 ++participant) { |
| 723 AudioFrame* audioFrame = NULL; | 727 AudioFrame* audioFrame = NULL; |
| 724 if(_audioFramePool->PopMemory(audioFrame) == -1) { | 728 if(_audioFramePool->PopMemory(audioFrame) == -1) { |
| 725 WEBRTC_TRACE(kTraceMemory, kTraceAudioMixerServer, _id, | 729 WEBRTC_TRACE(kTraceMemory, kTraceAudioMixerServer, _id, |
| 726 "failed PopMemory() call"); | 730 "failed PopMemory() call"); |
| 727 assert(false); | 731 assert(false); |
| 728 return; | 732 return; |
| 729 } | 733 } |
| 730 audioFrame->sample_rate_hz_ = _outputFrequency; | 734 audioFrame->sample_rate_hz_ = _outputFrequency; |
| 735 bool muted = false; |
| 731 if((*participant)->GetAudioFrame(_id, audioFrame) != 0) { | 736 if((*participant)->GetAudioFrame(_id, audioFrame) != 0) { |
| 732 WEBRTC_TRACE(kTraceWarning, kTraceAudioMixerServer, _id, | 737 WEBRTC_TRACE(kTraceWarning, kTraceAudioMixerServer, _id, |
| 733 "failed to GetAudioFrame() from participant"); | 738 "failed to GetAudioFrame() from participant"); |
| 734 _audioFramePool->PushMemory(audioFrame); | 739 _audioFramePool->PushMemory(audioFrame); |
| 735 continue; | 740 continue; |
| 736 } | 741 } |
| 737 if(audioFrame->samples_per_channel_ == 0) { | 742 if(audioFrame->samples_per_channel_ == 0) { |
| 738 // Empty frame. Don't use it. | 743 // Empty frame. Don't use it. |
| 739 _audioFramePool->PushMemory(audioFrame); | 744 _audioFramePool->PushMemory(audioFrame); |
| 740 continue; | 745 continue; |
| 741 } | 746 } |
| 742 additionalFramesList->push_back(audioFrame); | 747 additionalFramesList->push_back(FrameAndMuteInfo(audioFrame, muted)); |
| 743 } | 748 } |
| 744 } | 749 } |
| 745 | 750 |
| 746 void AudioConferenceMixerImpl::UpdateMixedStatus( | 751 void AudioConferenceMixerImpl::UpdateMixedStatus( |
| 747 const std::map<int, MixerParticipant*>& mixedParticipantsMap) const { | 752 const std::map<int, MixerParticipant*>& mixedParticipantsMap) const { |
| 748 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, | 753 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, |
| 749 "UpdateMixedStatus(mixedParticipantsMap)"); | 754 "UpdateMixedStatus(mixedParticipantsMap)"); |
| 750 assert(mixedParticipantsMap.size() <= kMaximumAmountOfMixedParticipants); | 755 assert(mixedParticipantsMap.size() <= kMaximumAmountOfMixedParticipants); |
| 751 | 756 |
| 752 // Loop through all participants. If they are in the mix map they | 757 // Loop through all participants. If they are in the mix map they |
| (...skipping 16 matching lines...) Expand all Loading... |
| 769 } | 774 } |
| 770 } | 775 } |
| 771 | 776 |
| 772 void AudioConferenceMixerImpl::ClearAudioFrameList( | 777 void AudioConferenceMixerImpl::ClearAudioFrameList( |
| 773 AudioFrameList* audioFrameList) const { | 778 AudioFrameList* audioFrameList) const { |
| 774 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, | 779 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, |
| 775 "ClearAudioFrameList(audioFrameList)"); | 780 "ClearAudioFrameList(audioFrameList)"); |
| 776 for (AudioFrameList::iterator iter = audioFrameList->begin(); | 781 for (AudioFrameList::iterator iter = audioFrameList->begin(); |
| 777 iter != audioFrameList->end(); | 782 iter != audioFrameList->end(); |
| 778 ++iter) { | 783 ++iter) { |
| 779 _audioFramePool->PushMemory(*iter); | 784 _audioFramePool->PushMemory(iter->frame); |
| 780 } | 785 } |
| 781 audioFrameList->clear(); | 786 audioFrameList->clear(); |
| 782 } | 787 } |
| 783 | 788 |
| 784 bool AudioConferenceMixerImpl::IsParticipantInList( | 789 bool AudioConferenceMixerImpl::IsParticipantInList( |
| 785 const MixerParticipant& participant, | 790 const MixerParticipant& participant, |
| 786 const MixerParticipantList& participantList) const { | 791 const MixerParticipantList& participantList) const { |
| 787 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, | 792 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, |
| 788 "IsParticipantInList(participant,participantList)"); | 793 "IsParticipantInList(participant,participantList)"); |
| 789 for (MixerParticipantList::const_iterator iter = participantList.begin(); | 794 for (MixerParticipantList::const_iterator iter = participantList.begin(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 int32_t AudioConferenceMixerImpl::MixFromList( | 833 int32_t AudioConferenceMixerImpl::MixFromList( |
| 829 AudioFrame* mixedAudio, | 834 AudioFrame* mixedAudio, |
| 830 const AudioFrameList& audioFrameList) const { | 835 const AudioFrameList& audioFrameList) const { |
| 831 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, | 836 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, |
| 832 "MixFromList(mixedAudio, audioFrameList)"); | 837 "MixFromList(mixedAudio, audioFrameList)"); |
| 833 if(audioFrameList.empty()) return 0; | 838 if(audioFrameList.empty()) return 0; |
| 834 | 839 |
| 835 uint32_t position = 0; | 840 uint32_t position = 0; |
| 836 | 841 |
| 837 if (_numMixedParticipants == 1) { | 842 if (_numMixedParticipants == 1) { |
| 838 mixedAudio->timestamp_ = audioFrameList.front()->timestamp_; | 843 mixedAudio->timestamp_ = audioFrameList.front().frame->timestamp_; |
| 839 mixedAudio->elapsed_time_ms_ = audioFrameList.front()->elapsed_time_ms_; | 844 mixedAudio->elapsed_time_ms_ = |
| 845 audioFrameList.front().frame->elapsed_time_ms_; |
| 840 } else { | 846 } else { |
| 841 // TODO(wu): Issue 3390. | 847 // TODO(wu): Issue 3390. |
| 842 // Audio frame timestamp is only supported in one channel case. | 848 // Audio frame timestamp is only supported in one channel case. |
| 843 mixedAudio->timestamp_ = 0; | 849 mixedAudio->timestamp_ = 0; |
| 844 mixedAudio->elapsed_time_ms_ = -1; | 850 mixedAudio->elapsed_time_ms_ = -1; |
| 845 } | 851 } |
| 846 | 852 |
| 847 for (AudioFrameList::const_iterator iter = audioFrameList.begin(); | 853 for (AudioFrameList::const_iterator iter = audioFrameList.begin(); |
| 848 iter != audioFrameList.end(); | 854 iter != audioFrameList.end(); |
| 849 ++iter) { | 855 ++iter) { |
| 850 if(position >= kMaximumAmountOfMixedParticipants) { | 856 if(position >= kMaximumAmountOfMixedParticipants) { |
| 851 WEBRTC_TRACE( | 857 WEBRTC_TRACE( |
| 852 kTraceMemory, | 858 kTraceMemory, |
| 853 kTraceAudioMixerServer, | 859 kTraceAudioMixerServer, |
| 854 _id, | 860 _id, |
| 855 "Trying to mix more than max amount of mixed participants:%d!", | 861 "Trying to mix more than max amount of mixed participants:%d!", |
| 856 kMaximumAmountOfMixedParticipants); | 862 kMaximumAmountOfMixedParticipants); |
| 857 // Assert and avoid crash | 863 // Assert and avoid crash |
| 858 assert(false); | 864 assert(false); |
| 859 position = 0; | 865 position = 0; |
| 860 } | 866 } |
| 861 MixFrames(mixedAudio, (*iter), use_limiter_); | 867 if (!iter->muted) { |
| 868 MixFrames(mixedAudio, iter->frame, use_limiter_); |
| 869 } |
| 862 | 870 |
| 863 position++; | 871 position++; |
| 864 } | 872 } |
| 865 | 873 |
| 866 return 0; | 874 return 0; |
| 867 } | 875 } |
| 868 | 876 |
| 869 // TODO(andrew): consolidate this function with MixFromList. | 877 // TODO(andrew): consolidate this function with MixFromList. |
| 870 int32_t AudioConferenceMixerImpl::MixAnonomouslyFromList( | 878 int32_t AudioConferenceMixerImpl::MixAnonomouslyFromList( |
| 871 AudioFrame* mixedAudio, | 879 AudioFrame* mixedAudio, |
| 872 const AudioFrameList& audioFrameList) const { | 880 const AudioFrameList& audioFrameList) const { |
| 873 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, | 881 WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id, |
| 874 "MixAnonomouslyFromList(mixedAudio, audioFrameList)"); | 882 "MixAnonomouslyFromList(mixedAudio, audioFrameList)"); |
| 875 | 883 |
| 876 if(audioFrameList.empty()) return 0; | 884 if(audioFrameList.empty()) return 0; |
| 877 | 885 |
| 878 for (AudioFrameList::const_iterator iter = audioFrameList.begin(); | 886 for (AudioFrameList::const_iterator iter = audioFrameList.begin(); |
| 879 iter != audioFrameList.end(); | 887 iter != audioFrameList.end(); |
| 880 ++iter) { | 888 ++iter) { |
| 881 MixFrames(mixedAudio, *iter, use_limiter_); | 889 if (!iter->muted) { |
| 890 MixFrames(mixedAudio, iter->frame, use_limiter_); |
| 891 } |
| 882 } | 892 } |
| 883 return 0; | 893 return 0; |
| 884 } | 894 } |
| 885 | 895 |
| 886 bool AudioConferenceMixerImpl::LimitMixedAudio(AudioFrame* mixedAudio) const { | 896 bool AudioConferenceMixerImpl::LimitMixedAudio(AudioFrame* mixedAudio) const { |
| 887 if (!use_limiter_) { | 897 if (!use_limiter_) { |
| 888 return true; | 898 return true; |
| 889 } | 899 } |
| 890 | 900 |
| 891 // Smoothly limit the mixed frame. | 901 // Smoothly limit the mixed frame. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 905 | 915 |
| 906 if(error != _limiter->kNoError) { | 916 if(error != _limiter->kNoError) { |
| 907 WEBRTC_TRACE(kTraceError, kTraceAudioMixerServer, _id, | 917 WEBRTC_TRACE(kTraceError, kTraceAudioMixerServer, _id, |
| 908 "Error from AudioProcessing: %d", error); | 918 "Error from AudioProcessing: %d", error); |
| 909 assert(false); | 919 assert(false); |
| 910 return false; | 920 return false; |
| 911 } | 921 } |
| 912 return true; | 922 return true; |
| 913 } | 923 } |
| 914 } // namespace webrtc | 924 } // namespace webrtc |
| OLD | NEW |