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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 opus_stereo_decoder_ = NULL; | 55 opus_stereo_decoder_ = NULL; |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 void OpusTest::Perform() { | 59 void OpusTest::Perform() { |
60 #ifndef WEBRTC_CODEC_OPUS | 60 #ifndef WEBRTC_CODEC_OPUS |
61 // Opus isn't defined, exit. | 61 // Opus isn't defined, exit. |
62 return; | 62 return; |
63 #else | 63 #else |
64 uint16_t frequency_hz; | 64 uint16_t frequency_hz; |
65 int audio_channels; | 65 size_t audio_channels; |
66 int16_t test_cntr = 0; | 66 int16_t test_cntr = 0; |
67 | 67 |
68 // Open both mono and stereo test files in 32 kHz. | 68 // Open both mono and stereo test files in 32 kHz. |
69 const std::string file_name_stereo = | 69 const std::string file_name_stereo = |
70 webrtc::test::ResourcePath("audio_coding/teststereo32kHz", "pcm"); | 70 webrtc::test::ResourcePath("audio_coding/teststereo32kHz", "pcm"); |
71 const std::string file_name_mono = | 71 const std::string file_name_mono = |
72 webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm"); | 72 webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm"); |
73 frequency_hz = 32000; | 73 frequency_hz = 32000; |
74 in_file_stereo_.Open(file_name_stereo, frequency_hz, "rb"); | 74 in_file_stereo_.Open(file_name_stereo, frequency_hz, "rb"); |
75 in_file_stereo_.ReadStereo(true); | 75 in_file_stereo_.ReadStereo(true); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 Run(channel_a2b_, audio_channels, 64000, 960, 10); | 198 Run(channel_a2b_, audio_channels, 64000, 960, 10); |
199 | 199 |
200 // Close the files. | 200 // Close the files. |
201 in_file_stereo_.Close(); | 201 in_file_stereo_.Close(); |
202 in_file_mono_.Close(); | 202 in_file_mono_.Close(); |
203 out_file_.Close(); | 203 out_file_.Close(); |
204 out_file_standalone_.Close(); | 204 out_file_standalone_.Close(); |
205 #endif | 205 #endif |
206 } | 206 } |
207 | 207 |
208 void OpusTest::Run(TestPackStereo* channel, int channels, int bitrate, | 208 void OpusTest::Run(TestPackStereo* channel, size_t channels, int bitrate, |
209 size_t frame_length, int percent_loss) { | 209 size_t frame_length, int percent_loss) { |
210 AudioFrame audio_frame; | 210 AudioFrame audio_frame; |
211 int32_t out_freq_hz_b = out_file_.SamplingFrequency(); | 211 int32_t out_freq_hz_b = out_file_.SamplingFrequency(); |
212 const size_t kBufferSizeSamples = 480 * 12 * 2; // 120 ms stereo audio. | 212 const size_t kBufferSizeSamples = 480 * 12 * 2; // 120 ms stereo audio. |
213 int16_t audio[kBufferSizeSamples]; | 213 int16_t audio[kBufferSizeSamples]; |
214 int16_t out_audio[kBufferSizeSamples]; | 214 int16_t out_audio[kBufferSizeSamples]; |
215 int16_t audio_type; | 215 int16_t audio_type; |
216 size_t written_samples = 0; | 216 size_t written_samples = 0; |
217 size_t read_samples = 0; | 217 size_t read_samples = 0; |
218 size_t decoded_samples = 0; | 218 size_t decoded_samples = 0; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 out_file_.Open(file_name, 48000, "wb"); | 374 out_file_.Open(file_name, 48000, "wb"); |
375 file_stream.str(""); | 375 file_stream.str(""); |
376 file_name = file_stream.str(); | 376 file_name = file_stream.str(); |
377 file_stream << webrtc::test::OutputPath() << "opusstandalone_out_" | 377 file_stream << webrtc::test::OutputPath() << "opusstandalone_out_" |
378 << test_number << ".pcm"; | 378 << test_number << ".pcm"; |
379 file_name = file_stream.str(); | 379 file_name = file_stream.str(); |
380 out_file_standalone_.Open(file_name, 48000, "wb"); | 380 out_file_standalone_.Open(file_name, 48000, "wb"); |
381 } | 381 } |
382 | 382 |
383 } // namespace webrtc | 383 } // namespace webrtc |
OLD | NEW |