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

Side by Side Diff: webrtc/voice_engine/network_predictor_unittest.cc

Issue 1413333002: system_wrappers: rename interface -> include (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased again! Created 5 years, 1 month 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
« no previous file with comments | « webrtc/voice_engine/network_predictor.h ('k') | webrtc/voice_engine/output_mixer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <math.h> 11 #include <math.h>
12 12
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "webrtc/voice_engine/network_predictor.h" 14 #include "webrtc/voice_engine/network_predictor.h"
15 #include "webrtc/system_wrappers/interface/clock.h" 15 #include "webrtc/system_wrappers/include/clock.h"
16 16
17 namespace webrtc { 17 namespace webrtc {
18 namespace voe { 18 namespace voe {
19 19
20 class TestNetworkPredictor : public ::testing::Test { 20 class TestNetworkPredictor : public ::testing::Test {
21 protected: 21 protected:
22 TestNetworkPredictor() 22 TestNetworkPredictor()
23 : clock_(0), 23 : clock_(0),
24 network_predictor_(new NetworkPredictor(&clock_)) {} 24 network_predictor_(new NetworkPredictor(&clock_)) {}
25 SimulatedClock clock_; 25 SimulatedClock clock_;
26 rtc::scoped_ptr<NetworkPredictor> network_predictor_; 26 rtc::scoped_ptr<NetworkPredictor> network_predictor_;
27 }; 27 };
28 28
29 TEST_F(TestNetworkPredictor, TestPacketLossRateFilter) { 29 TEST_F(TestNetworkPredictor, TestPacketLossRateFilter) {
30 // Test initial packet loss rate estimate is 0. 30 // Test initial packet loss rate estimate is 0.
31 EXPECT_EQ(0, network_predictor_->GetLossRate()); 31 EXPECT_EQ(0, network_predictor_->GetLossRate());
32 network_predictor_->UpdatePacketLossRate(32); 32 network_predictor_->UpdatePacketLossRate(32);
33 // First time, no filtering. 33 // First time, no filtering.
34 EXPECT_EQ(32, network_predictor_->GetLossRate()); 34 EXPECT_EQ(32, network_predictor_->GetLossRate());
35 clock_.AdvanceTimeMilliseconds(1000); 35 clock_.AdvanceTimeMilliseconds(1000);
36 network_predictor_->UpdatePacketLossRate(40); 36 network_predictor_->UpdatePacketLossRate(40);
37 float exp = pow(0.9999f, 1000); 37 float exp = pow(0.9999f, 1000);
38 float value = 32.0f * exp + (1 - exp) * 40.0f; 38 float value = 32.0f * exp + (1 - exp) * 40.0f;
39 EXPECT_EQ(static_cast<uint8_t>(value + 0.5f), 39 EXPECT_EQ(static_cast<uint8_t>(value + 0.5f),
40 network_predictor_->GetLossRate()); 40 network_predictor_->GetLossRate());
41 } 41 }
42 } // namespace voe 42 } // namespace voe
43 } // namespace webrtc 43 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/voice_engine/network_predictor.h ('k') | webrtc/voice_engine/output_mixer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698