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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 ASSERT_EQ(fread(&in_data_[0], sizeof(int16_t), loop_length_samples_, fp), | 58 ASSERT_EQ(fread(&in_data_[0], sizeof(int16_t), loop_length_samples_, fp), |
59 loop_length_samples_); | 59 loop_length_samples_); |
60 fclose(fp); | 60 fclose(fp); |
61 | 61 |
62 // Add an extra block length of samples to the end of the array, starting | 62 // Add an extra block length of samples to the end of the array, starting |
63 // over again from the beginning of the array. This is done to simplify | 63 // over again from the beginning of the array. This is done to simplify |
64 // the reading process when reading over the end of the loop. | 64 // the reading process when reading over the end of the loop. |
65 memcpy(&in_data_[loop_length_samples_], &in_data_[0], | 65 memcpy(&in_data_[loop_length_samples_], &in_data_[0], |
66 input_length_sample_ * channels_ * sizeof(int16_t)); | 66 input_length_sample_ * channels_ * sizeof(int16_t)); |
67 | 67 |
68 max_bytes_ = input_length_sample_ * channels_ * sizeof(int16_t); | 68 max_bytes_ = |
| 69 static_cast<size_t>(input_length_sample_ * channels_ * sizeof(int16_t)); |
69 out_data_.reset(new int16_t[output_length_sample_ * channels_]); | 70 out_data_.reset(new int16_t[output_length_sample_ * channels_]); |
70 bit_stream_.reset(new uint8_t[max_bytes_]); | 71 bit_stream_.reset(new uint8_t[max_bytes_]); |
71 | 72 |
72 if (save_out_data_) { | 73 if (save_out_data_) { |
73 std::string out_filename = | 74 std::string out_filename = |
74 ::testing::UnitTest::GetInstance()->current_test_info()->name(); | 75 ::testing::UnitTest::GetInstance()->current_test_info()->name(); |
75 | 76 |
76 // Erase '/' | 77 // Erase '/' |
77 size_t found; | 78 size_t found; |
78 while ((found = out_filename.find('/')) != std::string::npos) | 79 while ((found = out_filename.find('/')) != std::string::npos) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 loop_length_samples_; | 116 loop_length_samples_; |
116 time_now_ms += block_duration_ms_; | 117 time_now_ms += block_duration_ms_; |
117 } | 118 } |
118 | 119 |
119 printf("Encoding: %.2f%% real time,\nDecoding: %.2f%% real time.\n", | 120 printf("Encoding: %.2f%% real time,\nDecoding: %.2f%% real time.\n", |
120 (encoding_time_ms_ / audio_duration_sec) / 10.0, | 121 (encoding_time_ms_ / audio_duration_sec) / 10.0, |
121 (decoding_time_ms_ / audio_duration_sec) / 10.0); | 122 (decoding_time_ms_ / audio_duration_sec) / 10.0); |
122 } | 123 } |
123 | 124 |
124 } // namespace webrtc | 125 } // namespace webrtc |
OLD | NEW |