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