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 |
| 11 #include <memory> |
| 12 |
11 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "webrtc/base/format_macros.h" | 14 #include "webrtc/base/format_macros.h" |
13 #include "webrtc/base/scoped_ptr.h" | |
14 #include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h" | 15 #include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h" |
15 #include "webrtc/test/testsupport/fileutils.h" | 16 #include "webrtc/test/testsupport/fileutils.h" |
16 | 17 |
17 using ::std::string; | 18 using ::std::string; |
18 using ::std::tr1::tuple; | 19 using ::std::tr1::tuple; |
19 using ::std::tr1::get; | 20 using ::std::tr1::get; |
20 using ::testing::TestWithParam; | 21 using ::testing::TestWithParam; |
21 | 22 |
22 namespace webrtc { | 23 namespace webrtc { |
23 | 24 |
(...skipping 30 matching lines...) Expand all Loading... |
54 size_t data_pointer_; | 55 size_t data_pointer_; |
55 size_t loop_length_samples_; | 56 size_t loop_length_samples_; |
56 size_t max_bytes_; | 57 size_t max_bytes_; |
57 size_t encoded_bytes_; | 58 size_t encoded_bytes_; |
58 | 59 |
59 WebRtcOpusEncInst* opus_encoder_; | 60 WebRtcOpusEncInst* opus_encoder_; |
60 WebRtcOpusDecInst* opus_decoder_; | 61 WebRtcOpusDecInst* opus_decoder_; |
61 | 62 |
62 string in_filename_; | 63 string in_filename_; |
63 | 64 |
64 rtc::scoped_ptr<int16_t[]> in_data_; | 65 std::unique_ptr<int16_t[]> in_data_; |
65 rtc::scoped_ptr<int16_t[]> out_data_; | 66 std::unique_ptr<int16_t[]> out_data_; |
66 rtc::scoped_ptr<uint8_t[]> bit_stream_; | 67 std::unique_ptr<uint8_t[]> bit_stream_; |
67 }; | 68 }; |
68 | 69 |
69 void OpusFecTest::SetUp() { | 70 void OpusFecTest::SetUp() { |
70 channels_ = get<0>(GetParam()); | 71 channels_ = get<0>(GetParam()); |
71 bit_rate_ = get<1>(GetParam()); | 72 bit_rate_ = get<1>(GetParam()); |
72 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_); |
73 | 74 |
74 in_filename_ = test::ResourcePath(get<2>(GetParam()), get<3>(GetParam())); | 75 in_filename_ = test::ResourcePath(get<2>(GetParam()), get<3>(GetParam())); |
75 | 76 |
76 FILE* fp = fopen(in_filename_.c_str(), "rb"); | 77 FILE* fp = fopen(in_filename_.c_str(), "rb"); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 ::std::tr1::make_tuple(1, 32000, string("audio_coding/testfile32kHz"), | 233 ::std::tr1::make_tuple(1, 32000, string("audio_coding/testfile32kHz"), |
233 string("pcm")), | 234 string("pcm")), |
234 ::std::tr1::make_tuple(2, 64000, string("audio_coding/teststereo32kHz"), | 235 ::std::tr1::make_tuple(2, 64000, string("audio_coding/teststereo32kHz"), |
235 string("pcm"))}; | 236 string("pcm"))}; |
236 | 237 |
237 // 64 kbps, stereo | 238 // 64 kbps, stereo |
238 INSTANTIATE_TEST_CASE_P(AllTest, OpusFecTest, | 239 INSTANTIATE_TEST_CASE_P(AllTest, OpusFecTest, |
239 ::testing::ValuesIn(param_set)); | 240 ::testing::ValuesIn(param_set)); |
240 | 241 |
241 } // namespace webrtc | 242 } // namespace webrtc |
OLD | NEW |