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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 // to the buffer and no delay compensation nor AEC processing | 711 // to the buffer and no delay compensation nor AEC processing |
712 // has been done. | 712 // has been done. |
713 WebRtcAec_MoveFarReadPtr(aecpc->aec, overhead_elements); | 713 WebRtcAec_MoveFarReadPtr(aecpc->aec, overhead_elements); |
714 | 714 |
715 // Enable the AEC | 715 // Enable the AEC |
716 aecpc->startup_phase = 0; | 716 aecpc->startup_phase = 0; |
717 } | 717 } |
718 } | 718 } |
719 } else { | 719 } else { |
720 // AEC is enabled. | 720 // AEC is enabled. |
721 if (WebRtcAec_reported_delay_enabled(aecpc->aec)) { | 721 EstBufDelayNormal(aecpc); |
722 EstBufDelayNormal(aecpc); | |
723 } | |
724 | 722 |
725 // Call the AEC. | 723 // Call the AEC. |
726 // TODO(bjornv): Re-structure such that we don't have to pass | 724 // TODO(bjornv): Re-structure such that we don't have to pass |
727 // |aecpc->knownDelay| as input. Change name to something like | 725 // |aecpc->knownDelay| as input. Change name to something like |
728 // |system_buffer_diff|. | 726 // |system_buffer_diff|. |
729 WebRtcAec_ProcessFrames(aecpc->aec, | 727 WebRtcAec_ProcessFrames(aecpc->aec, |
730 nearend, | 728 nearend, |
731 num_bands, | 729 num_bands, |
732 nrOfSamples, | 730 nrOfSamples, |
733 aecpc->knownDelay, | 731 aecpc->knownDelay, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 // conservative and scale by 2. On Android we use a fixed delay and | 786 // conservative and scale by 2. On Android we use a fixed delay and |
789 // therefore there is no need to scale the target_delay. | 787 // therefore there is no need to scale the target_delay. |
790 target_delay /= 2; | 788 target_delay /= 2; |
791 #endif | 789 #endif |
792 int overhead_elements = | 790 int overhead_elements = |
793 (WebRtcAec_system_delay(self->aec) - target_delay) / PART_LEN; | 791 (WebRtcAec_system_delay(self->aec) - target_delay) / PART_LEN; |
794 WebRtcAec_MoveFarReadPtr(self->aec, overhead_elements); | 792 WebRtcAec_MoveFarReadPtr(self->aec, overhead_elements); |
795 self->startup_phase = 0; | 793 self->startup_phase = 0; |
796 } | 794 } |
797 | 795 |
798 if (WebRtcAec_reported_delay_enabled(self->aec)) { | 796 EstBufDelayExtended(self); |
799 EstBufDelayExtended(self); | |
800 } | |
801 | 797 |
802 { | 798 { |
803 // |delay_diff_offset| gives us the option to manually rewind the delay on | 799 // |delay_diff_offset| gives us the option to manually rewind the delay on |
804 // very low delay platforms which can't be expressed purely through | 800 // very low delay platforms which can't be expressed purely through |
805 // |reported_delay_ms|. | 801 // |reported_delay_ms|. |
806 const int adjusted_known_delay = | 802 const int adjusted_known_delay = |
807 WEBRTC_SPL_MAX(0, self->knownDelay + delay_diff_offset); | 803 WEBRTC_SPL_MAX(0, self->knownDelay + delay_diff_offset); |
808 | 804 |
809 WebRtcAec_ProcessFrames(self->aec, | 805 WebRtcAec_ProcessFrames(self->aec, |
810 near, | 806 near, |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 } | 910 } |
915 } else { | 911 } else { |
916 self->timeForDelayChange = 0; | 912 self->timeForDelayChange = 0; |
917 } | 913 } |
918 self->lastDelayDiff = delay_difference; | 914 self->lastDelayDiff = delay_difference; |
919 | 915 |
920 if (self->timeForDelayChange > 25) { | 916 if (self->timeForDelayChange > 25) { |
921 self->knownDelay = WEBRTC_SPL_MAX((int)self->filtDelay - 256, 0); | 917 self->knownDelay = WEBRTC_SPL_MAX((int)self->filtDelay - 256, 0); |
922 } | 918 } |
923 } | 919 } |
OLD | NEW |