| Index: webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc
|
| diff --git a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc
|
| index 9821568260c0cf82e0df7c97821409f162271246..6f15ec93c6a51fec98ba4dc0ac27fdb3c6936485 100644
|
| --- a/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc
|
| +++ b/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc
|
| @@ -8,12 +8,18 @@
|
| * be found in the AUTHORS file in the root of the source tree.
|
| */
|
|
|
| +#include <memory>
|
| +#include <utility>
|
| +
|
| +#include "webrtc/test/gmock.h"
|
| +#include "webrtc/test/gtest.h"
|
| +
|
| +#include "webrtc/base/test/mock_ratetracker.h"
|
| +#include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller.h"
|
| #include "webrtc/modules/pacing/packet_router.h"
|
| #include "webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h"
|
| #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
|
| #include "webrtc/system_wrappers/include/clock.h"
|
| -#include "webrtc/test/gmock.h"
|
| -#include "webrtc/test/gtest.h"
|
|
|
| using ::testing::_;
|
| using ::testing::InSequence;
|
| @@ -29,7 +35,8 @@ class MockPacketRouter : public PacketRouter {
|
|
|
| class RemoteEstimatorProxyTest : public ::testing::Test {
|
| public:
|
| - RemoteEstimatorProxyTest() : clock_(0), proxy_(&clock_, &router_) {}
|
| + RemoteEstimatorProxyTest()
|
| + : clock_(0), proxy_(&clock_, &router_, &bitrate_controller_) {}
|
|
|
| protected:
|
| void IncomingPacket(uint16_t seq, int64_t time_ms) {
|
| @@ -41,13 +48,13 @@ class RemoteEstimatorProxyTest : public ::testing::Test {
|
| }
|
|
|
| void Process() {
|
| - clock_.AdvanceTimeMilliseconds(
|
| - RemoteEstimatorProxy::kDefaultProcessIntervalMs);
|
| + clock_.AdvanceTimeMilliseconds(50);
|
| proxy_.Process();
|
| }
|
|
|
| SimulatedClock clock_;
|
| testing::StrictMock<MockPacketRouter> router_;
|
| + testing::StrictMock<test::MockBitrateController> bitrate_controller_;
|
| RemoteEstimatorProxy proxy_;
|
|
|
| const size_t kDefaultPacketSize = 100;
|
| @@ -350,4 +357,46 @@ TEST_F(RemoteEstimatorProxyTest, RemovesTimestampsOutOfScope) {
|
| Process();
|
| }
|
|
|
| +TEST_F(RemoteEstimatorProxyTest, TimeUntilNextProcessIsZeroBeforeFirstProcess) {
|
| + EXPECT_EQ(0, proxy_.TimeUntilNextProcess());
|
| +}
|
| +
|
| +TEST_F(RemoteEstimatorProxyTest, TimeUntilNextProcessIsMinIntervalOn300kbps) {
|
| + EXPECT_CALL(bitrate_controller_, AvailableBandwidth(testing::NotNull()))
|
| + .Times(1)
|
| + .WillOnce(Invoke([](uint32_t* bitrate) {
|
| + *bitrate = 300000;
|
| + return false;
|
| + }));
|
| +
|
| + Process();
|
| + EXPECT_EQ(RemoteEstimatorProxy::kMinSendIntervalMs,
|
| + proxy_.TimeUntilNextProcess());
|
| +}
|
| +
|
| +TEST_F(RemoteEstimatorProxyTest, TimeUntilNextProcessIsMaxIntervalOn20kbps) {
|
| + EXPECT_CALL(bitrate_controller_, AvailableBandwidth(testing::NotNull()))
|
| + .Times(1)
|
| + .WillOnce(Invoke([](uint32_t* bitrate) {
|
| + *bitrate = 20000;
|
| + return false;
|
| + }));
|
| +
|
| + Process();
|
| + EXPECT_EQ(RemoteEstimatorProxy::kMaxSendIntervalMs,
|
| + proxy_.TimeUntilNextProcess());
|
| +}
|
| +
|
| +TEST_F(RemoteEstimatorProxyTest, TwccReportsUse5PercentOfAvailableBandwidth) {
|
| + EXPECT_CALL(bitrate_controller_, AvailableBandwidth(testing::NotNull()))
|
| + .Times(1)
|
| + .WillOnce(Invoke([](uint32_t* bitrate) {
|
| + *bitrate = 80000;
|
| + return false;
|
| + }));
|
| + Process();
|
| + // 80kbps * 0.05 = TwccReportSize(52B * 8b/B) * 1000ms / SendInterval(104ms)
|
| + EXPECT_EQ(104, proxy_.TimeUntilNextProcess());
|
| +}
|
| +
|
| } // namespace webrtc
|
|
|