Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Unified Diff: webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc

Issue 2733803002: Fix segmentation fault in AudioEncoderOpusTest.EncodeAtMinBitrate. (Closed)
Patch Set: Respond to comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc
diff --git a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc
index a6c502b5986fa6da25acb85617044ed3498754ed..1d4fc2e7813c9c3b2eee1bc6596be2ace20e47f6 100644
--- a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc
+++ b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus_unittest.cc
@@ -125,10 +125,12 @@ std::unique_ptr<test::AudioLoop> Create10msAudioBlocks(
std::unique_ptr<test::AudioLoop> speech_data(new test::AudioLoop());
int audio_samples_per_ms =
rtc::CheckedDivExact(encoder->SampleRateHz(), 1000);
- RTC_DCHECK(speech_data->Init(
- file_name,
- packet_size_ms * audio_samples_per_ms * encoder->num_channels_to_encode(),
- 10 * audio_samples_per_ms * encoder->num_channels_to_encode()));
+ if (!speech_data->Init(
+ file_name,
+ packet_size_ms * audio_samples_per_ms *
+ encoder->num_channels_to_encode(),
+ 10 * audio_samples_per_ms * encoder->num_channels_to_encode()))
+ return nullptr;
return speech_data;
}
@@ -521,6 +523,7 @@ TEST(AudioEncoderOpusTest, EncodeAtMinBitrate) {
constexpr int kNumPacketsToEncode = 2;
auto audio_frames =
Create10msAudioBlocks(states.encoder, kNumPacketsToEncode * 20);
+ ASSERT_TRUE(audio_frames) << "Create10msAudioBlocks failed";
rtc::Buffer encoded;
uint32_t rtp_timestamp = 12345; // Just a number not important to this test.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698