diff --git a/common_audio/resampler/push_resampler.cc b/common_audio/resampler/push_resampler.cc index 837fec624a..810d778993 100644 --- a/common_audio/resampler/push_resampler.cc +++ b/common_audio/resampler/push_resampler.cc @@ -20,42 +20,6 @@ #include "rtc_base/checks.h" namespace webrtc { -namespace { -// These checks were factored out into a non-templatized function -// due to problems with clang on Windows in debug builds. -// For some reason having the DCHECKs inline in the template code -// caused the compiler to generate code that threw off the linker. -// TODO(tommi): Re-enable when we've figured out what the problem is. -// http://crbug.com/615050 -void CheckValidInitParams(int src_sample_rate_hz, - int dst_sample_rate_hz, - size_t num_channels) { -// The below checks are temporarily disabled on WEBRTC_WIN due to problems -// with clang debug builds. -#if !defined(WEBRTC_WIN) && defined(__clang__) - RTC_DCHECK_GT(src_sample_rate_hz, 0); - RTC_DCHECK_GT(dst_sample_rate_hz, 0); - RTC_DCHECK_GT(num_channels, 0); -#endif -} - -void CheckExpectedBufferSizes(size_t src_length, - size_t dst_capacity, - size_t num_channels, - int src_sample_rate, - int dst_sample_rate) { -// The below checks are temporarily disabled on WEBRTC_WIN due to problems -// with clang debug builds. -// TODO(tommi): Re-enable when we've figured out what the problem is. -// http://crbug.com/615050 -#if !defined(WEBRTC_WIN) && defined(__clang__) - const size_t src_size_10ms = (src_sample_rate / 100) * num_channels; - const size_t dst_size_10ms = (dst_sample_rate / 100) * num_channels; - RTC_DCHECK_EQ(src_length, src_size_10ms); - RTC_DCHECK_GE(dst_capacity, dst_size_10ms); -#endif -} -} // namespace template PushResampler::PushResampler() @@ -68,7 +32,11 @@ template int PushResampler::InitializeIfNeeded(int src_sample_rate_hz, int dst_sample_rate_hz, size_t num_channels) { - CheckValidInitParams(src_sample_rate_hz, dst_sample_rate_hz, num_channels); + // These checks used to be factored out of this template function due to + // Windows debug build issues with clang. http://crbug.com/615050 + RTC_DCHECK_GT(src_sample_rate_hz, 0); + RTC_DCHECK_GT(dst_sample_rate_hz, 0); + RTC_DCHECK_GT(num_channels, 0); if (src_sample_rate_hz == src_sample_rate_hz_ && dst_sample_rate_hz == dst_sample_rate_hz_ && @@ -109,8 +77,12 @@ int PushResampler::Resample(const T* src, size_t src_length, T* dst, size_t dst_capacity) { - CheckExpectedBufferSizes(src_length, dst_capacity, num_channels_, - src_sample_rate_hz_, dst_sample_rate_hz_); + // These checks used to be factored out of this template function due to + // Windows debug build issues with clang. http://crbug.com/615050 + const size_t src_size_10ms = (src_sample_rate_hz_ / 100) * num_channels_; + const size_t dst_size_10ms = (dst_sample_rate_hz_ / 100) * num_channels_; + RTC_DCHECK_EQ(src_length, src_size_10ms); + RTC_DCHECK_GE(dst_capacity, dst_size_10ms); if (src_sample_rate_hz_ == dst_sample_rate_hz_) { // The old resampler provides this memcpy facility in the case of matching diff --git a/common_audio/resampler/push_resampler_unittest.cc b/common_audio/resampler/push_resampler_unittest.cc index f785ed92f0..91f2233aad 100644 --- a/common_audio/resampler/push_resampler_unittest.cc +++ b/common_audio/resampler/push_resampler_unittest.cc @@ -18,11 +18,6 @@ namespace webrtc { -// The below tests are temporarily disabled on WEBRTC_WIN due to problems -// with clang debug builds. -// TODO(tommi): Re-enable when we've figured out what the problem is. -// http://crbug.com/615050 -#if !defined(WEBRTC_WIN) && defined(__clang__) && !defined(NDEBUG) TEST(PushResamplerTest, VerifiesInputParameters) { PushResampler resampler; EXPECT_EQ(0, resampler.InitializeIfNeeded(16000, 16000, 1)); @@ -48,8 +43,6 @@ TEST(PushResamplerDeathTest, VerifiesBadInputParameters3) { RTC_EXPECT_DEATH(resampler.InitializeIfNeeded(16000, 16000, 0), "num_channels"); } - -#endif #endif } // namespace webrtc