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

Side by Side Diff: webrtc/modules/audio_coding/neteq/audio_multi_vector.cc

Issue 1750353002: Change NetEq::GetAudio to use AudioFrame (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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
11 #include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h" 11 #include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h"
12 12
13 #include <assert.h> 13 #include <assert.h>
14 14
15 #include <algorithm> 15 #include <algorithm>
16 16
17 #include "webrtc/base/checks.h"
17 #include "webrtc/typedefs.h" 18 #include "webrtc/typedefs.h"
18 19
19 namespace webrtc { 20 namespace webrtc {
20 21
21 AudioMultiVector::AudioMultiVector(size_t N) { 22 AudioMultiVector::AudioMultiVector(size_t N) {
22 assert(N > 0); 23 assert(N > 0);
23 if (N < 1) N = 1; 24 if (N < 1) N = 1;
24 for (size_t n = 0; n < N; ++n) { 25 for (size_t n = 0; n < N; ++n) {
25 channels_.push_back(new AudioVector); 26 channels_.push_back(new AudioVector);
26 } 27 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 124 }
124 125
125 size_t AudioMultiVector::ReadInterleaved(size_t length, 126 size_t AudioMultiVector::ReadInterleaved(size_t length,
126 int16_t* destination) const { 127 int16_t* destination) const {
127 return ReadInterleavedFromIndex(0, length, destination); 128 return ReadInterleavedFromIndex(0, length, destination);
128 } 129 }
129 130
130 size_t AudioMultiVector::ReadInterleavedFromIndex(size_t start_index, 131 size_t AudioMultiVector::ReadInterleavedFromIndex(size_t start_index,
131 size_t length, 132 size_t length,
132 int16_t* destination) const { 133 int16_t* destination) const {
133 if (!destination) { 134 RTC_DCHECK(destination);
134 return 0;
135 }
136 size_t index = 0; // Number of elements written to |destination| so far. 135 size_t index = 0; // Number of elements written to |destination| so far.
137 assert(start_index <= Size()); 136 assert(start_index <= Size());
138 start_index = std::min(start_index, Size()); 137 start_index = std::min(start_index, Size());
139 if (length + start_index > Size()) { 138 if (length + start_index > Size()) {
140 length = Size() - start_index; 139 length = Size() - start_index;
141 } 140 }
142 if (num_channels_ == 1) { 141 if (num_channels_ == 1) {
143 // Special case to avoid the nested for loop below. 142 // Special case to avoid the nested for loop below.
144 memcpy(destination, &(*this)[0][start_index], length * sizeof(int16_t)); 143 memcpy(destination, &(*this)[0][start_index], length * sizeof(int16_t));
145 return length; 144 return length;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 213
215 const AudioVector& AudioMultiVector::operator[](size_t index) const { 214 const AudioVector& AudioMultiVector::operator[](size_t index) const {
216 return *(channels_[index]); 215 return *(channels_[index]);
217 } 216 }
218 217
219 AudioVector& AudioMultiVector::operator[](size_t index) { 218 AudioVector& AudioMultiVector::operator[](size_t index) {
220 return *(channels_[index]); 219 return *(channels_[index]);
221 } 220 }
222 221
223 } // namespace webrtc 222 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/acm2/acm_receiver.cc ('k') | webrtc/modules/audio_coding/neteq/audio_multi_vector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698