From 2a796720f8b2b4e6fbcbf58e687781e412e4dc38 Mon Sep 17 00:00:00 2001 From: "bjornv@webrtc.org" Date: Tue, 22 Apr 2014 04:45:35 +0000 Subject: [PATCH] common_audio: VADFree() now returns void * Files in audio_coding are not affected since they never use the return value. * voice_detection in audio_processing does. * Updated vad_unittest.cc BUG=441 TESTED=trybots R=andrew@webrtc.org, tina.legrand@webrtc.org Review URL: https://webrtc-codereview.appspot.com/12059005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5948 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/common_audio/vad/include/webrtc_vad.h | 4 +--- webrtc/common_audio/vad/vad_unittest.cc | 3 +-- webrtc/common_audio/vad/webrtc_vad.c | 8 +------- webrtc/modules/audio_processing/voice_detection_impl.cc | 3 ++- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/webrtc/common_audio/vad/include/webrtc_vad.h b/webrtc/common_audio/vad/include/webrtc_vad.h index f6e959fa35..1a6e10a225 100644 --- a/webrtc/common_audio/vad/include/webrtc_vad.h +++ b/webrtc/common_audio/vad/include/webrtc_vad.h @@ -34,9 +34,7 @@ int WebRtcVad_Create(VadInst** handle); // Frees the dynamic memory of a specified VAD instance. // // - handle [i] : Pointer to VAD instance that should be freed. -// -// returns : 0 - (OK), -1 - (NULL pointer in) -int WebRtcVad_Free(VadInst* handle); +void WebRtcVad_Free(VadInst* handle); // Initializes a VAD instance. // diff --git a/webrtc/common_audio/vad/vad_unittest.cc b/webrtc/common_audio/vad/vad_unittest.cc index 1d73d34a40..a1127ad244 100644 --- a/webrtc/common_audio/vad/vad_unittest.cc +++ b/webrtc/common_audio/vad/vad_unittest.cc @@ -70,7 +70,6 @@ TEST_F(VadTest, ApiTest) { // NULL instance tests EXPECT_EQ(-1, WebRtcVad_Create(NULL)); EXPECT_EQ(-1, WebRtcVad_Init(NULL)); - EXPECT_EQ(-1, WebRtcVad_Free(NULL)); EXPECT_EQ(-1, WebRtcVad_set_mode(NULL, kModes[0])); EXPECT_EQ(-1, WebRtcVad_Process(NULL, kRates[0], speech, kFrameLengths[0])); @@ -121,7 +120,7 @@ TEST_F(VadTest, ApiTest) { } } - EXPECT_EQ(0, WebRtcVad_Free(handle)); + WebRtcVad_Free(handle); } TEST_F(VadTest, ValidRatesFrameLengths) { diff --git a/webrtc/common_audio/vad/webrtc_vad.c b/webrtc/common_audio/vad/webrtc_vad.c index 3acd3c37d8..3b31ef51f7 100644 --- a/webrtc/common_audio/vad/webrtc_vad.c +++ b/webrtc/common_audio/vad/webrtc_vad.c @@ -44,14 +44,8 @@ int WebRtcVad_Create(VadInst** handle) { return 0; } -int WebRtcVad_Free(VadInst* handle) { - if (handle == NULL) { - return -1; - } - +void WebRtcVad_Free(VadInst* handle) { free(handle); - - return 0; } // TODO(bjornv): Move WebRtcVad_InitCore() code here. diff --git a/webrtc/modules/audio_processing/voice_detection_impl.cc b/webrtc/modules/audio_processing/voice_detection_impl.cc index 1b1dd8b80d..9deab3072b 100644 --- a/webrtc/modules/audio_processing/voice_detection_impl.cc +++ b/webrtc/modules/audio_processing/voice_detection_impl.cc @@ -164,7 +164,8 @@ void* VoiceDetectionImpl::CreateHandle() const { } int VoiceDetectionImpl::DestroyHandle(void* handle) const { - return WebRtcVad_Free(static_cast(handle)); + WebRtcVad_Free(static_cast(handle)); + return apm_->kNoError; } int VoiceDetectionImpl::InitializeHandle(void* handle) const {