Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: webrtc/modules/audio_coding/neteq/delay_manager_unittest.cc

Issue 1929863002: NetEq: Use TickTimer in DelayManager (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@delay-pdt-tick-timer
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 uint16_t seq_no_; 44 uint16_t seq_no_;
45 uint32_t ts_; 45 uint32_t ts_;
46 }; 46 };
47 47
48 DelayManagerTest::DelayManagerTest() 48 DelayManagerTest::DelayManagerTest()
49 : dm_(NULL), detector_(&tick_timer_), seq_no_(0x1234), ts_(0x12345678) {} 49 : dm_(NULL), detector_(&tick_timer_), seq_no_(0x1234), ts_(0x12345678) {}
50 50
51 void DelayManagerTest::SetUp() { 51 void DelayManagerTest::SetUp() {
52 EXPECT_CALL(detector_, Reset()) 52 EXPECT_CALL(detector_, Reset())
53 .Times(1); 53 .Times(1);
54 dm_ = new DelayManager(kMaxNumberOfPackets, &detector_); 54 dm_ = new DelayManager(kMaxNumberOfPackets, &detector_, &tick_timer_);
55 } 55 }
56 56
57 void DelayManagerTest::SetPacketAudioLength(int lengt_ms) { 57 void DelayManagerTest::SetPacketAudioLength(int lengt_ms) {
58 EXPECT_CALL(detector_, SetPacketAudioLength(lengt_ms)); 58 EXPECT_CALL(detector_, SetPacketAudioLength(lengt_ms));
59 dm_->SetPacketAudioLength(lengt_ms); 59 dm_->SetPacketAudioLength(lengt_ms);
60 } 60 }
61 61
62 void DelayManagerTest::InsertNextPacket() { 62 void DelayManagerTest::InsertNextPacket() {
63 EXPECT_EQ(0, dm_->Update(seq_no_, ts_, kFs)); 63 EXPECT_EQ(0, dm_->Update(seq_no_, ts_, kFs));
64 seq_no_ += 1; 64 seq_no_ += 1;
65 ts_ += kTsIncrement; 65 ts_ += kTsIncrement;
66 } 66 }
67 67
68 void DelayManagerTest::IncreaseTime(int inc_ms) { 68 void DelayManagerTest::IncreaseTime(int inc_ms) {
69 for (int t = 0; t < inc_ms; t += kTimeStepMs) { 69 for (int t = 0; t < inc_ms; t += kTimeStepMs) {
70 dm_->UpdateCounters(kTimeStepMs);
71 tick_timer_.Increment(); 70 tick_timer_.Increment();
72 } 71 }
73 } 72 }
74 void DelayManagerTest::TearDown() { 73 void DelayManagerTest::TearDown() {
75 EXPECT_CALL(detector_, Die()); 74 EXPECT_CALL(detector_, Die());
76 delete dm_; 75 delete dm_;
77 } 76 }
78 77
79 TEST_F(DelayManagerTest, CreateAndDestroy) { 78 TEST_F(DelayManagerTest, CreateAndDestroy) {
80 // Nothing to do here. The test fixture creates and destroys the DelayManager 79 // Nothing to do here. The test fixture creates and destroys the DelayManager
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 EXPECT_TRUE(dm_->SetMaximumDelay(10)); 277 EXPECT_TRUE(dm_->SetMaximumDelay(10));
279 EXPECT_FALSE(dm_->SetMinimumDelay(20)); 278 EXPECT_FALSE(dm_->SetMinimumDelay(20));
280 279
281 // Maximum delay less than minimum delay is not accepted. 280 // Maximum delay less than minimum delay is not accepted.
282 EXPECT_TRUE(dm_->SetMaximumDelay(100)); 281 EXPECT_TRUE(dm_->SetMaximumDelay(100));
283 EXPECT_TRUE(dm_->SetMinimumDelay(80)); 282 EXPECT_TRUE(dm_->SetMinimumDelay(80));
284 EXPECT_FALSE(dm_->SetMaximumDelay(60)); 283 EXPECT_FALSE(dm_->SetMaximumDelay(60));
285 } 284 }
286 285
287 } // namespace webrtc 286 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/delay_manager.cc ('k') | webrtc/modules/audio_coding/neteq/mock/mock_delay_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698