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

Unified Diff: webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc

Issue 2381833003: Change TWCC send interval to reduce overhead on low BW situations. (Closed)
Patch Set: fix unit-test build Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
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..90230064848fd9ebb5532325a1bf182798549251 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,17 @@
* 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/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 +34,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 +47,13 @@ class RemoteEstimatorProxyTest : public ::testing::Test {
}
void Process() {
- clock_.AdvanceTimeMilliseconds(
- RemoteEstimatorProxy::kDefaultProcessIntervalMs);
+ clock_.AdvanceTimeMilliseconds(50);
stefan-webrtc 2016/10/26 14:45:16 Why did you change this?
michaelt 2016/10/27 15:15:45 Because there is no default process interval. The
proxy_.Process();
}
SimulatedClock clock_;
testing::StrictMock<MockPacketRouter> router_;
+ testing::StrictMock<test::MockBitrateController> bitrate_controller_;
RemoteEstimatorProxy proxy_;
const size_t kDefaultPacketSize = 100;
@@ -350,4 +356,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

Powered by Google App Engine
This is Rietveld 408576698