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

Side by Side Diff: webrtc/video/video_send_stream_tests.cc

Issue 2125523004: Fix bug where a connection switch causes BWE to be set to zero. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comments addressed. Created 4 years, 5 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
« no previous file with comments | « webrtc/call/call.cc ('k') | no next file » | 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 #include <algorithm> // max 10 #include <algorithm> // max
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 1114
1115 std::unique_ptr<RtpRtcp> rtp_rtcp_; 1115 std::unique_ptr<RtpRtcp> rtp_rtcp_;
1116 std::unique_ptr<internal::TransportAdapter> feedback_transport_; 1116 std::unique_ptr<internal::TransportAdapter> feedback_transport_;
1117 VideoSendStream* stream_; 1117 VideoSendStream* stream_;
1118 bool bitrate_capped_; 1118 bool bitrate_capped_;
1119 } test; 1119 } test;
1120 1120
1121 RunBaseTest(&test); 1121 RunBaseTest(&test);
1122 } 1122 }
1123 1123
1124 TEST_F(VideoSendStreamTest, ChangingNetworkRoute) {
1125 class ChangingNetworkRouteTest : public test::EndToEndTest {
1126 public:
1127 const int kStartBitrateBps = 300000;
1128 const int kNewMaxBitrateBps = 1234567;
1129
1130 ChangingNetworkRouteTest()
1131 : EndToEndTest(test::CallTest::kDefaultTimeoutMs),
1132 call_(nullptr) {}
1133
1134 void OnCallsCreated(Call* sender_call, Call* receiver_call) override {
1135 call_ = sender_call;
1136 }
1137
1138 Action OnSendRtp(const uint8_t* packet, size_t length) override {
1139 if (call_->GetStats().send_bandwidth_bps > kStartBitrateBps) {
1140 observation_complete_.Set();
1141 }
1142
1143 return SEND_PACKET;
1144 }
1145
1146 void PerformTest() override {
1147 rtc::NetworkRoute new_route(true, 10, 20, -1);
1148 call_->OnNetworkRouteChanged("transport", new_route);
1149 Call::Config::BitrateConfig bitrate_config;
1150 bitrate_config.start_bitrate_bps = kStartBitrateBps;
1151 call_->SetBitrateConfig(bitrate_config);
1152 EXPECT_TRUE(Wait())
1153 << "Timed out while waiting for start bitrate to be exceeded.";
1154
1155 bitrate_config.start_bitrate_bps = -1;
1156 bitrate_config.max_bitrate_bps = kNewMaxBitrateBps;
1157 call_->SetBitrateConfig(bitrate_config);
1158 // TODO(holmer): We should set the last sent packet id here and verify
1159 // that we correctly ignore any packet loss reported prior to that id.
1160 ++new_route.local_network_id;
1161 call_->OnNetworkRouteChanged("transport", new_route);
1162 EXPECT_EQ(kStartBitrateBps, call_->GetStats().send_bandwidth_bps);
1163 }
1164
1165 private:
1166 Call* call_;
1167 } test;
1168
1169 RunBaseTest(&test);
1170 }
1171
1124 class MaxPaddingSetTest : public test::SendTest { 1172 class MaxPaddingSetTest : public test::SendTest {
1125 public: 1173 public:
1126 static const uint32_t kMinTransmitBitrateBps = 400000; 1174 static const uint32_t kMinTransmitBitrateBps = 400000;
1127 static const uint32_t kActualEncodeBitrateBps = 40000; 1175 static const uint32_t kActualEncodeBitrateBps = 40000;
1128 static const uint32_t kMinPacketsToSend = 50; 1176 static const uint32_t kMinPacketsToSend = 50;
1129 1177
1130 explicit MaxPaddingSetTest(bool test_switch_content_type) 1178 explicit MaxPaddingSetTest(bool test_switch_content_type)
1131 : SendTest(test::CallTest::kDefaultTimeoutMs), 1179 : SendTest(test::CallTest::kDefaultTimeoutMs),
1132 call_(nullptr), 1180 call_(nullptr),
1133 send_stream_(nullptr), 1181 send_stream_(nullptr),
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
2467 observation_complete_.Set(); 2515 observation_complete_.Set();
2468 } 2516 }
2469 } 2517 }
2470 } test; 2518 } test;
2471 2519
2472 RunBaseTest(&test); 2520 RunBaseTest(&test);
2473 } 2521 }
2474 #endif // !defined(RTC_DISABLE_VP9) 2522 #endif // !defined(RTC_DISABLE_VP9)
2475 2523
2476 } // namespace webrtc 2524 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call/call.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698