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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 sampling_khz_(kOpusSamplingKhz), | 124 sampling_khz_(kOpusSamplingKhz), |
125 block_length_sample_(block_duration_ms_ * sampling_khz_), | 125 block_length_sample_(block_duration_ms_ * sampling_khz_), |
126 data_pointer_(0), | 126 data_pointer_(0), |
127 max_bytes_(0), | 127 max_bytes_(0), |
128 encoded_bytes_(0), | 128 encoded_bytes_(0), |
129 opus_encoder_(NULL), | 129 opus_encoder_(NULL), |
130 opus_decoder_(NULL) { | 130 opus_decoder_(NULL) { |
131 } | 131 } |
132 | 132 |
133 void OpusFecTest::EncodeABlock() { | 133 void OpusFecTest::EncodeABlock() { |
134 int value = WebRtcOpus_Encode(opus_encoder_, | 134 int16_t value = WebRtcOpus_Encode(opus_encoder_, |
135 &in_data_[data_pointer_], | 135 &in_data_[data_pointer_], |
136 block_length_sample_, | 136 block_length_sample_, |
137 max_bytes_, &bit_stream_[0]); | 137 max_bytes_, &bit_stream_[0]); |
138 EXPECT_GT(value, 0); | 138 EXPECT_GT(value, 0); |
139 | 139 |
140 encoded_bytes_ = value; | 140 encoded_bytes_ = value; |
141 } | 141 } |
142 | 142 |
143 void OpusFecTest::DecodeABlock(bool lost_previous, bool lost_current) { | 143 void OpusFecTest::DecodeABlock(bool lost_previous, bool lost_current) { |
144 int16_t audio_type; | 144 int16_t audio_type; |
145 int value_1 = 0, value_2 = 0; | 145 int16_t value_1 = 0, value_2 = 0; |
146 | 146 |
147 if (lost_previous) { | 147 if (lost_previous) { |
148 // Decode previous frame. | 148 // Decode previous frame. |
149 if (!lost_current && | 149 if (!lost_current && |
150 WebRtcOpus_PacketHasFec(&bit_stream_[0], encoded_bytes_) == 1) { | 150 WebRtcOpus_PacketHasFec(&bit_stream_[0], encoded_bytes_) == 1) { |
151 value_1 = WebRtcOpus_DecodeFec(opus_decoder_, &bit_stream_[0], | 151 value_1 = WebRtcOpus_DecodeFec(opus_decoder_, &bit_stream_[0], |
152 encoded_bytes_, &out_data_[0], | 152 encoded_bytes_, &out_data_[0], |
153 &audio_type); | 153 &audio_type); |
154 } else { | 154 } else { |
155 value_1 = WebRtcOpus_DecodePlc(opus_decoder_, &out_data_[0], 1); | 155 value_1 = WebRtcOpus_DecodePlc(opus_decoder_, &out_data_[0], 1); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 ::std::tr1::make_tuple(1, 32000, string("audio_coding/testfile32kHz"), | 230 ::std::tr1::make_tuple(1, 32000, string("audio_coding/testfile32kHz"), |
231 string("pcm")), | 231 string("pcm")), |
232 ::std::tr1::make_tuple(2, 64000, string("audio_coding/teststereo32kHz"), | 232 ::std::tr1::make_tuple(2, 64000, string("audio_coding/teststereo32kHz"), |
233 string("pcm"))}; | 233 string("pcm"))}; |
234 | 234 |
235 // 64 kbps, stereo | 235 // 64 kbps, stereo |
236 INSTANTIATE_TEST_CASE_P(AllTest, OpusFecTest, | 236 INSTANTIATE_TEST_CASE_P(AllTest, OpusFecTest, |
237 ::testing::ValuesIn(param_set)); | 237 ::testing::ValuesIn(param_set)); |
238 | 238 |
239 } // namespace webrtc | 239 } // namespace webrtc |
OLD | NEW |