From ab2bb82ac9a2c0e327c5a8327e39ca96211be695 Mon Sep 17 00:00:00 2001 From: "bjornv@webrtc.org" Date: Wed, 18 Jan 2012 14:51:02 +0000 Subject: [PATCH] VAD refactor: int return value for Init. For consistency and as part of style, the return value of WebRtcVad_Init() has been changed to int. Impact: 1) audio_processing, audio_coding, a test in CNG, functionTest in audio_conference_mixer, a test in net_eq all used int values. Hence, unaffected. 2) Function pointers in net_eq changed. 3) The VADInit in neteq/dsp.c boiled down to typecast into int anyhow, which now is removed. TEST=vad_unittests, neteq_unittests Review URL: https://webrtc-codereview.appspot.com/355003 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1453 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/common_audio/vad/include/webrtc_vad.h | 2 +- src/common_audio/vad/webrtc_vad.c | 2 +- src/modules/audio_coding/neteq/dsp.c | 2 +- src/modules/audio_coding/neteq/dsp.h | 2 +- .../audio_coding/neteq/interface/webrtc_neteq_internal.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common_audio/vad/include/webrtc_vad.h b/src/common_audio/vad/include/webrtc_vad.h index 6e3eb74ab..733cdca7f 100644 --- a/src/common_audio/vad/include/webrtc_vad.h +++ b/src/common_audio/vad/include/webrtc_vad.h @@ -110,7 +110,7 @@ WebRtc_Word16 WebRtcVad_Free(VadInst *vad_inst); * Return value : 0 - Ok * -1 - Error */ -WebRtc_Word16 WebRtcVad_Init(VadInst *vad_inst); +int WebRtcVad_Init(VadInst *vad_inst); /**************************************************************************** * WebRtcVad_set_mode(...) diff --git a/src/common_audio/vad/webrtc_vad.c b/src/common_audio/vad/webrtc_vad.c index dcfbda112..cd1d95e80 100644 --- a/src/common_audio/vad/webrtc_vad.c +++ b/src/common_audio/vad/webrtc_vad.c @@ -101,7 +101,7 @@ WebRtc_Word16 WebRtcVad_Free(VadInst *vad_inst) return 0; } -WebRtc_Word16 WebRtcVad_Init(VadInst *vad_inst) +int WebRtcVad_Init(VadInst *vad_inst) { short mode = 0; // Default high quality diff --git a/src/modules/audio_coding/neteq/dsp.c b/src/modules/audio_coding/neteq/dsp.c index 73396b2f5..53f7006ca 100644 --- a/src/modules/audio_coding/neteq/dsp.c +++ b/src/modules/audio_coding/neteq/dsp.c @@ -429,7 +429,7 @@ int WebRtcNetEQ_InitVAD(PostDecodeVAD_t *VADInst, WebRtc_UWord16 fs) && VADInst->setmodeFunction != NULL /* ... pointers ... */ && VADInst->VADFunction != NULL) /* ... are defined */ { - res = (int) VADInst->initFunction( VADInst->VADState ); /* call VAD init function */ + res = VADInst->initFunction( VADInst->VADState ); /* call VAD init function */ res |= WebRtcNetEQ_SetVADModeInternal( VADInst, VADInst->VADMode ); if (res!=0) diff --git a/src/modules/audio_coding/neteq/dsp.h b/src/modules/audio_coding/neteq/dsp.h index 0b0422939..ac947b24d 100644 --- a/src/modules/audio_coding/neteq/dsp.h +++ b/src/modules/audio_coding/neteq/dsp.h @@ -188,7 +188,7 @@ typedef struct ExpandInst_t_ * These function pointers match the definitions of WebRtc VAD functions WebRtcVad_Init, * WebRtcVad_set_mode and WebRtcVad_Process, respectively, all found in webrtc_vad.h. */ -typedef WebRtc_Word16 (*VADInitFunction)(void *VAD_inst); +typedef int (*VADInitFunction)(void *VAD_inst); typedef WebRtc_Word16 (*VADSetmodeFunction)(void *VAD_inst, WebRtc_Word16 mode); typedef WebRtc_Word16 (*VADFunction)(void *VAD_inst, WebRtc_Word16 fs, WebRtc_Word16 *frame, WebRtc_Word16 frameLen); diff --git a/src/modules/audio_coding/neteq/interface/webrtc_neteq_internal.h b/src/modules/audio_coding/neteq/interface/webrtc_neteq_internal.h index e7d09cbf8..b67abdd5d 100644 --- a/src/modules/audio_coding/neteq/interface/webrtc_neteq_internal.h +++ b/src/modules/audio_coding/neteq/interface/webrtc_neteq_internal.h @@ -138,7 +138,7 @@ int WebRtcNetEQ_GetRawFrameWaitingTimes(void *inst, * These function pointers match the definitions of webrtc VAD functions WebRtcVad_Init, * WebRtcVad_set_mode and WebRtcVad_Process, respectively, all found in webrtc_vad.h. */ -typedef WebRtc_Word16 (*WebRtcNetEQ_VADInitFunction)(void *VAD_inst); +typedef int (*WebRtcNetEQ_VADInitFunction)(void *VAD_inst); typedef WebRtc_Word16 (*WebRtcNetEQ_VADSetmodeFunction)(void *VAD_inst, WebRtc_Word16 mode); typedef WebRtc_Word16 (*WebRtcNetEQ_VADFunction)(void *VAD_inst, WebRtc_Word16 fs, WebRtc_Word16 *frame, WebRtc_Word16 frameLen);