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