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

Side by Side Diff: webrtc/modules/audio_processing/test/aec_dump_based_simulator.cc

Issue 2573033003: Corrected access of null pointer in audioproc_f (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 dump_input_file_ = OpenFile(settings_.aec_dump_input_filename->c_str(), "rb"); 223 dump_input_file_ = OpenFile(settings_.aec_dump_input_filename->c_str(), "rb");
224 224
225 if (settings_.artificial_nearend_filename) { 225 if (settings_.artificial_nearend_filename) {
226 std::unique_ptr<WavReader> artificial_nearend_file( 226 std::unique_ptr<WavReader> artificial_nearend_file(
227 new WavReader(settings_.artificial_nearend_filename->c_str())); 227 new WavReader(settings_.artificial_nearend_filename->c_str()));
228 228
229 RTC_CHECK_EQ(1, artificial_nearend_file->num_channels()) 229 RTC_CHECK_EQ(1, artificial_nearend_file->num_channels())
230 << "Only mono files for the artificial nearend are supported, " 230 << "Only mono files for the artificial nearend are supported, "
231 "reverted to not using the artificial nearend file"; 231 "reverted to not using the artificial nearend file";
232 232
233 const int sample_rate_hz = artificial_nearend_file->sample_rate();
233 artificial_nearend_buffer_reader_.reset( 234 artificial_nearend_buffer_reader_.reset(
234 new ChannelBufferWavReader(std::move(artificial_nearend_file))); 235 new ChannelBufferWavReader(std::move(artificial_nearend_file)));
235 artificial_nearend_buf_.reset(new ChannelBuffer<float>( 236 artificial_nearend_buf_.reset(new ChannelBuffer<float>(
236 rtc::CheckedDivExact(artificial_nearend_file->sample_rate(), 237 rtc::CheckedDivExact(sample_rate_hz, kChunksPerSecond), 1));
ivoc 2016/12/14 10:26:41 Maybe I'm missing something, but to me it looks li
peah-webrtc 2016/12/14 10:33:40 I think what happens is that the pointer artificia
ivoc 2016/12/14 10:37:06 Ah right, that's a good point. It's easy to forget
237 kChunksPerSecond),
238 1));
239 } 238 }
240 239
241 webrtc::audioproc::Event event_msg; 240 webrtc::audioproc::Event event_msg;
242 int num_forward_chunks_processed = 0; 241 int num_forward_chunks_processed = 0;
243 const float kOneBykChunksPerSecond = 242 const float kOneBykChunksPerSecond =
244 1.f / AudioProcessingSimulator::kChunksPerSecond; 243 1.f / AudioProcessingSimulator::kChunksPerSecond;
245 while (ReadMessageFromFile(dump_input_file_, &event_msg)) { 244 while (ReadMessageFromFile(dump_input_file_, &event_msg)) {
246 switch (event_msg.type()) { 245 switch (event_msg.type()) {
247 case webrtc::audioproc::Event::INIT: 246 case webrtc::audioproc::Event::INIT:
248 RTC_CHECK(event_msg.has_init()); 247 RTC_CHECK(event_msg.has_init());
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 } 574 }
576 575
577 void AecDumpBasedSimulator::HandleMessage( 576 void AecDumpBasedSimulator::HandleMessage(
578 const webrtc::audioproc::ReverseStream& msg) { 577 const webrtc::audioproc::ReverseStream& msg) {
579 PrepareReverseProcessStreamCall(msg); 578 PrepareReverseProcessStreamCall(msg);
580 ProcessReverseStream(interface_used_ == InterfaceType::kFixedInterface); 579 ProcessReverseStream(interface_used_ == InterfaceType::kFixedInterface);
581 } 580 }
582 581
583 } // namespace test 582 } // namespace test
584 } // namespace webrtc 583 } // namespace webrtc
OLDNEW
« 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