Chromium Code Reviews| Index: webrtc/modules/audio_processing/agc/legacy/analog_agc.c |
| diff --git a/webrtc/modules/audio_processing/agc/legacy/analog_agc.c b/webrtc/modules/audio_processing/agc/legacy/analog_agc.c |
| index be644d9701eb8b76a2939df8a552b61001feca9e..3a1dc9d5ce42ccfe5a27803eb0e91bff0c5ee2e3 100644 |
| --- a/webrtc/modules/audio_processing/agc/legacy/analog_agc.c |
| +++ b/webrtc/modules/audio_processing/agc/legacy/analog_agc.c |
| @@ -250,34 +250,35 @@ int WebRtcAgc_AddMic(void *state, int16_t* const* in_mic, size_t num_bands, |
| return 0; |
| } |
| -int WebRtcAgc_AddFarend(void *state, const int16_t *in_far, size_t samples) |
| -{ |
| +int WebRtcAgc_AddFarend(void *state, const int16_t *in_far, size_t samples) { |
| + LegacyAgc* stt = (LegacyAgc*)state; |
| + |
| + int err = WebRtcAgc_GetAddFarendError(state, samples); |
| + |
| + if (err != 0) |
| + return err; |
| + |
| + return WebRtcAgc_AddFarendToDigital(&stt->digitalAgc, in_far, samples); |
| +} |
| + |
| +int WebRtcAgc_GetAddFarendError(void *state, size_t samples) { |
|
hlundin-webrtc
2015/11/05 13:01:09
Take a LegacyAgc* as input argument instead, and s
peah-webrtc
2015/11/06 07:10:58
That would be better, but since LegacyAgc is not a
hlundin-webrtc
2015/11/06 07:52:33
Acknowledged.
peah-webrtc
2015/11/06 08:10:03
Acknowledged.
|
| LegacyAgc* stt; |
| stt = (LegacyAgc*)state; |
| - if (stt == NULL) |
| - { |
| - return -1; |
| - } |
| + if (stt == NULL) |
| + return -1; |
| - if (stt->fs == 8000) |
| - { |
| - if (samples != 80) |
| - { |
| - return -1; |
| - } |
| - } else if (stt->fs == 16000 || stt->fs == 32000 || stt->fs == 48000) |
| - { |
| - if (samples != 160) |
| - { |
| - return -1; |
| - } |
| - } else |
| - { |
| - return -1; |
| - } |
| + if (stt->fs == 8000) { |
| + if (samples != 80) |
| + return -1; |
| + } else if (stt->fs == 16000 || stt->fs == 32000 || stt->fs == 48000) { |
| + if (samples != 160) |
| + return -1; |
| + } else { |
| + return -1; |
| + } |
| - return WebRtcAgc_AddFarendToDigital(&stt->digitalAgc, in_far, samples); |
| + return 0; |
| } |
| int WebRtcAgc_VirtualMic(void *agcInst, int16_t* const* in_near, |