diff --git a/src/modules/audio_processing/aec/aec_core.c b/src/modules/audio_processing/aec/aec_core.c index f43c9246ec..49c0d13f3a 100644 --- a/src/modules/audio_processing/aec/aec_core.c +++ b/src/modules/audio_processing/aec/aec_core.c @@ -686,8 +686,14 @@ static void ProcessBlock(aec_t* aec) { int16_t farend[PART_LEN]; int16_t* farend_ptr = NULL; WebRtc_ReadBuffer(aec->far_time_buf, (void**) &farend_ptr, farend, 1); - fwrite(farend_ptr, sizeof(int16_t), PART_LEN, aec->farFile); - fwrite(nearend_ptr, sizeof(int16_t), PART_LEN, aec->nearFile); + if (fwrite(farend_ptr, sizeof(int16_t), + PART_LEN, aec->farFile) != PART_LEN) { + return -1; + } + if (fwrite(nearend_ptr, sizeof(int16_t), + PART_LEN, aec->nearFile) != PART_LEN) { + return -1; + } } #endif @@ -844,8 +850,14 @@ static void ProcessBlock(aec_t* aec) { WEBRTC_SPL_WORD16_MIN); } - fwrite(eInt16, sizeof(int16_t), PART_LEN, aec->outLinearFile); - fwrite(output, sizeof(int16_t), PART_LEN, aec->outFile); + if (fwrite(eInt16, sizeof(int16_t), + PART_LEN, aec->outLinearFile) != PART_LEN) { + return -1; + } + if (fwrite(output, sizeof(int16_t), + PART_LEN, aec->outFile) != PART_LEN) { + return -1; + } } #endif } diff --git a/src/modules/audio_processing/aec/echo_cancellation.c b/src/modules/audio_processing/aec/echo_cancellation.c index 91553250e1..bd9d2c5b99 100644 --- a/src/modules/audio_processing/aec/echo_cancellation.c +++ b/src/modules/audio_processing/aec/echo_cancellation.c @@ -404,7 +404,10 @@ WebRtc_Word32 WebRtcAec_Process(void *aecInst, const WebRtc_Word16 *nearend, } #ifdef WEBRTC_AEC_DEBUG_DUMP - fwrite(&aecpc->skew, sizeof(aecpc->skew), 1, aecpc->skewFile); + if (fwrite(&aecpc->skew, sizeof(aecpc->skew), + 1, aecpc->skewFile) != 1) { + return -1; + } #endif } } @@ -537,8 +540,13 @@ WebRtc_Word32 WebRtcAec_Process(void *aecInst, const WebRtc_Word16 *nearend, { int16_t far_buf_size_ms = (int16_t) (aecpc->aec->system_delay / (sampMsNb * aecpc->aec->mult)); - fwrite(&far_buf_size_ms, 2, 1, aecpc->bufFile); - fwrite(&(aecpc->knownDelay), sizeof(aecpc->knownDelay), 1, aecpc->delayFile); + if (fwrite(&far_buf_size_ms, 2, 1, aecpc->bufFile) != 1) { + return -1; + } + if (fwrite(&(aecpc->knownDelay), sizeof(aecpc->knownDelay), + 1, aecpc->delayFile) != 1) { + return -1; + } } #endif diff --git a/src/modules/audio_processing/ns/nsx_core.c b/src/modules/audio_processing/ns/nsx_core.c index 51bde0c7c1..b8fe4b9bb1 100644 --- a/src/modules/audio_processing/ns/nsx_core.c +++ b/src/modules/audio_processing/ns/nsx_core.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source @@ -1887,7 +1887,10 @@ int WebRtcNsx_ProcessCore(NsxInst_t* inst, short* speechFrame, short* speechFram assert(inst->magnLen == inst->anaLen2 + 1); #ifdef NS_FILEDEBUG - fwrite(spframe, sizeof(short), inst->blockLen10ms, inst->infile); + if (fwrite(spframe, sizeof(short), + inst->blockLen10ms, inst->infile) != inst->blockLen10ms) { + return -1; + } #endif // Check that initialization has been done @@ -2364,7 +2367,10 @@ int WebRtcNsx_ProcessCore(NsxInst_t* inst, short* speechFrame, short* speechFram WebRtcNsx_DataSynthesis(inst, outFrame); #ifdef NS_FILEDEBUG - fwrite(outframe, sizeof(short), inst->blockLen10ms, inst->outfile); + if (fwrite(outframe, sizeof(short), + inst->blockLen10ms, inst->outfile) != inst->blockLen10ms) { + return -1; + } #endif //for H band: @@ -2440,5 +2446,3 @@ int WebRtcNsx_ProcessCore(NsxInst_t* inst, short* speechFrame, short* speechFram return 0; } - -