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 |
11 #include "webrtc/modules/audio_mixer/source/new_audio_conference_mixer_impl.h" | 11 #include "webrtc/modules/audio_mixer/new_audio_conference_mixer_impl.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <functional> | 14 #include <functional> |
15 | 15 |
16 #include "webrtc/modules/audio_conference_mixer/source/audio_frame_manipulator.h
" | 16 #include "webrtc/modules/audio_mixer/audio_frame_manipulator.h" |
17 #include "webrtc/modules/audio_mixer/include/audio_mixer_defines.h" | 17 #include "webrtc/modules/audio_mixer/audio_mixer_defines.h" |
18 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 18 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
19 #include "webrtc/modules/utility/include/audio_frame_operations.h" | 19 #include "webrtc/modules/utility/include/audio_frame_operations.h" |
20 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 20 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
21 #include "webrtc/system_wrappers/include/trace.h" | 21 #include "webrtc/system_wrappers/include/trace.h" |
22 #include "webrtc/voice_engine/utility.h" | 22 #include "webrtc/voice_engine/utility.h" |
23 | 23 |
24 namespace webrtc { | 24 namespace webrtc { |
25 namespace { | 25 namespace { |
26 | 26 |
27 class SourceFrame { | 27 class SourceFrame { |
28 public: | 28 public: |
29 SourceFrame(MixerAudioSource* p, AudioFrame* a, bool m, bool was_mixed_before) | 29 SourceFrame(MixerAudioSource* p, AudioFrame* a, bool m, bool was_mixed_before) |
30 : audio_source_(p), | 30 : audio_source_(p), |
31 audio_frame_(a), | 31 audio_frame_(a), |
32 muted_(m), | 32 muted_(m), |
33 was_mixed_before_(was_mixed_before) { | 33 was_mixed_before_(was_mixed_before) { |
34 if (!muted_) { | 34 if (!muted_) { |
35 energy_ = CalculateEnergy(*a); | 35 energy_ = NewMixerCalculateEnergy(*a); |
36 } | 36 } |
37 } | 37 } |
38 | 38 |
39 // a.shouldMixBefore(b) is used to select mixer participants. | 39 // a.shouldMixBefore(b) is used to select mixer participants. |
40 bool shouldMixBefore(const SourceFrame& other) const { | 40 bool shouldMixBefore(const SourceFrame& other) const { |
41 if (muted_ != other.muted_) { | 41 if (muted_ != other.muted_) { |
42 return other.muted_; | 42 return other.muted_; |
43 } | 43 } |
44 | 44 |
45 auto our_activity = audio_frame_->vad_activity_; | 45 auto our_activity = audio_frame_->vad_activity_; |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 if (p.muted_) { | 403 if (p.muted_) { |
404 p.audio_source_->_mixHistory->SetIsMixed(false); | 404 p.audio_source_->_mixHistory->SetIsMixed(false); |
405 continue; | 405 continue; |
406 } | 406 } |
407 | 407 |
408 // Add frame to result vector for mixing. | 408 // Add frame to result vector for mixing. |
409 bool is_mixed = false; | 409 bool is_mixed = false; |
410 if (maxAudioFrameCounter > 0) { | 410 if (maxAudioFrameCounter > 0) { |
411 --maxAudioFrameCounter; | 411 --maxAudioFrameCounter; |
412 if (!p.was_mixed_before_) { | 412 if (!p.was_mixed_before_) { |
413 RampIn(*p.audio_frame_); | 413 NewMixerRampIn(p.audio_frame_); |
414 } | 414 } |
415 result.emplace_back(p.audio_frame_, false); | 415 result.emplace_back(p.audio_frame_, false); |
416 is_mixed = true; | 416 is_mixed = true; |
417 } | 417 } |
418 | 418 |
419 // Ramp out unmuted. | 419 // Ramp out unmuted. |
420 if (p.was_mixed_before_ && !is_mixed) { | 420 if (p.was_mixed_before_ && !is_mixed) { |
421 RampOut(*p.audio_frame_); | 421 NewMixerRampOut(p.audio_frame_); |
422 result.emplace_back(p.audio_frame_, false); | 422 result.emplace_back(p.audio_frame_, false); |
423 } | 423 } |
424 | 424 |
425 p.audio_source_->_mixHistory->SetIsMixed(is_mixed); | 425 p.audio_source_->_mixHistory->SetIsMixed(is_mixed); |
426 } | 426 } |
427 return result; | 427 return result; |
428 } | 428 } |
429 | 429 |
430 void NewAudioConferenceMixerImpl::GetAdditionalAudio( | 430 void NewAudioConferenceMixerImpl::GetAdditionalAudio( |
431 AudioFrameList* additionalFramesList) const { | 431 AudioFrameList* additionalFramesList) const { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 | 584 |
585 if (error != limiter_->kNoError) { | 585 if (error != limiter_->kNoError) { |
586 WEBRTC_TRACE(kTraceError, kTraceAudioMixerServer, id_, | 586 WEBRTC_TRACE(kTraceError, kTraceAudioMixerServer, id_, |
587 "Error from AudioProcessing: %d", error); | 587 "Error from AudioProcessing: %d", error); |
588 RTC_NOTREACHED(); | 588 RTC_NOTREACHED(); |
589 return false; | 589 return false; |
590 } | 590 } |
591 return true; | 591 return true; |
592 } | 592 } |
593 } // namespace webrtc | 593 } // namespace webrtc |
OLD | NEW |