| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 void OpusFecTest::SetUp() { | 70 void OpusFecTest::SetUp() { |
| 71 channels_ = get<0>(GetParam()); | 71 channels_ = get<0>(GetParam()); |
| 72 bit_rate_ = get<1>(GetParam()); | 72 bit_rate_ = get<1>(GetParam()); |
| 73 printf("Coding %" PRIuS " channel signal at %d bps.\n", channels_, bit_rate_); | 73 printf("Coding %" PRIuS " channel signal at %d bps.\n", channels_, bit_rate_); |
| 74 | 74 |
| 75 in_filename_ = test::ResourcePath(get<2>(GetParam()), get<3>(GetParam())); | 75 in_filename_ = test::ResourcePath(get<2>(GetParam()), get<3>(GetParam())); |
| 76 | 76 |
| 77 FILE* fp = fopen(in_filename_.c_str(), "rb"); | 77 FILE* fp = fopen(in_filename_.c_str(), "rb"); |
| 78 ASSERT_FALSE(fp == NULL); | 78 ASSERT_FALSE(fp == nullptr); |
| 79 | 79 |
| 80 // Obtain file size. | 80 // Obtain file size. |
| 81 fseek(fp, 0, SEEK_END); | 81 fseek(fp, 0, SEEK_END); |
| 82 loop_length_samples_ = ftell(fp) / sizeof(int16_t); | 82 loop_length_samples_ = ftell(fp) / sizeof(int16_t); |
| 83 rewind(fp); | 83 rewind(fp); |
| 84 | 84 |
| 85 // Allocate memory to contain the whole file. | 85 // Allocate memory to contain the whole file. |
| 86 in_data_.reset(new int16_t[loop_length_samples_ + | 86 in_data_.reset(new int16_t[loop_length_samples_ + |
| 87 block_length_sample_ * channels_]); | 87 block_length_sample_ * channels_]); |
| 88 | 88 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 122 } |
| 123 | 123 |
| 124 OpusFecTest::OpusFecTest() | 124 OpusFecTest::OpusFecTest() |
| 125 : block_duration_ms_(kOpusBlockDurationMs), | 125 : block_duration_ms_(kOpusBlockDurationMs), |
| 126 sampling_khz_(kOpusSamplingKhz), | 126 sampling_khz_(kOpusSamplingKhz), |
| 127 block_length_sample_( | 127 block_length_sample_( |
| 128 static_cast<size_t>(block_duration_ms_ * sampling_khz_)), | 128 static_cast<size_t>(block_duration_ms_ * sampling_khz_)), |
| 129 data_pointer_(0), | 129 data_pointer_(0), |
| 130 max_bytes_(0), | 130 max_bytes_(0), |
| 131 encoded_bytes_(0), | 131 encoded_bytes_(0), |
| 132 opus_encoder_(NULL), | 132 opus_encoder_(nullptr), |
| 133 opus_decoder_(NULL) { | 133 opus_decoder_(nullptr) {} |
| 134 } | |
| 135 | 134 |
| 136 void OpusFecTest::EncodeABlock() { | 135 void OpusFecTest::EncodeABlock() { |
| 137 int value = WebRtcOpus_Encode(opus_encoder_, | 136 int value = WebRtcOpus_Encode(opus_encoder_, |
| 138 &in_data_[data_pointer_], | 137 &in_data_[data_pointer_], |
| 139 block_length_sample_, | 138 block_length_sample_, |
| 140 max_bytes_, &bit_stream_[0]); | 139 max_bytes_, &bit_stream_[0]); |
| 141 EXPECT_GT(value, 0); | 140 EXPECT_GT(value, 0); |
| 142 | 141 |
| 143 encoded_bytes_ = static_cast<size_t>(value); | 142 encoded_bytes_ = static_cast<size_t>(value); |
| 144 } | 143 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 ::std::tr1::make_tuple(1, 32000, string("audio_coding/testfile32kHz"), | 232 ::std::tr1::make_tuple(1, 32000, string("audio_coding/testfile32kHz"), |
| 234 string("pcm")), | 233 string("pcm")), |
| 235 ::std::tr1::make_tuple(2, 64000, string("audio_coding/teststereo32kHz"), | 234 ::std::tr1::make_tuple(2, 64000, string("audio_coding/teststereo32kHz"), |
| 236 string("pcm"))}; | 235 string("pcm"))}; |
| 237 | 236 |
| 238 // 64 kbps, stereo | 237 // 64 kbps, stereo |
| 239 INSTANTIATE_TEST_CASE_P(AllTest, OpusFecTest, | 238 INSTANTIATE_TEST_CASE_P(AllTest, OpusFecTest, |
| 240 ::testing::ValuesIn(param_set)); | 239 ::testing::ValuesIn(param_set)); |
| 241 | 240 |
| 242 } // namespace webrtc | 241 } // namespace webrtc |
| OLD | NEW |