From 5771beb265129082d31736259b7dc6ca037cff4d Mon Sep 17 00:00:00 2001 From: Tommi Date: Thu, 26 May 2016 21:51:30 +0200 Subject: [PATCH] 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} Review URL: https://codereview.webrtc.org/2014973002 . Cr-Commit-Position: refs/heads/master@{#12926} --- .../audio_coding/acm2/audio_coding_module_unittest_oldapi.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc b/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc index d30a63c448..eefe0a5420 100644 --- a/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc +++ b/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc @@ -309,11 +309,14 @@ TEST_F(AudioCodingModuleTestOldApi, VerifyOutputFrame) { EXPECT_EQ(kSampleRateHz, audio_frame.sample_rate_hz_); } +#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) TEST_F(AudioCodingModuleTestOldApi, FailOnZeroDesiredFrequency) { AudioFrame audio_frame; bool muted; - EXPECT_EQ(-1, acm_->PlayoutData10Ms(0, &audio_frame, &muted)); + EXPECT_DEATH(acm_->PlayoutData10Ms(0, &audio_frame, &muted), + "dst_sample_rate_hz"); } +#endif // Checks that the transport callback is invoked once for each speech packet. // Also checks that the frame type is kAudioFrameSpeech.