OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 15 matching lines...) Expand all Loading... |
26 public: | 26 public: |
27 static const int kPacketDuration = 960; // 48 kHz * 20 ms | 27 static const int kPacketDuration = 960; // 48 kHz * 20 ms |
28 | 28 |
29 explicit MockAudioDecoderOpus(int num_channels) | 29 explicit MockAudioDecoderOpus(int num_channels) |
30 : AudioDecoderOpus(num_channels), | 30 : AudioDecoderOpus(num_channels), |
31 fec_enabled_(false) { | 31 fec_enabled_(false) { |
32 } | 32 } |
33 virtual ~MockAudioDecoderOpus() { Die(); } | 33 virtual ~MockAudioDecoderOpus() { Die(); } |
34 MOCK_METHOD0(Die, void()); | 34 MOCK_METHOD0(Die, void()); |
35 | 35 |
36 MOCK_METHOD0(Init, int()); | 36 MOCK_METHOD0(Reset, void()); |
37 | 37 |
38 int PacketDuration(const uint8_t* encoded, | 38 int PacketDuration(const uint8_t* encoded, |
39 size_t encoded_len) const override { | 39 size_t encoded_len) const override { |
40 return kPacketDuration; | 40 return kPacketDuration; |
41 } | 41 } |
42 | 42 |
43 int PacketDurationRedundant(const uint8_t* encoded, | 43 int PacketDurationRedundant(const uint8_t* encoded, |
44 size_t encoded_len) const override { | 44 size_t encoded_len) const override { |
45 return kPacketDuration; | 45 return kPacketDuration; |
46 } | 46 } |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 rtc::scoped_ptr<test::RtpGenerator> rtp_generator_; | 264 rtc::scoped_ptr<test::RtpGenerator> rtp_generator_; |
265 WebRtcRTPHeader rtp_header_; | 265 WebRtcRTPHeader rtp_header_; |
266 uint32_t last_lost_time_; | 266 uint32_t last_lost_time_; |
267 uint32_t packet_loss_interval_; | 267 uint32_t packet_loss_interval_; |
268 uint8_t payload_[kPayloadSizeByte]; | 268 uint8_t payload_[kPayloadSizeByte]; |
269 int16_t output_[kMaxOutputSize]; | 269 int16_t output_[kMaxOutputSize]; |
270 }; | 270 }; |
271 | 271 |
272 TEST(NetEqNetworkStatsTest, OpusDecodeFec) { | 272 TEST(NetEqNetworkStatsTest, OpusDecodeFec) { |
273 MockAudioDecoderOpus decoder(1); | 273 MockAudioDecoderOpus decoder(1); |
274 EXPECT_CALL(decoder, Init()); | |
275 NetEqNetworkStatsTest test(kDecoderOpus, &decoder); | 274 NetEqNetworkStatsTest test(kDecoderOpus, &decoder); |
276 test.DecodeFecTest(); | 275 test.DecodeFecTest(); |
277 EXPECT_CALL(decoder, Die()).Times(1); | 276 EXPECT_CALL(decoder, Die()).Times(1); |
278 } | 277 } |
279 | 278 |
280 TEST(NetEqNetworkStatsTest, StereoOpusDecodeFec) { | 279 TEST(NetEqNetworkStatsTest, StereoOpusDecodeFec) { |
281 MockAudioDecoderOpus decoder(2); | 280 MockAudioDecoderOpus decoder(2); |
282 EXPECT_CALL(decoder, Init()); | |
283 NetEqNetworkStatsTest test(kDecoderOpus, &decoder); | 281 NetEqNetworkStatsTest test(kDecoderOpus, &decoder); |
284 test.DecodeFecTest(); | 282 test.DecodeFecTest(); |
285 EXPECT_CALL(decoder, Die()).Times(1); | 283 EXPECT_CALL(decoder, Die()).Times(1); |
286 } | 284 } |
287 | 285 |
288 TEST(NetEqNetworkStatsTest, NoiseExpansionTest) { | 286 TEST(NetEqNetworkStatsTest, NoiseExpansionTest) { |
289 MockAudioDecoderOpus decoder(1); | 287 MockAudioDecoderOpus decoder(1); |
290 EXPECT_CALL(decoder, Init()); | |
291 NetEqNetworkStatsTest test(kDecoderOpus, &decoder); | 288 NetEqNetworkStatsTest test(kDecoderOpus, &decoder); |
292 test.NoiseExpansionTest(); | 289 test.NoiseExpansionTest(); |
293 EXPECT_CALL(decoder, Die()).Times(1); | 290 EXPECT_CALL(decoder, Die()).Times(1); |
294 } | 291 } |
295 | 292 |
296 } // namespace test | 293 } // namespace test |
297 } // namespace webrtc | 294 } // namespace webrtc |
298 | 295 |
299 | 296 |
300 | 297 |
301 | 298 |
OLD | NEW |