OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 UseNoMocks(); | 1264 UseNoMocks(); |
1265 CreateInstance(); | 1265 CreateInstance(); |
1266 ASSERT_TRUE(tick_timer_); | 1266 ASSERT_TRUE(tick_timer_); |
1267 EXPECT_EQ(0u, tick_timer_->ticks()); | 1267 EXPECT_EQ(0u, tick_timer_->ticks()); |
1268 AudioFrame output; | 1268 AudioFrame output; |
1269 bool muted; | 1269 bool muted; |
1270 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output, &muted)); | 1270 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output, &muted)); |
1271 EXPECT_EQ(1u, tick_timer_->ticks()); | 1271 EXPECT_EQ(1u, tick_timer_->ticks()); |
1272 } | 1272 } |
1273 | 1273 |
| 1274 TEST_F(NetEqImplTest, TargetDelayMs) { |
| 1275 UseNoMocks(); |
| 1276 use_mock_delay_manager_ = true; |
| 1277 CreateInstance(); |
| 1278 // Let the dummy target delay be 17 packets. |
| 1279 constexpr int kTargetLevelPacketsQ8 = 17 << 8; |
| 1280 EXPECT_CALL(*mock_delay_manager_, TargetLevel()) |
| 1281 .WillOnce(Return(kTargetLevelPacketsQ8)); |
| 1282 // Default packet size before any packet has been decoded is 30 ms, so we are |
| 1283 // expecting 17 * 30 = 510 ms target delay. |
| 1284 EXPECT_EQ(17 * 30, neteq_->TargetDelayMs()); |
| 1285 } |
| 1286 |
1274 class Decoder120ms : public AudioDecoder { | 1287 class Decoder120ms : public AudioDecoder { |
1275 public: | 1288 public: |
1276 Decoder120ms(int sample_rate_hz, SpeechType speech_type) | 1289 Decoder120ms(int sample_rate_hz, SpeechType speech_type) |
1277 : sample_rate_hz_(sample_rate_hz), | 1290 : sample_rate_hz_(sample_rate_hz), |
1278 next_value_(1), | 1291 next_value_(1), |
1279 speech_type_(speech_type) {} | 1292 speech_type_(speech_type) {} |
1280 | 1293 |
1281 int DecodeInternal(const uint8_t* encoded, | 1294 int DecodeInternal(const uint8_t* encoded, |
1282 size_t encoded_len, | 1295 size_t encoded_len, |
1283 int sample_rate_hz, | 1296 int sample_rate_hz, |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1489 EXPECT_CALL(*mock_delay_manager_, BufferLimits(_, _)) | 1502 EXPECT_CALL(*mock_delay_manager_, BufferLimits(_, _)) |
1490 .Times(1) | 1503 .Times(1) |
1491 .WillOnce(DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2))); | 1504 .WillOnce(DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2))); |
1492 | 1505 |
1493 bool muted; | 1506 bool muted; |
1494 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output_, &muted)); | 1507 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output_, &muted)); |
1495 EXPECT_EQ(kAccelerate, neteq_->last_operation_for_test()); | 1508 EXPECT_EQ(kAccelerate, neteq_->last_operation_for_test()); |
1496 } | 1509 } |
1497 | 1510 |
1498 }// namespace webrtc | 1511 }// namespace webrtc |
OLD | NEW |