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

Side by Side Diff: webrtc/modules/audio_coding/neteq/tools/audio_loop.cc

Issue 1727353002: Reset indexer upon initialization in AudioLoop. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: fixing a unittest Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « webrtc/modules/audio_coding/codecs/opus/opus_unittest.cc ('k') | 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 22 matching lines...) Expand all
33 if (block_length_samples > samples_read) return false; 33 if (block_length_samples > samples_read) return false;
34 34
35 // Add an extra block length of samples to the end of the array, starting 35 // Add an extra block length of samples to the end of the array, starting
36 // over again from the beginning of the array. This is done to simplify 36 // over again from the beginning of the array. This is done to simplify
37 // the reading process when reading over the end of the loop. 37 // the reading process when reading over the end of the loop.
38 memcpy(&audio_array_[samples_read], audio_array_.get(), 38 memcpy(&audio_array_[samples_read], audio_array_.get(),
39 block_length_samples * sizeof(int16_t)); 39 block_length_samples * sizeof(int16_t));
40 40
41 loop_length_samples_ = samples_read; 41 loop_length_samples_ = samples_read;
42 block_length_samples_ = block_length_samples; 42 block_length_samples_ = block_length_samples;
43 next_index_ = 0;
43 return true; 44 return true;
44 } 45 }
45 46
46 rtc::ArrayView<const int16_t> AudioLoop::GetNextBlock() { 47 rtc::ArrayView<const int16_t> AudioLoop::GetNextBlock() {
47 // Check that the AudioLoop is initialized. 48 // Check that the AudioLoop is initialized.
48 if (block_length_samples_ == 0) 49 if (block_length_samples_ == 0)
49 return rtc::ArrayView<const int16_t>(); 50 return rtc::ArrayView<const int16_t>();
50 51
51 const int16_t* output_ptr = &audio_array_[next_index_]; 52 const int16_t* output_ptr = &audio_array_[next_index_];
52 next_index_ = (next_index_ + block_length_samples_) % loop_length_samples_; 53 next_index_ = (next_index_ + block_length_samples_) % loop_length_samples_;
53 return rtc::ArrayView<const int16_t>(output_ptr, block_length_samples_); 54 return rtc::ArrayView<const int16_t>(output_ptr, block_length_samples_);
54 } 55 }
55 56
56 57
57 } // namespace test 58 } // namespace test
58 } // namespace webrtc 59 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/codecs/opus/opus_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698