From 0117d1c48c698de58889e72ee15772654000277c Mon Sep 17 00:00:00 2001 From: "pbos@webrtc.org" Date: Mon, 3 Mar 2014 16:47:03 +0000 Subject: [PATCH] Fix compilation errors under clang 3.5. Enables building tip-of-tree clang which introduces new warnings that cause compilation errors in our code base (-Werror). BUG= R=andrew@webrtc.org, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/9319004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5630 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/modules/audio_processing/aec/aec_core.c | 2 +- webrtc/modules/audio_processing/agc/digital_agc.c | 7 +------ .../modules/remote_bitrate_estimator/overuse_detector.cc | 6 +++--- .../modules/video_coding/main/source/jitter_estimator.cc | 4 ++-- webrtc/modules/video_coding/main/source/receiver.cc | 4 ++-- webrtc/modules/video_coding/main/source/rtt_filter.cc | 2 +- .../video_coding/main/source/video_sender_unittest.cc | 2 +- webrtc/video/call_perf_tests.cc | 2 +- 8 files changed, 12 insertions(+), 17 deletions(-) diff --git a/webrtc/modules/audio_processing/aec/aec_core.c b/webrtc/modules/audio_processing/aec/aec_core.c index 9efa00d752..3f3d2c088d 100644 --- a/webrtc/modules/audio_processing/aec/aec_core.c +++ b/webrtc/modules/audio_processing/aec/aec_core.c @@ -741,7 +741,7 @@ int WebRtcAec_GetDelayMetricsCore(AecCore* self, int* median, int* std) { // Calculate the L1 norm, with median value as central moment. for (i = 0; i < kHistorySizeBlocks; i++) { - l1_norm += (float)(fabs(i - my_median) * self->delay_histogram[i]); + l1_norm += (float)abs(i - my_median) * self->delay_histogram[i]; } *std = (int)(l1_norm / (float)num_delay_values + 0.5f) * kMsPerBlock; diff --git a/webrtc/modules/audio_processing/agc/digital_agc.c b/webrtc/modules/audio_processing/agc/digital_agc.c index 00565dd723..faef914178 100644 --- a/webrtc/modules/audio_processing/agc/digital_agc.c +++ b/webrtc/modules/audio_processing/agc/digital_agc.c @@ -288,12 +288,7 @@ int32_t WebRtcAgc_InitDigital(DigitalAgc_t *stt, int16_t agcMode) int32_t WebRtcAgc_AddFarendToDigital(DigitalAgc_t *stt, const int16_t *in_far, int16_t nrSamples) { - // Check for valid pointer - if (&stt->vadFarend == NULL) - { - return -1; - } - + assert(stt != NULL); // VAD for far end WebRtcAgc_ProcessVad(&stt->vadFarend, in_far, nrSamples); diff --git a/webrtc/modules/remote_bitrate_estimator/overuse_detector.cc b/webrtc/modules/remote_bitrate_estimator/overuse_detector.cc index 86f6cb8ee3..4ac042f56a 100644 --- a/webrtc/modules/remote_bitrate_estimator/overuse_detector.cc +++ b/webrtc/modules/remote_bitrate_estimator/overuse_detector.cc @@ -249,10 +249,10 @@ void OveruseDetector::UpdateKalman(int64_t t_delta, const double residual = t_ts_delta - slope_*h[0] - offset_; const bool stable_state = - (BWE_MIN(num_of_deltas_, 60) * fabsf(offset_) < threshold_); + (BWE_MIN(num_of_deltas_, 60) * fabs(offset_) < threshold_); // We try to filter out very late frames. For instance periodic key // frames doesn't fit the Gaussian model well. - if (fabsf(residual) < 3 * sqrt(var_noise_)) { + if (fabs(residual) < 3 * sqrt(var_noise_)) { UpdateNoiseEstimate(residual, min_frame_period, stable_state); } else { UpdateNoiseEstimate(3 * sqrt(var_noise_), min_frame_period, stable_state); @@ -358,7 +358,7 @@ BandwidthUsage OveruseDetector::Detect(double ts_delta) { return kBwNormal; } const double T = BWE_MIN(num_of_deltas_, 60) * offset_; - if (fabsf(T) > threshold_) { + if (fabs(T) > threshold_) { if (offset_ > 0) { if (time_over_using_ == -1) { // Initialize the timer. Assume that we've been diff --git a/webrtc/modules/video_coding/main/source/jitter_estimator.cc b/webrtc/modules/video_coding/main/source/jitter_estimator.cc index deb036300e..083a9e69c1 100644 --- a/webrtc/modules/video_coding/main/source/jitter_estimator.cc +++ b/webrtc/modules/video_coding/main/source/jitter_estimator.cc @@ -162,7 +162,7 @@ VCMJitterEstimator::UpdateEstimate(int64_t frameDelayMS, uint32_t frameSizeBytes // deviation is probably due to an incorrect line slope. double deviation = DeviationFromExpectedDelay(frameDelayMS, deltaFS); - if (abs(deviation) < _numStdDevDelayOutlier * sqrt(_varNoise) || + if (fabs(deviation) < _numStdDevDelayOutlier * sqrt(_varNoise) || frameSizeBytes > _avgFrameSize + _numStdDevFrameSizeOutlier * sqrt(_varFrameSize)) { // Update the variance of the deviation from the @@ -257,7 +257,7 @@ VCMJitterEstimator::KalmanEstimateChannel(int64_t frameDelayMS, { return; } - double sigma = (300.0 * exp(-abs(static_cast(deltaFSBytes)) / + double sigma = (300.0 * exp(-fabs(static_cast(deltaFSBytes)) / (1e0 * _maxFrameSize)) + 1) * sqrt(_varNoise); if (sigma < 1.0) { diff --git a/webrtc/modules/video_coding/main/source/receiver.cc b/webrtc/modules/video_coding/main/source/receiver.cc index ae13ddd421..e3fc0ceac7 100644 --- a/webrtc/modules/video_coding/main/source/receiver.cc +++ b/webrtc/modules/video_coding/main/source/receiver.cc @@ -156,12 +156,12 @@ VCMEncodedFrame* VCMReceiver::FrameForDecoding( // Assume that render timing errors are due to changes in the video stream. if (next_render_time_ms < 0) { timing_error = true; - } else if (abs(next_render_time_ms - now_ms) > max_video_delay_ms_) { + } else if (labs(next_render_time_ms - now_ms) > max_video_delay_ms_) { WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCoding, VCMId(vcm_id_, receiver_id_), "This frame is out of our delay bounds, resetting jitter " "buffer: %d > %d", - static_cast(abs(next_render_time_ms - now_ms)), + static_cast(labs(next_render_time_ms - now_ms)), max_video_delay_ms_); timing_error = true; } else if (static_cast(timing_->TargetVideoDelay()) > diff --git a/webrtc/modules/video_coding/main/source/rtt_filter.cc b/webrtc/modules/video_coding/main/source/rtt_filter.cc index 25d89e54c0..473c8869a4 100644 --- a/webrtc/modules/video_coding/main/source/rtt_filter.cc +++ b/webrtc/modules/video_coding/main/source/rtt_filter.cc @@ -114,7 +114,7 @@ bool VCMRttFilter::JumpDetection(uint32_t rttMs) { double diffFromAvg = _avgRtt - rttMs; - if (abs(diffFromAvg) > _jumpStdDevs * sqrt(_varRtt)) + if (fabs(diffFromAvg) > _jumpStdDevs * sqrt(_varRtt)) { int diffSign = (diffFromAvg >= 0) ? 1 : -1; int jumpCountSign = (_jumpCount >= 0) ? 1 : -1; diff --git a/webrtc/modules/video_coding/main/source/video_sender_unittest.cc b/webrtc/modules/video_coding/main/source/video_sender_unittest.cc index 196eff3123..ca11ec473f 100644 --- a/webrtc/modules/video_coding/main/source/video_sender_unittest.cc +++ b/webrtc/modules/video_coding/main/source/video_sender_unittest.cc @@ -52,7 +52,7 @@ struct Vp8StreamInfo { MATCHER_P(MatchesVp8StreamInfo, expected, "") { bool res = true; for (int tl = 0; tl < kMaxNumberOfTemporalLayers; ++tl) { - if (abs(expected.framerate_fps[tl] - arg.framerate_fps[tl]) > 0.5) { + if (fabs(expected.framerate_fps[tl] - arg.framerate_fps[tl]) > 0.5) { *result_listener << " framerate_fps[" << tl << "] = " << arg.framerate_fps[tl] << " (expected " << expected.framerate_fps[tl] << ") "; diff --git a/webrtc/video/call_perf_tests.cc b/webrtc/video/call_perf_tests.cc index 4766ff81a1..e4de877759 100644 --- a/webrtc/video/call_perf_tests.cc +++ b/webrtc/video/call_perf_tests.cc @@ -184,7 +184,7 @@ class VideoRtcpAndSyncObserver : public SyncRtcpObserver, public VideoRenderer { // estimated as being synchronized. We don't want to trigger on those. if (time_since_creation < kStartupTimeMs) return; - if (abs(latest_audio_ntp - latest_video_ntp) < kInSyncThresholdMs) { + if (labs(latest_audio_ntp - latest_video_ntp) < kInSyncThresholdMs) { if (first_time_in_sync_ == -1) { first_time_in_sync_ = now_ms; webrtc::test::PrintResult("sync_convergence_time",