diff --git a/src/common_video/jpeg/jpeg_unittest.cc b/src/common_video/jpeg/jpeg_unittest.cc index 6b2126d28..da3a55f71 100644 --- a/src/common_video/jpeg/jpeg_unittest.cc +++ b/src/common_video/jpeg/jpeg_unittest.cc @@ -114,7 +114,10 @@ TEST_F(JpegTest, Encode) { // Save decoded image to file. FILE* save_file = fopen(decoded_filename_.c_str(), "wb"); - fwrite(image_buffer._buffer, 1, image_buffer._length, save_file); + if (fwrite(image_buffer._buffer, 1, + image_buffer._length, save_file) != image_buffer._length) { + return; + } fclose(save_file); delete[] image_buffer._buffer; diff --git a/src/common_video/libyuv/libyuv_unittest.cc b/src/common_video/libyuv/libyuv_unittest.cc index 24567e8d9..7ea4d2cd6 100644 --- a/src/common_video/libyuv/libyuv_unittest.cc +++ b/src/common_video/libyuv/libyuv_unittest.cc @@ -127,7 +127,10 @@ TEST_F(TestLibYuv, ConvertTest) { 0, width_, height_, width_, kRotateNone, res_i420_buffer)); - fwrite(res_i420_buffer, frame_length_, 1, output_file); + if (fwrite(res_i420_buffer, 1, frame_length_, + output_file) != static_cast(frame_length_)) { + return; + } psnr = I420PSNR(orig_buffer, res_i420_buffer, width_, height_); // Optimization Speed- quality trade-off => 45 dB only (platform dependant). EXPECT_GT(ceil(psnr), 44); @@ -142,7 +145,10 @@ TEST_F(TestLibYuv, ConvertTest) { 0, width_, height_, width_,kRotateNone, res_i420_buffer)); psnr = I420PSNR(orig_buffer, res_i420_buffer, width_, height_); EXPECT_EQ(48.0, psnr); - fwrite(res_i420_buffer, frame_length_, 1, output_file); + if (fwrite(res_i420_buffer, 1, frame_length_, + output_file) != static_cast(frame_length_)) { + return; + } j++; delete [] out_uyvy_buffer; @@ -154,7 +160,10 @@ TEST_F(TestLibYuv, ConvertTest) { kRotateNone, out_i420_buffer)); EXPECT_EQ(0, ConvertFromI420(out_i420_buffer, width_, kI420, 0, width_, height_, res_i420_buffer)); - fwrite(res_i420_buffer, frame_length_, 1, output_file); + if (fwrite(res_i420_buffer, 1, frame_length_, + output_file) != static_cast(frame_length_)) { + return; + } psnr = I420PSNR(orig_buffer, res_i420_buffer, width_, height_); EXPECT_EQ(48.0, psnr); j++; @@ -169,7 +178,10 @@ TEST_F(TestLibYuv, ConvertTest) { kI420, 0, width_, height_, res_i420_buffer)); - fwrite(res_i420_buffer, frame_length_, 1, output_file); + if (fwrite(res_i420_buffer, 1, frame_length_, + output_file) != static_cast(frame_length_)) { + return; + } psnr = I420PSNR(orig_buffer, res_i420_buffer, width_, height_); EXPECT_EQ(48.0, psnr); @@ -185,7 +197,10 @@ TEST_F(TestLibYuv, ConvertTest) { 0, width_, height_, width_, kRotateNone, res_i420_buffer)); - fwrite(res_i420_buffer, frame_length_, 1, output_file); + if (fwrite(res_i420_buffer, 1, frame_length_, + output_file) != static_cast(frame_length_)) { + return; + } psnr = I420PSNR(orig_buffer, res_i420_buffer, width_, height_); EXPECT_EQ(48.0, psnr); @@ -198,7 +213,10 @@ TEST_F(TestLibYuv, ConvertTest) { 0, width_, height_, width_, kRotateNone, res_i420_buffer)); - fwrite(res_i420_buffer, frame_length_, 1, output_file); + if (fwrite(res_i420_buffer, 1, frame_length_, + output_file) != static_cast(frame_length_)) { + return; + } psnr = I420PSNR(orig_buffer, res_i420_buffer, width_, height_); // TODO(leozwang) Investigate the right psnr should be set for I420ToRGB565, // Another example is I420ToRGB24, the psnr is 44 @@ -213,7 +231,10 @@ TEST_F(TestLibYuv, ConvertTest) { 0, width_, height_, width_, kRotateNone, res_i420_buffer)); - fwrite(res_i420_buffer, frame_length_, 1, output_file); + if (fwrite(res_i420_buffer, 1, frame_length_, + output_file) != static_cast(frame_length_)) { + return; + } psnr = I420PSNR(orig_buffer, res_i420_buffer, width_, height_); // TODO(leozwang) Investigate the right psnr should be set for I420ToARGB8888, EXPECT_GT(ceil(psnr), 42); diff --git a/src/common_video/libyuv/scaler_unittest.cc b/src/common_video/libyuv/scaler_unittest.cc index 899ad89ad..01cada6a9 100644 --- a/src/common_video/libyuv/scaler_unittest.cc +++ b/src/common_video/libyuv/scaler_unittest.cc @@ -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 @@ -221,7 +221,10 @@ void TestScaler::ScaleSequence(ScaleMethod method, EXPECT_EQ(0, test_scaler_.Scale(input_buffer, output_buffer, out_required_size)); total_clock += TickTime::MillisecondTimestamp() - start_clock; - fwrite(output_buffer, out_required_size, 1, output_file); + if (fwrite(output_buffer, 1, out_required_size, + output_file) != static_cast(out_required_size)) { + return; + } frame_count++; } diff --git a/src/modules/video_coding/codecs/test_framework/normal_async_test.cc b/src/modules/video_coding/codecs/test_framework/normal_async_test.cc index 43b644001..e38bc38cf 100644 --- a/src/modules/video_coding/codecs/test_framework/normal_async_test.cc +++ b/src/modules/video_coding/codecs/test_framework/normal_async_test.cc @@ -246,7 +246,10 @@ VideoEncodeCompleteCallback::Encoded(EncodedImage& encodedImage, _test.CopyEncodedImage(*newBuffer, encodedImage, codecSpecificInfoCopy); if (_encodedFile != NULL) { - fwrite(newBuffer->GetBuffer(), 1, newBuffer->GetLength(), _encodedFile); + if (fwrite(newBuffer->GetBuffer(), 1, newBuffer->GetLength(), + _encodedFile) != newBuffer->GetLength()) { + return -1; + } } _frameQueue->PushFrame(newBuffer, codecSpecificInfoCopy); return 0; @@ -264,7 +267,10 @@ VideoDecodeCompleteCallback::Decoded(RawImage& image) _decodedBytes += image._length; if (_decodedFile != NULL) { - fwrite(image._buffer, 1, image._length, _decodedFile); + if (fwrite(image._buffer, 1, image._length, + _decodedFile) != image._length) { + return -1; + } } return 0; } diff --git a/src/modules/video_coding/codecs/test_framework/normal_test.cc b/src/modules/video_coding/codecs/test_framework/normal_test.cc index 2adb0763d..b5dc96184 100644 --- a/src/modules/video_coding/codecs/test_framework/normal_test.cc +++ b/src/modules/video_coding/codecs/test_framework/normal_test.cc @@ -115,7 +115,7 @@ NormalTest::Perform() _inputVideoBuffer.VerifyAndAllocate(_lengthSourceFrame); _decodedVideoBuffer.VerifyAndAllocate(_lengthSourceFrame); _encodedVideoBuffer.VerifyAndAllocate(_lengthSourceFrame); - + _encoder->InitEncode(&_inst, 1, 1460); CodecSpecific_InitBitrate(); _decoder->InitDecode(&_inst,1); @@ -129,14 +129,21 @@ NormalTest::Perform() { DoPacketLoss(); _encodedVideoBuffer.UpdateLength(_encodedVideoBuffer.GetLength()); - fwrite(_encodedVideoBuffer.GetBuffer(), 1, _encodedVideoBuffer.GetLength(), _encodedFile); + if (fwrite(_encodedVideoBuffer.GetBuffer(), 1, + _encodedVideoBuffer.GetLength(), + _encodedFile) != _encodedVideoBuffer.GetLength()) { + return; + } decodeLength = Decode(); if (decodeLength < 0) { fprintf(stderr,"\n\nError in decoder: %d\n\n", decodeLength); exit(EXIT_FAILURE); } - fwrite(_decodedVideoBuffer.GetBuffer(), 1, decodeLength, _decodedFile); + if (fwrite(_decodedVideoBuffer.GetBuffer(), 1, decodeLength, + _decodedFile) != static_cast(decodeLength)) { + return; + } CodecSpecific_InitBitrate(); _framecnt++; } @@ -150,7 +157,10 @@ NormalTest::Perform() fprintf(stderr,"\n\nError in decoder: %d\n\n", decodeLength); exit(EXIT_FAILURE); } - fwrite(_decodedVideoBuffer.GetBuffer(), 1, decodeLength, _decodedFile); + if (fwrite(_decodedVideoBuffer.GetBuffer(), 1, decodeLength, + _decodedFile) != static_cast(decodeLength)) { + return; + } } double actualBitRate = ActualBitRate(_framecnt) / 1000.0; @@ -250,4 +260,3 @@ NormalTest::Decode(int lossValue) _encodedVideoBuffer.UpdateLength(0); return lengthDecFrame; } - diff --git a/src/modules/video_coding/codecs/test_framework/packet_loss_test.cc b/src/modules/video_coding/codecs/test_framework/packet_loss_test.cc index c94fc9a86..8afe2e738 100644 --- a/src/modules/video_coding/codecs/test_framework/packet_loss_test.cc +++ b/src/modules/video_coding/codecs/test_framework/packet_loss_test.cc @@ -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 @@ -74,7 +74,10 @@ PacketLossTest::Decoded(const RawImage& decodedImage) // write previous decoded frame again (frame freeze) if (_decodedFile && _lastFrame) { - fwrite(_lastFrame, 1, _lastFrameLength, _decodedFile); + if (fwrite(_lastFrame, 1, _lastFrameLength, + _decodedFile) != _lastFrameLength) { + return; + } } // remove frame from queue diff --git a/src/modules/video_coding/codecs/test_framework/video_source.cc b/src/modules/video_coding/codecs/test_framework/video_source.cc index 932e24c3f..a0299c4a4 100644 --- a/src/modules/video_coding/codecs/test_framework/video_source.cc +++ b/src/modules/video_coding/codecs/test_framework/video_source.cc @@ -240,8 +240,12 @@ VideoSource::Convert(const VideoSource &target, bool force /* = false */) const if (!fd.DropFrame()) { ASSERT_TRUE(target.GetWidth() == _width && - target.GetHeight() == _height); // Add video interpolator here! - fwrite(outFrame, 1, lengthOutFrame, outFile); + target.GetHeight() == _height); + // Add video interpolator here! + if (fwrite(outFrame, 1, lengthOutFrame, + outFile) != lengthOutFrame) { + return; + } } } diff --git a/src/modules/video_coding/main/source/video_coding_impl.cc b/src/modules/video_coding/main/source/video_coding_impl.cc index 902d11929..6ca8cd6c4 100644 --- a/src/modules/video_coding/main/source/video_coding_impl.cc +++ b/src/modules/video_coding/main/source/video_coding_impl.cc @@ -685,8 +685,10 @@ VideoCodingModuleImpl::AddVideoFrame(const VideoFrame& videoFrame, #ifdef DEBUG_ENCODER_INPUT if (_encoderInputFile != NULL) { - fwrite(videoFrame.Buffer(), 1, videoFrame.Length(), - _encoderInputFile); + if (fwrite(videoFrame.Buffer(), 1, videoFrame.Length(), + _encoderInputFile) != videoFrame.Length()) { + return -1; + } } #endif if (ret < 0) @@ -898,9 +900,11 @@ VideoCodingModuleImpl::Decode(WebRtc_UWord16 maxWaitTimeMs) #ifdef DEBUG_DECODER_BIT_STREAM if (_bitStreamBeforeDecoder != NULL) { - // Write bit stream to file for debugging purposes - fwrite(frame->Buffer(), 1, frame->Length(), - _bitStreamBeforeDecoder); + // Write bit stream to file for debugging purposes + if (fwrite(frame->Buffer(), 1, frame->Length(), + _bitStreamBeforeDecoder) != frame->Length()) { + return -1; + } } #endif if (_frameStorageCallback != NULL) diff --git a/src/modules/video_coding/main/test/media_opt_test.cc b/src/modules/video_coding/main/test/media_opt_test.cc index b20fce8b2..692305b26 100644 --- a/src/modules/video_coding/main/test/media_opt_test.cc +++ b/src/modules/video_coding/main/test/media_opt_test.cc @@ -330,8 +330,11 @@ MediaOptTest::Perform() } else { - // write frame to file - fwrite(sourceFrame.Buffer(), 1, sourceFrame.Length(), _actualSourceFile); + // write frame to file + if (fwrite(sourceFrame.Buffer(), 1, sourceFrame.Length(), + _actualSourceFile) != sourceFrame.Length()) { + return -1; + } } _sumEncBytes += encBytes; diff --git a/src/modules/video_coding/main/test/normal_test.cc b/src/modules/video_coding/main/test/normal_test.cc index 923d64962..f31cd2216 100644 --- a/src/modules/video_coding/main/test/normal_test.cc +++ b/src/modules/video_coding/main/test/normal_test.cc @@ -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 @@ -85,7 +85,9 @@ VCMNTEncodeCompleteCallback::SendData( // will call the VCMReceiver input packet _frameType = frameType; // writing encodedData into file - fwrite(payloadData, 1, payloadSize, _encodedFile); + if (fwrite(payloadData, 1, payloadSize, _encodedFile) != payloadSize) { + return -1; + } WebRtcRTPHeader rtpInfo; rtpInfo.header.markerBit = true; rtpInfo.type.Video.width = 0; @@ -163,7 +165,10 @@ VCMNTDecodeCompleCallback::FrameToRender(webrtc::VideoFrame& videoFrame) } _decodedFile = fopen(_outname.c_str(), "wb"); } - fwrite(videoFrame.Buffer(), 1, videoFrame.Length(), _decodedFile); + if (fwrite(videoFrame.Buffer(), 1, videoFrame.Length(), + _decodedFile) != videoFrame.Length()) { + return -1; + } _decodedBytes+= videoFrame.Length(); return VCM_OK; } @@ -396,7 +401,3 @@ NormalTest::Teardown() fclose(_encodedFile); return; } - - - - diff --git a/src/modules/video_coding/main/test/quality_modes_test.cc b/src/modules/video_coding/main/test/quality_modes_test.cc index e7da6915e..271e8a834 100644 --- a/src/modules/video_coding/main/test/quality_modes_test.cc +++ b/src/modules/video_coding/main/test/quality_modes_test.cc @@ -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 @@ -419,9 +419,12 @@ VCMQMDecodeCompleCallback::FrameToRender(VideoFrame& videoFrame) { if ((_origWidth == videoFrame.Width()) && (_origHeight == videoFrame.Height())) { - fwrite(videoFrame.Buffer(), 1, videoFrame.Length(), _decodedFile); - _frameCnt++; - //printf("frame dec # %d", _frameCnt); + if (fwrite(videoFrame.Buffer(), 1, videoFrame.Length(), + _decodedFile) != videoFrame.Length()) { + return -1; + } + _frameCnt++; + //printf("frame dec # %d", _frameCnt); // no need for interpolator and decBuffer if (_decBuffer != NULL) { @@ -446,7 +449,10 @@ VCMQMDecodeCompleCallback::FrameToRender(VideoFrame& videoFrame) } // interpolateFrame(_interpolator, videoFrame.Buffer(),_decBuffer); - fwrite(_decBuffer, 1, _origWidth*_origHeight*3/2, _decodedFile); + if (fwrite(_decBuffer, 1, _origWidth*_origHeight * 3/2, + _decodedFile) != _origWidth*_origHeight * 3/2) { + return -1; + } _frameCnt++; } diff --git a/src/modules/video_coding/main/test/test_callbacks.cc b/src/modules/video_coding/main/test/test_callbacks.cc index 348cbcc1d..34c7927fb 100644 --- a/src/modules/video_coding/main/test/test_callbacks.cc +++ b/src/modules/video_coding/main/test/test_callbacks.cc @@ -59,7 +59,9 @@ VCMEncodeCompleteCallback::SendData( // will call the VCMReceiver input packet _frameType = frameType; // writing encodedData into file - fwrite(payloadData, 1, payloadSize, _encodedFile); + if (fwrite(payloadData, 1, payloadSize, _encodedFile) != payloadSize) { + return -1; + } WebRtcRTPHeader rtpInfo; rtpInfo.header.markerBit = true; // end of frame rtpInfo.type.Video.isFirstPacket = true; @@ -184,9 +186,12 @@ VCMRTPEncodeCompleteCallback::EncodeComplete() WebRtc_Word32 VCMDecodeCompleteCallback::FrameToRender(VideoFrame& videoFrame) { - fwrite(videoFrame.Buffer(), 1, videoFrame.Length(), _decodedFile); - _decodedBytes+= videoFrame.Length(); - return VCM_OK; + if (fwrite(videoFrame.Buffer(), 1, videoFrame.Length(), + _decodedFile) != videoFrame.Length()) { + return -1; + } + _decodedBytes+= videoFrame.Length(); + return VCM_OK; } WebRtc_Word32 diff --git a/src/modules/video_coding/main/test/video_rtp_play.cc b/src/modules/video_coding/main/test/video_rtp_play.cc index 577408fee..fd58a3bcb 100644 --- a/src/modules/video_coding/main/test/video_rtp_play.cc +++ b/src/modules/video_coding/main/test/video_rtp_play.cc @@ -66,7 +66,10 @@ FrameReceiveCallback::FrameToRender(VideoFrame& videoFrame) fprintf(_timingFile, "%u, %u\n", videoFrame.TimeStamp(), MaskWord64ToUWord32(videoFrame.RenderTimeMs())); - fwrite(videoFrame.Buffer(), 1, videoFrame.Length(), _outFile); + if (fwrite(videoFrame.Buffer(), 1, videoFrame.Length(), + _outFile) != videoFrame.Length()) { + return -1; + } return 0; } diff --git a/src/modules/video_processing/main/test/unit_test/color_enhancement_test.cc b/src/modules/video_processing/main/test/unit_test/color_enhancement_test.cc index c494c856f..0a94db478 100644 --- a/src/modules/video_processing/main/test/unit_test/color_enhancement_test.cc +++ b/src/modules/video_processing/main/test/unit_test/color_enhancement_test.cc @@ -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 @@ -36,7 +36,7 @@ TEST_F(VideoProcessingModuleTest, ColorEnhancement) "foremanColorEnhancedVPM_cif_short.yuv"; FILE* modFile = fopen(output_file.c_str(), "w+b"); ASSERT_TRUE(modFile != NULL) << "Could not open output file.\n"; - + WebRtc_UWord32 frameNum = 0; while (fread(_videoFrame.Buffer(), 1, _frameLength, _sourceFile) == _frameLength) { @@ -45,11 +45,14 @@ TEST_F(VideoProcessingModuleTest, ColorEnhancement) ASSERT_EQ(0, VideoProcessingModule::ColorEnhancement(_videoFrame)); t1 = TickTime::Now(); accTicks += t1 - t0; - fwrite(_videoFrame.Buffer(), 1, _frameLength, modFile); + if (fwrite(_videoFrame.Buffer(), 1, _frameLength, + modFile) != _frameLength) { + return; + } } ASSERT_NE(0, feof(_sourceFile)) << "Error reading source file"; - printf("\nTime per frame: %d us \n", + printf("\nTime per frame: %d us \n", static_cast(accTicks.Microseconds() / frameNum)); rewind(modFile); @@ -71,7 +74,7 @@ TEST_F(VideoProcessingModuleTest, ColorEnhancement) ASSERT_NE(-1L, testLen); rewind(modFile); ASSERT_EQ(refLen, testLen) << "File lengths differ."; - + VideoFrame refVideoFrame; refVideoFrame.VerifyAndAllocate(_frameLength); refVideoFrame.SetWidth(_width); diff --git a/src/modules/video_processing/main/test/unit_test/deflickering_test.cc b/src/modules/video_processing/main/test/unit_test/deflickering_test.cc index f91dc133f..c189490df 100644 --- a/src/modules/video_processing/main/test/unit_test/deflickering_test.cc +++ b/src/modules/video_processing/main/test/unit_test/deflickering_test.cc @@ -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 @@ -55,16 +55,19 @@ TEST_F(VideoProcessingModuleTest, Deflickering) frameNum++; _videoFrame.SetTimeStamp(timeStamp); - t0 = TickTime::Now(); + t0 = TickTime::Now(); VideoProcessingModule::FrameStats stats; ASSERT_EQ(0, _vpm->GetFrameStats(stats, _videoFrame)); ASSERT_EQ(0, _vpm->Deflickering(_videoFrame, stats)); t1 = TickTime::Now(); accTicks += t1 - t0; - + if (runIdx == 0) { - fwrite(_videoFrame.Buffer(), 1, _frameLength, deflickerFile); + if (fwrite(_videoFrame.Buffer(), 1, _frameLength, + deflickerFile) != _frameLength) { + return; + } } timeStamp += (90000 / frameRate); } @@ -82,9 +85,9 @@ TEST_F(VideoProcessingModuleTest, Deflickering) ASSERT_EQ(0, fclose(deflickerFile)); // TODO(kjellander): Add verification of deflicker output file. - printf("\nAverage run time = %d us / frame\n", + printf("\nAverage run time = %d us / frame\n", static_cast(avgRuntime / frameNum / NumRuns)); - printf("Min run time = %d us / frame\n\n", + printf("Min run time = %d us / frame\n\n", static_cast(minRuntime / frameNum)); } diff --git a/src/modules/video_processing/main/test/unit_test/denoising_test.cc b/src/modules/video_processing/main/test/unit_test/denoising_test.cc index 173ceb8ce..0787f1d57 100644 --- a/src/modules/video_processing/main/test/unit_test/denoising_test.cc +++ b/src/modules/video_processing/main/test/unit_test/denoising_test.cc @@ -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 @@ -92,17 +92,23 @@ TEST_F(VideoProcessingModuleTest, Denoising) if (runIdx == 0) { - fwrite(_videoFrame.Buffer(), 1, _frameLength, noiseFile); + if (fwrite(_videoFrame.Buffer(), 1, _frameLength, + noiseFile) != _frameLength) { + return; + } } - - t0 = TickTime::Now(); + + t0 = TickTime::Now(); ASSERT_GE(modifiedPixels = _vpm->Denoising(_videoFrame), 0); t1 = TickTime::Now(); accTicks += t1 - t0; - + if (runIdx == 0) { - fwrite(_videoFrame.Buffer(), 1, _frameLength, denoiseFile); + if (fwrite(_videoFrame.Buffer(), 1, _frameLength, + denoiseFile) != _frameLength) { + return; + } } } ASSERT_NE(0, feof(_sourceFile)) << "Error reading source file"; @@ -118,9 +124,9 @@ TEST_F(VideoProcessingModuleTest, Denoising) } ASSERT_EQ(0, fclose(denoiseFile)); ASSERT_EQ(0, fclose(noiseFile)); - printf("\nAverage run time = %d us / frame\n", + printf("\nAverage run time = %d us / frame\n", static_cast(avgRuntime / frameNum / NumRuns)); - printf("Min run time = %d us / frame\n\n", + printf("Min run time = %d us / frame\n\n", static_cast(minRuntime / frameNum)); } diff --git a/src/modules/video_processing/main/test/unit_test/unit_test.cc b/src/modules/video_processing/main/test/unit_test/unit_test.cc index 1dbe07024..07e344913 100644 --- a/src/modules/video_processing/main/test/unit_test/unit_test.cc +++ b/src/modules/video_processing/main/test/unit_test/unit_test.cc @@ -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 @@ -334,7 +334,10 @@ void TestSize(VideoFrame& sourceFrame, WebRtc_UWord32 targetWidth, targetHeight != sourceFrame.Height()) { ASSERT_EQ((targetWidth * targetHeight * 3 / 2), outFrame->Length()); // Write to file for visual inspection - fwrite(outFrame->Buffer(), 1, outFrame->Length(), standAloneFile); + if (fwrite(outFrame->Buffer(), 1, + outFrame->Length(), standAloneFile) != outFrame->Length()) { + return; + } outFrame->Free(); } fclose(standAloneFile);