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

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

Issue 1418423010: Pass audio to AudioEncoder::Encode() in an ArrayView (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 1 month 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
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 25 matching lines...) Expand all
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 return true; 43 return true;
44 } 44 }
45 45
46 const int16_t* AudioLoop::GetNextBlock() { 46 rtc::ArrayView<const int16_t> AudioLoop::GetNextBlock() {
47 // Check that the AudioLoop is initialized. 47 // Check that the AudioLoop is initialized.
48 if (block_length_samples_ == 0) return NULL; 48 if (block_length_samples_ == 0)
49 return rtc::ArrayView<const int16_t>();
49 50
50 const int16_t* output_ptr = &audio_array_[next_index_]; 51 const int16_t* output_ptr = &audio_array_[next_index_];
51 next_index_ = (next_index_ + block_length_samples_) % loop_length_samples_; 52 next_index_ = (next_index_ + block_length_samples_) % loop_length_samples_;
52 return output_ptr; 53 return rtc::ArrayView<const int16_t>(output_ptr, block_length_samples_);
53 } 54 }
54 55
55 56
56 } // namespace test 57 } // namespace test
57 } // namespace webrtc 58 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698