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

Side by Side Diff: webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc

Issue 1174813003: Prepare to convert various types to size_t. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Review comments + resync Created 5 years, 6 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
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 for (int n = 0; n < frame.samples_per_channel_; ++n) 82 for (int n = 0; n < frame.samples_per_channel_; ++n)
83 out_buff[n] = (frame.data_[2 * n] + frame.data_[2 * n + 1]) >> 1; 83 out_buff[n] = (frame.data_[2 * n] + frame.data_[2 * n + 1]) >> 1;
84 return 0; 84 return 0;
85 } 85 }
86 86
87 // Mono-to-stereo can be used as in-place. 87 // Mono-to-stereo can be used as in-place.
88 int UpMix(const AudioFrame& frame, int length_out_buff, int16_t* out_buff) { 88 int UpMix(const AudioFrame& frame, int length_out_buff, int16_t* out_buff) {
89 if (length_out_buff < frame.samples_per_channel_) { 89 if (length_out_buff < frame.samples_per_channel_) {
90 return -1; 90 return -1;
91 } 91 }
92 for (int n = frame.samples_per_channel_ - 1; n >= 0; --n) { 92 for (int n = frame.samples_per_channel_; n > 0; --n) {
93 out_buff[2 * n + 1] = frame.data_[n]; 93 int i = n - 1;
94 out_buff[2 * n] = frame.data_[n]; 94 int16_t sample = frame.data_[i];
95 out_buff[2 * i + 1] = sample;
96 out_buff[2 * i] = sample;
95 } 97 }
96 return 0; 98 return 0;
97 } 99 }
98 100
99 void ConvertEncodedInfoToFragmentationHeader( 101 void ConvertEncodedInfoToFragmentationHeader(
100 const AudioEncoder::EncodedInfo& info, 102 const AudioEncoder::EncodedInfo& info,
101 RTPFragmentationHeader* frag) { 103 RTPFragmentationHeader* frag) {
102 if (info.redundant.empty()) { 104 if (info.redundant.empty()) {
103 frag->fragmentationVectorSize = 0; 105 frag->fragmentationVectorSize = 0;
104 return; 106 return;
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 *channels = 1; 1257 *channels = 1;
1256 break; 1258 break;
1257 #endif 1259 #endif
1258 default: 1260 default:
1259 FATAL() << "Codec type " << codec_type << " not supported."; 1261 FATAL() << "Codec type " << codec_type << " not supported.";
1260 } 1262 }
1261 return true; 1263 return true;
1262 } 1264 }
1263 1265
1264 } // namespace webrtc 1266 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/codecs/opus/opus_unittest.cc ('k') | webrtc/modules/audio_coding/neteq/expand.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698