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

Side by Side Diff: webrtc/modules/audio_coding/main/test/PCMFile.cc

Issue 1235643003: Miscellaneous changes split from https://codereview.webrtc.org/1230503003 . (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 5 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 void PCMFile::Write10MsData(AudioFrame& audio_frame) { 143 void PCMFile::Write10MsData(AudioFrame& audio_frame) {
144 if (audio_frame.num_channels_ == 1) { 144 if (audio_frame.num_channels_ == 1) {
145 if (!save_stereo_) { 145 if (!save_stereo_) {
146 if (fwrite(audio_frame.data_, sizeof(uint16_t), 146 if (fwrite(audio_frame.data_, sizeof(uint16_t),
147 audio_frame.samples_per_channel_, pcm_file_) != 147 audio_frame.samples_per_channel_, pcm_file_) !=
148 static_cast<size_t>(audio_frame.samples_per_channel_)) { 148 static_cast<size_t>(audio_frame.samples_per_channel_)) {
149 return; 149 return;
150 } 150 }
151 } else { 151 } else {
152 int16_t* stereo_audio = new int16_t[2 * audio_frame.samples_per_channel_]; 152 int16_t* stereo_audio = new int16_t[2 * audio_frame.samples_per_channel_];
153 int k; 153 for (int k = 0; k < audio_frame.samples_per_channel_; k++) {
154 for (k = 0; k < audio_frame.samples_per_channel_; k++) {
155 stereo_audio[k << 1] = audio_frame.data_[k]; 154 stereo_audio[k << 1] = audio_frame.data_[k];
156 stereo_audio[(k << 1) + 1] = audio_frame.data_[k]; 155 stereo_audio[(k << 1) + 1] = audio_frame.data_[k];
157 } 156 }
158 if (fwrite(stereo_audio, sizeof(int16_t), 157 if (fwrite(stereo_audio, sizeof(int16_t),
159 2 * audio_frame.samples_per_channel_, pcm_file_) != 158 2 * audio_frame.samples_per_channel_, pcm_file_) !=
160 static_cast<size_t>(2 * audio_frame.samples_per_channel_)) { 159 static_cast<size_t>(2 * audio_frame.samples_per_channel_)) {
161 return; 160 return;
162 } 161 }
163 delete[] stereo_audio; 162 delete[] stereo_audio;
164 } 163 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 195
197 void PCMFile::SaveStereo(bool is_stereo) { 196 void PCMFile::SaveStereo(bool is_stereo) {
198 save_stereo_ = is_stereo; 197 save_stereo_ = is_stereo;
199 } 198 }
200 199
201 void PCMFile::ReadStereo(bool is_stereo) { 200 void PCMFile::ReadStereo(bool is_stereo) {
202 read_stereo_ = is_stereo; 201 read_stereo_ = is_stereo;
203 } 202 }
204 203
205 } // namespace webrtc 204 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc ('k') | webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698