| OLD | NEW |
| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 in_file_mono_.Read10MsData(audio_frame); | 255 in_file_mono_.Read10MsData(audio_frame); |
| 256 } else { | 256 } else { |
| 257 if (in_file_stereo_.EndOfFile()) { | 257 if (in_file_stereo_.EndOfFile()) { |
| 258 break; | 258 break; |
| 259 } | 259 } |
| 260 in_file_stereo_.Read10MsData(audio_frame); | 260 in_file_stereo_.Read10MsData(audio_frame); |
| 261 } | 261 } |
| 262 | 262 |
| 263 // If input audio is sampled at 32 kHz, resampling to 48 kHz is required. | 263 // If input audio is sampled at 32 kHz, resampling to 48 kHz is required. |
| 264 EXPECT_EQ(480, | 264 EXPECT_EQ(480, |
| 265 resampler_.Resample10Msec(audio_frame.data_, | 265 resampler_.Resample10Msec(audio_frame.data(), |
| 266 audio_frame.sample_rate_hz_, | 266 audio_frame.sample_rate_hz_, |
| 267 48000, | 267 48000, |
| 268 channels, | 268 channels, |
| 269 kBufferSizeSamples - written_samples, | 269 kBufferSizeSamples - written_samples, |
| 270 &audio[written_samples])); | 270 &audio[written_samples])); |
| 271 written_samples += 480 * channels; | 271 written_samples += 480 * channels; |
| 272 | 272 |
| 273 // Sometimes we need to loop over the audio vector to produce the right | 273 // Sometimes we need to loop over the audio vector to produce the right |
| 274 // number of packets. | 274 // number of packets. |
| 275 size_t loop_encode = (written_samples - read_samples) / | 275 size_t loop_encode = (written_samples - read_samples) / |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 } | 340 } |
| 341 | 341 |
| 342 // Run received side of ACM. | 342 // Run received side of ACM. |
| 343 bool muted; | 343 bool muted; |
| 344 ASSERT_EQ( | 344 ASSERT_EQ( |
| 345 0, acm_receiver_->PlayoutData10Ms(out_freq_hz_b, &audio_frame, &muted)); | 345 0, acm_receiver_->PlayoutData10Ms(out_freq_hz_b, &audio_frame, &muted)); |
| 346 ASSERT_FALSE(muted); | 346 ASSERT_FALSE(muted); |
| 347 | 347 |
| 348 // Write output speech to file. | 348 // Write output speech to file. |
| 349 out_file_.Write10MsData( | 349 out_file_.Write10MsData( |
| 350 audio_frame.data_, | 350 audio_frame.data(), |
| 351 audio_frame.samples_per_channel_ * audio_frame.num_channels_); | 351 audio_frame.samples_per_channel_ * audio_frame.num_channels_); |
| 352 | 352 |
| 353 // Write stand-alone speech to file. | 353 // Write stand-alone speech to file. |
| 354 out_file_standalone_.Write10MsData(out_audio, decoded_samples * channels); | 354 out_file_standalone_.Write10MsData(out_audio, decoded_samples * channels); |
| 355 | 355 |
| 356 if (audio_frame.timestamp_ > start_time_stamp) { | 356 if (audio_frame.timestamp_ > start_time_stamp) { |
| 357 // Number of channels should be the same for both stand-alone and | 357 // Number of channels should be the same for both stand-alone and |
| 358 // ACM-decoding. | 358 // ACM-decoding. |
| 359 EXPECT_EQ(audio_frame.num_channels_, channels); | 359 EXPECT_EQ(audio_frame.num_channels_, channels); |
| 360 } | 360 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 381 out_file_.Open(file_name, 48000, "wb"); | 381 out_file_.Open(file_name, 48000, "wb"); |
| 382 file_stream.str(""); | 382 file_stream.str(""); |
| 383 file_name = file_stream.str(); | 383 file_name = file_stream.str(); |
| 384 file_stream << webrtc::test::OutputPath() << "opusstandalone_out_" | 384 file_stream << webrtc::test::OutputPath() << "opusstandalone_out_" |
| 385 << test_number << ".pcm"; | 385 << test_number << ".pcm"; |
| 386 file_name = file_stream.str(); | 386 file_name = file_stream.str(); |
| 387 out_file_standalone_.Open(file_name, 48000, "wb"); | 387 out_file_standalone_.Open(file_name, 48000, "wb"); |
| 388 } | 388 } |
| 389 | 389 |
| 390 } // namespace webrtc | 390 } // namespace webrtc |
| OLD | NEW |