OLD | NEW |
---|---|
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 Loading... | |
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 route_changed_(false) {} | |
1134 | |
1135 void OnCallsCreated(Call* sender_call, Call* receiver_call) override { | |
1136 call_ = sender_call; | |
1137 } | |
1138 | |
1139 Action OnSendRtp(const uint8_t* packet, size_t length) override { | |
1140 if (!route_changed_ && | |
1141 call_->GetStats().send_bandwidth_bps > kStartBitrateBps) { | |
1142 observation_complete_.Set(); | |
1143 } | |
1144 if (route_changed_ && | |
1145 call_->GetStats().send_bandwidth_bps > kStartBitrateBps) { | |
terelius
2016/07/07 15:48:38
I don't understand this. The code seems (almost) e
stefan-webrtc
2016/07/08 10:21:59
You are right. This is a complicated way of saying
| |
1146 observation_complete_.Set(); | |
1147 } | |
1148 | |
1149 return SEND_PACKET; | |
1150 } | |
1151 | |
1152 void PerformTest() override { | |
1153 rtc::NetworkRoute new_route(true, 10, 20, -1); | |
1154 call_->OnNetworkRouteChanged("transport", new_route); | |
1155 Call::Config::BitrateConfig bitrate_config; | |
1156 bitrate_config.start_bitrate_bps = kStartBitrateBps; | |
1157 call_->SetBitrateConfig(bitrate_config); | |
1158 EXPECT_TRUE(Wait()) | |
1159 << "Timed out while waiting for start bitrate to be exceeded."; | |
1160 | |
1161 bitrate_config.start_bitrate_bps = -1; | |
1162 bitrate_config.max_bitrate_bps = kNewMaxBitrateBps; | |
1163 call_->SetBitrateConfig(bitrate_config); | |
1164 // TODO(holmer): We should set the last sent packet id here and verify | |
1165 // that we correctly ignore any packet loss reported prior to that id. | |
1166 ++new_route.local_network_id; | |
1167 call_->OnNetworkRouteChanged("transport", new_route); | |
1168 route_changed_ = true; | |
1169 EXPECT_EQ(kStartBitrateBps, call_->GetStats().send_bandwidth_bps); | |
1170 | |
1171 ASSERT_TRUE(Wait()) << "Timed out waiting for start bitrate to be " | |
1172 "exceeded after connection switch."; | |
1173 } | |
1174 | |
1175 private: | |
1176 Call* call_; | |
1177 bool route_changed_; | |
1178 } test; | |
1179 | |
1180 RunBaseTest(&test); | |
1181 } | |
1182 | |
1124 class MaxPaddingSetTest : public test::SendTest { | 1183 class MaxPaddingSetTest : public test::SendTest { |
1125 public: | 1184 public: |
1126 static const uint32_t kMinTransmitBitrateBps = 400000; | 1185 static const uint32_t kMinTransmitBitrateBps = 400000; |
1127 static const uint32_t kActualEncodeBitrateBps = 40000; | 1186 static const uint32_t kActualEncodeBitrateBps = 40000; |
1128 static const uint32_t kMinPacketsToSend = 50; | 1187 static const uint32_t kMinPacketsToSend = 50; |
1129 | 1188 |
1130 explicit MaxPaddingSetTest(bool test_switch_content_type) | 1189 explicit MaxPaddingSetTest(bool test_switch_content_type) |
1131 : SendTest(test::CallTest::kDefaultTimeoutMs), | 1190 : SendTest(test::CallTest::kDefaultTimeoutMs), |
1132 call_(nullptr), | 1191 call_(nullptr), |
1133 send_stream_(nullptr), | 1192 send_stream_(nullptr), |
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2467 observation_complete_.Set(); | 2526 observation_complete_.Set(); |
2468 } | 2527 } |
2469 } | 2528 } |
2470 } test; | 2529 } test; |
2471 | 2530 |
2472 RunBaseTest(&test); | 2531 RunBaseTest(&test); |
2473 } | 2532 } |
2474 #endif // !defined(RTC_DISABLE_VP9) | 2533 #endif // !defined(RTC_DISABLE_VP9) |
2475 | 2534 |
2476 } // namespace webrtc | 2535 } // namespace webrtc |
OLD | NEW |