Chromium Code Reviews| Index: webrtc/modules/audio_mixer/source/new_audio_conference_mixer_impl.cc |
| diff --git a/webrtc/modules/audio_mixer/source/new_audio_conference_mixer_impl.cc b/webrtc/modules/audio_mixer/source/new_audio_conference_mixer_impl.cc |
| index 36d70b217133e9f77643eadb4c02516b1f9109ca..88c0f068231fd3bfe1de7fc5eebc3871725fbe98 100644 |
| --- a/webrtc/modules/audio_mixer/source/new_audio_conference_mixer_impl.cc |
| +++ b/webrtc/modules/audio_mixer/source/new_audio_conference_mixer_impl.cc |
| @@ -111,7 +111,6 @@ NewAudioConferenceMixer* NewAudioConferenceMixer::Create(int id) { |
| NewAudioConferenceMixerImpl::NewAudioConferenceMixerImpl(int id) |
| : _id(id), |
| _minimumMixingFreq(kLowestPossible), |
| - _mixReceiver(NULL), |
| _outputFrequency(kDefaultFrequency), |
| _sampleSize(0), |
| _audioFramePool(NULL), |
| @@ -189,6 +188,10 @@ int64_t NewAudioConferenceMixerImpl::TimeUntilNextProcess() { |
| } |
| void NewAudioConferenceMixerImpl::Process() { |
| + RTC_NOTREACHED(); |
|
tommi
2016/07/06 19:42:17
todo to remove?
aleloi
2016/07/07 09:20:16
Done. (There is also a dependent CL https://codere
|
| +} |
| + |
| +void NewAudioConferenceMixerImpl::Mix(AudioFrame* audio_frame_for_mixing) { |
| size_t remainingParticipantsAllowedToMix = kMaximumAmountOfMixedParticipants; |
| { |
| CriticalSectionScoped cs(_crit.get()); |
| @@ -259,15 +262,6 @@ void NewAudioConferenceMixerImpl::Process() { |
| UpdateMixedStatus(mixedParticipantsMap); |
| } |
| - // Get an AudioFrame for mixing from the memory pool. |
| - AudioFrame* mixedAudio = NULL; |
| - if (_audioFramePool->PopMemory(mixedAudio) == -1) { |
| - WEBRTC_TRACE(kTraceMemory, kTraceAudioMixerServer, _id, |
| - "failed PopMemory() call"); |
| - assert(false); |
| - return; |
| - } |
| - |
| { |
| CriticalSectionScoped cs(_crit.get()); |
| @@ -280,9 +274,9 @@ void NewAudioConferenceMixerImpl::Process() { |
| std::max(MaxNumChannels(&additionalFramesList), |
| MaxNumChannels(&rampOutList))); |
| - mixedAudio->UpdateFrame(-1, _timeStamp, NULL, 0, _outputFrequency, |
| - AudioFrame::kNormalSpeech, AudioFrame::kVadPassive, |
| - num_mixed_channels); |
| + audio_frame_for_mixing->UpdateFrame( |
|
tommi
2016/07/06 19:42:17
is there a way to avoid calling UpdateFrame() whil
|
| + -1, _timeStamp, NULL, 0, _outputFrequency, AudioFrame::kNormalSpeech, |
| + AudioFrame::kVadPassive, num_mixed_channels); |
| _timeStamp += static_cast<uint32_t>(_sampleSize); |
|
tommi
2016/07/06 19:42:17
_timeStamp is only used in this method, so possibl
aleloi
2016/07/07 09:20:16
_sampleSize and _outputFrequency are only changed
tommi
2016/07/08 12:24:17
Acknowledged.
|
| @@ -291,30 +285,20 @@ void NewAudioConferenceMixerImpl::Process() { |
| use_limiter_ = _numMixedParticipants > 1 && |
| _outputFrequency <= AudioProcessing::kMaxNativeSampleRateHz; |
| - MixFromList(mixedAudio, mixList); |
| - MixAnonomouslyFromList(mixedAudio, additionalFramesList); |
| - MixAnonomouslyFromList(mixedAudio, rampOutList); |
| + MixFromList(audio_frame_for_mixing, mixList); |
| + MixAnonomouslyFromList(audio_frame_for_mixing, additionalFramesList); |
| + MixAnonomouslyFromList(audio_frame_for_mixing, rampOutList); |
| - if (mixedAudio->samples_per_channel_ == 0) { |
| + if (audio_frame_for_mixing->samples_per_channel_ == 0) { |
| // Nothing was mixed, set the audio samples to silence. |
| - mixedAudio->samples_per_channel_ = _sampleSize; |
| - mixedAudio->Mute(); |
| + audio_frame_for_mixing->samples_per_channel_ = _sampleSize; |
| + audio_frame_for_mixing->Mute(); |
| } else { |
| // Only call the limiter if we have something to mix. |
| - LimitMixedAudio(mixedAudio); |
| + LimitMixedAudio(audio_frame_for_mixing); |
| } |
| } |
| - { |
| - CriticalSectionScoped cs(_cbCrit.get()); |
| - if (_mixReceiver != NULL) { |
| - const AudioFrame** dummy = NULL; |
| - _mixReceiver->NewMixedAudio(_id, *mixedAudio, dummy, 0); |
| - } |
| - } |
| - |
| - // Reclaim all outstanding memory. |
| - _audioFramePool->PushMemory(mixedAudio); |
| ClearAudioFrameList(&mixList); |
| ClearAudioFrameList(&rampOutList); |
| ClearAudioFrameList(&additionalFramesList); |
| @@ -325,25 +309,6 @@ void NewAudioConferenceMixerImpl::Process() { |
| return; |
| } |
| -int32_t NewAudioConferenceMixerImpl::RegisterMixedStreamCallback( |
| - OldAudioMixerOutputReceiver* mixReceiver) { |
| - CriticalSectionScoped cs(_cbCrit.get()); |
| - if (_mixReceiver != NULL) { |
| - return -1; |
| - } |
| - _mixReceiver = mixReceiver; |
| - return 0; |
| -} |
| - |
| -int32_t NewAudioConferenceMixerImpl::UnRegisterMixedStreamCallback() { |
| - CriticalSectionScoped cs(_cbCrit.get()); |
| - if (_mixReceiver == NULL) { |
| - return -1; |
| - } |
| - _mixReceiver = NULL; |
| - return 0; |
| -} |
| - |
| int32_t NewAudioConferenceMixerImpl::SetOutputFrequency( |
| const Frequency& frequency) { |
| CriticalSectionScoped cs(_crit.get()); |