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

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

Issue 2760623002: Probing EndToEndTests. (Closed)
Patch Set: Correctly disabled tests on memcheck bot. Created 3 years, 9 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/test/rtp_rtcp_observer.h ('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> 10 #include <algorithm>
(...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2189 test::PacketTransport* receive_transport_; 2189 test::PacketTransport* receive_transport_;
2190 rtc::Event stop_event_; 2190 rtc::Event stop_event_;
2191 rtc::PlatformThread poller_thread_; 2191 rtc::PlatformThread poller_thread_;
2192 TestState state_; 2192 TestState state_;
2193 RateLimiter retransmission_rate_limiter_; 2193 RateLimiter retransmission_rate_limiter_;
2194 } test; 2194 } test;
2195 2195
2196 RunBaseTest(&test); 2196 RunBaseTest(&test);
2197 } 2197 }
2198 2198
2199 class ProbingTest : public test::EndToEndTest {
2200 public:
2201 explicit ProbingTest(int start_bitrate_bps)
2202 : clock_(Clock::GetRealTimeClock()),
2203 start_bitrate_bps_(start_bitrate_bps),
2204 state_(0),
2205 sender_call_(nullptr) {}
2206
2207 ~ProbingTest() {}
2208
2209 Call::Config GetSenderCallConfig() override {
2210 Call::Config config(&event_log_);
2211 config.bitrate_config.start_bitrate_bps = start_bitrate_bps_;
2212 return config;
2213 }
2214
2215 void OnCallsCreated(Call* sender_call, Call* receiver_call) override {
2216 sender_call_ = sender_call;
2217 }
2218
2219 protected:
2220 Clock* const clock_;
2221 const int start_bitrate_bps_;
2222 int state_;
2223 Call* sender_call_;
2224 };
2225
2226 TEST_F(EndToEndTest, InitialProbing) {
2227 class InitialProbingTest : public ProbingTest {
2228 public:
2229 InitialProbingTest() : ProbingTest(300000) {}
2230
2231 void PerformTest() override {
2232 int64_t start_time_ms = clock_->TimeInMilliseconds();
2233 do {
2234 if (clock_->TimeInMilliseconds() - start_time_ms > kTimeoutMs) {
2235 ADD_FAILURE() << "Timed out while waiting for initial probing.";
2236 break;
2237 }
2238
2239 Call::Stats stats = sender_call_->GetStats();
2240 // Initial probing is done with a x3 and x6 multiplier of the start
2241 // bitrate, so a x4 multiplier is a high enough threshold.
2242 if (stats.send_bandwidth_bps > 4 * 300000)
2243 break;
2244 } while (!observation_complete_.Wait(20));
2245 }
2246
2247 private:
2248 const int kTimeoutMs = 1000;
2249 } test;
2250
2251 RunBaseTest(&test);
2252 }
2253
2254 TEST_F(EndToEndTest, TriggerMidCallProbing) {
2255 class TriggerMidCallProbingTest : public ProbingTest {
2256 public:
2257 TriggerMidCallProbingTest() : ProbingTest(300000) {}
2258
2259 void PerformTest() override {
2260 int64_t start_time_ms = clock_->TimeInMilliseconds();
2261 do {
2262 if (clock_->TimeInMilliseconds() - start_time_ms > kTimeoutMs) {
2263 ADD_FAILURE() << "Timed out while waiting for mid-call probing.";
2264 break;
2265 }
2266
2267 Call::Stats stats = sender_call_->GetStats();
2268
2269 switch (state_) {
2270 case 0:
2271 if (stats.send_bandwidth_bps > 5 * 300000) {
2272 Call::Config::BitrateConfig bitrate_config;
2273 bitrate_config.max_bitrate_bps = 100000;
2274 sender_call_->SetBitrateConfig(bitrate_config);
2275 ++state_;
2276 }
2277 break;
2278 case 1:
2279 if (stats.send_bandwidth_bps < 110000) {
2280 Call::Config::BitrateConfig bitrate_config;
2281 bitrate_config.max_bitrate_bps = 2500000;
2282 sender_call_->SetBitrateConfig(bitrate_config);
2283 ++state_;
2284 }
2285 break;
2286 case 2:
2287 // During high cpu load the pacer will not be able to pace packets
2288 // at the correct speed, but if we go from 110 to 1250 kbps
2289 // in 5 seconds then it is due to probing.
2290 if (stats.send_bandwidth_bps > 1250000)
2291 observation_complete_.Set();
2292 break;
2293 }
2294 } while (!observation_complete_.Wait(20));
2295 }
2296
2297 private:
2298 const int kTimeoutMs = 5000;
2299 } test;
2300
2301 RunBaseTest(&test);
2302 }
2303
2199 TEST_F(EndToEndTest, VerifyNackStats) { 2304 TEST_F(EndToEndTest, VerifyNackStats) {
2200 static const int kPacketNumberToDrop = 200; 2305 static const int kPacketNumberToDrop = 200;
2201 class NackObserver : public test::EndToEndTest { 2306 class NackObserver : public test::EndToEndTest {
2202 public: 2307 public:
2203 NackObserver() 2308 NackObserver()
2204 : EndToEndTest(kLongTimeoutMs), 2309 : EndToEndTest(kLongTimeoutMs),
2205 sent_rtp_packets_(0), 2310 sent_rtp_packets_(0),
2206 dropped_rtp_packet_(0), 2311 dropped_rtp_packet_(0),
2207 dropped_rtp_packet_requested_(false), 2312 dropped_rtp_packet_requested_(false),
2208 send_stream_(nullptr), 2313 send_stream_(nullptr),
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after
4180 std::unique_ptr<VideoEncoder> encoder_; 4285 std::unique_ptr<VideoEncoder> encoder_;
4181 std::unique_ptr<VideoDecoder> decoder_; 4286 std::unique_ptr<VideoDecoder> decoder_;
4182 rtc::CriticalSection crit_; 4287 rtc::CriticalSection crit_;
4183 int recorded_frames_ GUARDED_BY(crit_); 4288 int recorded_frames_ GUARDED_BY(crit_);
4184 } test(this); 4289 } test(this);
4185 4290
4186 RunBaseTest(&test); 4291 RunBaseTest(&test);
4187 } 4292 }
4188 4293
4189 } // namespace webrtc 4294 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/rtp_rtcp_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698