OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 if (output_file_) | 48 if (output_file_) |
49 fclose(output_file_); | 49 fclose(output_file_); |
50 } | 50 } |
51 | 51 |
52 ~FilePlayerTest() { FilePlayer::DestroyFilePlayer(player_); } | 52 ~FilePlayerTest() { FilePlayer::DestroyFilePlayer(player_); } |
53 | 53 |
54 void PlayFileAndCheck(const std::string& input_file, | 54 void PlayFileAndCheck(const std::string& input_file, |
55 const std::string& ref_checksum, | 55 const std::string& ref_checksum, |
56 int output_length_ms) { | 56 int output_length_ms) { |
57 const float kScaling = 1; | 57 const float kScaling = 1; |
58 ASSERT_EQ(0, | 58 ASSERT_EQ(0, player_->StartPlayingFile(input_file.c_str(), false, 0, |
59 player_->StartPlayingFile( | 59 kScaling, 0, 0, NULL)); |
60 input_file.c_str(), false, 0, kScaling, 0, 0, NULL)); | |
61 rtc::Md5Digest checksum; | 60 rtc::Md5Digest checksum; |
62 for (int i = 0; i < output_length_ms / 10; ++i) { | 61 for (int i = 0; i < output_length_ms / 10; ++i) { |
63 int16_t out[10 * kSampleRateHz / 1000] = {0}; | 62 int16_t out[10 * kSampleRateHz / 1000] = {0}; |
64 size_t num_samples; | 63 size_t num_samples; |
65 EXPECT_EQ(0, | 64 EXPECT_EQ(0, |
66 player_->Get10msAudioFromFile(out, num_samples, kSampleRateHz)); | 65 player_->Get10msAudioFromFile(out, num_samples, kSampleRateHz)); |
67 checksum.Update(out, num_samples * sizeof(out[0])); | 66 checksum.Update(out, num_samples * sizeof(out[0])); |
68 if (FLAGS_file_player_output) { | 67 if (FLAGS_file_player_output) { |
69 ASSERT_EQ(num_samples, | 68 ASSERT_EQ(num_samples, |
70 fwrite(out, sizeof(out[0]), num_samples, output_file_)); | 69 fwrite(out, sizeof(out[0]), num_samples, output_file_)); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 test::ResourcePath("utility/encapsulated_pcm16b_8khz", "wav"); | 106 test::ResourcePath("utility/encapsulated_pcm16b_8khz", "wav"); |
108 // The file is longer than this, but keeping the output shorter limits the | 107 // The file is longer than this, but keeping the output shorter limits the |
109 // runtime for the test. | 108 // runtime for the test. |
110 const int kOutputLengthMs = 10000; | 109 const int kOutputLengthMs = 10000; |
111 const std::string kRefChecksum = "e41d7e1dac8aeae9f21e8e03cd7ecd71"; | 110 const std::string kRefChecksum = "e41d7e1dac8aeae9f21e8e03cd7ecd71"; |
112 | 111 |
113 PlayFileAndCheck(kFileName, kRefChecksum, kOutputLengthMs); | 112 PlayFileAndCheck(kFileName, kRefChecksum, kOutputLengthMs); |
114 } | 113 } |
115 | 114 |
116 } // namespace webrtc | 115 } // namespace webrtc |
OLD | NEW |