Reland of Adding a some checks and switching out a few assert for RTC_[D]CHECK. (patchset #1 id:1 of https://codereview.webrtc.org/2018553002/ )
Adding a some checks and switching out a few assert for RTC_[D]CHECK.
These changes are around use of AudioFrame.data_ to help us catch issues earlier since assert() is left out in release builds, including builds with DCHECK enabled. I've also added a few full-on CHECKs to avoid reading past buffer boundaries or continuing on in a failed state.
TBR=kjellander@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Committed: https://crrev.com/60c4e0ae8f124f08372645a95042f4a1246d7aa3
Cr-Commit-Position: refs/heads/master@{#12925}
Committed: https://crrev.com/5771beb265129082d31736259b7dc6ca037cff4d
Cr-Commit-Position: refs/heads/master@{#12926}
Committed: https://crrev.com/54e1c6a500e390e543bce7b78fae65eb9bb14ab6
Cr-Commit-Position: refs/heads/master@{#12927}
Committed: https://crrev.com/f9d2fe983fe196373850c55acd3dc3824add480e
Cr-Commit-Position: refs/heads/master@{#12928}
Committed: f4fc0ff6f9
Committed: https://crrev.com/c47f0099eee08e8b6731a359563ba09dfe453ded
Cr-Commit-Position: refs/heads/master@{#12930}
Committed: https://crrev.com/0ad72ead67ce848b45541af6aba0a15486b5e0a7
Cr-Commit-Position: refs/heads/master@{#12931}
Review URL: https://codereview.webrtc.org/2014973002 .
Cr-Commit-Position: refs/heads/master@{#12933}
This commit is contained in:
parent
4c2db414be
commit
90edc65929
@ -23,9 +23,13 @@ namespace {
|
||||
// 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) {
|
||||
#if !defined(WEBRTC_WIN)
|
||||
// The below checks are temporarily disabled on WEBRTC_WIN due to problems
|
||||
// with clang debug builds.
|
||||
#if !defined(WEBRTC_WIN) && defined(__clang__) && !defined(NDEBUG)
|
||||
RTC_DCHECK_GT(src_sample_rate_hz, 0);
|
||||
RTC_DCHECK_GT(dst_sample_rate_hz, 0);
|
||||
RTC_DCHECK_GT(num_channels, 0u);
|
||||
@ -38,7 +42,11 @@ void CheckExpectedBufferSizes(size_t src_length,
|
||||
size_t num_channels,
|
||||
int src_sample_rate,
|
||||
int dst_sample_rate) {
|
||||
#if !defined(WEBRTC_WIN)
|
||||
// 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__) && !defined(NDEBUG)
|
||||
const size_t src_size_10ms = src_sample_rate * num_channels / 100;
|
||||
const size_t dst_size_10ms = dst_sample_rate * num_channels / 100;
|
||||
RTC_CHECK_EQ(src_length, src_size_10ms);
|
||||
|
||||
@ -18,7 +18,9 @@ namespace webrtc {
|
||||
|
||||
// The below tests are temporarily disabled on WEBRTC_WIN due to problems
|
||||
// with clang debug builds.
|
||||
#if !defined(WEBRTC_WIN)
|
||||
// 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<int16_t> resampler;
|
||||
EXPECT_EQ(0, resampler.InitializeIfNeeded(16000, 16000, 1));
|
||||
|
||||
@ -309,6 +309,11 @@ TEST_F(AudioCodingModuleTestOldApi, VerifyOutputFrame) {
|
||||
EXPECT_EQ(kSampleRateHz, audio_frame.sample_rate_hz_);
|
||||
}
|
||||
|
||||
// The below test is temporarily disabled on Windows 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)
|
||||
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
|
||||
TEST_F(AudioCodingModuleTestOldApi, FailOnZeroDesiredFrequency) {
|
||||
AudioFrame audio_frame;
|
||||
@ -317,6 +322,7 @@ TEST_F(AudioCodingModuleTestOldApi, FailOnZeroDesiredFrequency) {
|
||||
"dst_sample_rate_hz");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Checks that the transport callback is invoked once for each speech packet.
|
||||
// Also checks that the frame type is kAudioFrameSpeech.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user