| 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> | 10 #include <algorithm> |
| (...skipping 2362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2373 Clock* const clock_; | 2373 Clock* const clock_; |
| 2374 const int start_bitrate_bps_; | 2374 const int start_bitrate_bps_; |
| 2375 int state_; | 2375 int state_; |
| 2376 Call* sender_call_; | 2376 Call* sender_call_; |
| 2377 }; | 2377 }; |
| 2378 | 2378 |
| 2379 TEST_F(EndToEndTest, MAYBE_InitialProbing) { | 2379 TEST_F(EndToEndTest, MAYBE_InitialProbing) { |
| 2380 class InitialProbingTest : public ProbingTest { | 2380 class InitialProbingTest : public ProbingTest { |
| 2381 public: | 2381 public: |
| 2382 explicit InitialProbingTest(bool* success) | 2382 explicit InitialProbingTest(bool* success) |
| 2383 : ProbingTest(300000), success_(success) {} | 2383 : ProbingTest(300000), success_(success) { |
| 2384 *success_ = false; |
| 2385 } |
| 2384 | 2386 |
| 2385 void PerformTest() override { | 2387 void PerformTest() override { |
| 2386 int64_t start_time_ms = clock_->TimeInMilliseconds(); | 2388 int64_t start_time_ms = clock_->TimeInMilliseconds(); |
| 2387 do { | 2389 do { |
| 2388 if (clock_->TimeInMilliseconds() - start_time_ms > kTimeoutMs) | 2390 if (clock_->TimeInMilliseconds() - start_time_ms > kTimeoutMs) |
| 2389 break; | 2391 break; |
| 2390 | 2392 |
| 2391 Call::Stats stats = sender_call_->GetStats(); | 2393 Call::Stats stats = sender_call_->GetStats(); |
| 2392 // Initial probing is done with a x3 and x6 multiplier of the start | 2394 // Initial probing is done with a x3 and x6 multiplier of the start |
| 2393 // bitrate, so a x4 multiplier is a high enough threshold. | 2395 // bitrate, so a x4 multiplier is a high enough threshold. |
| 2394 if (stats.send_bandwidth_bps > 4 * 300000) { | 2396 if (stats.send_bandwidth_bps > 4 * 300000) { |
| 2395 *success_ = true; | 2397 *success_ = true; |
| 2396 break; | 2398 break; |
| 2397 } | 2399 } |
| 2398 } while (!observation_complete_.Wait(20)); | 2400 } while (!observation_complete_.Wait(20)); |
| 2399 } | 2401 } |
| 2400 | 2402 |
| 2401 private: | 2403 private: |
| 2402 const int kTimeoutMs = 1000; | 2404 const int kTimeoutMs = 1000; |
| 2403 bool* const success_; | 2405 bool* const success_; |
| 2404 }; | 2406 }; |
| 2405 | 2407 |
| 2406 bool success; | 2408 bool success = false; |
| 2407 const int kMaxAttempts = 3; | 2409 const int kMaxAttempts = 3; |
| 2408 for (int i = 0; i < kMaxAttempts; ++i) { | 2410 for (int i = 0; i < kMaxAttempts; ++i) { |
| 2409 InitialProbingTest test(&success); | 2411 InitialProbingTest test(&success); |
| 2410 RunBaseTest(&test); | 2412 RunBaseTest(&test); |
| 2411 if (success) | 2413 if (success) |
| 2412 return; | 2414 return; |
| 2413 } | 2415 } |
| 2414 RTC_DCHECK(success) << "Failed to perform mid initial probing (" | 2416 EXPECT_TRUE(success) << "Failed to perform mid initial probing (" |
| 2415 << kMaxAttempts << " attempts)."; | 2417 << kMaxAttempts << " attempts)."; |
| 2416 } | 2418 } |
| 2417 | 2419 |
| 2418 // Fails on Linux MSan: bugs.webrtc.org/7428 | 2420 // Fails on Linux MSan: bugs.webrtc.org/7428 |
| 2419 #if defined(MEMORY_SANITIZER) | 2421 #if defined(MEMORY_SANITIZER) |
| 2420 TEST_F(EndToEndTest, DISABLED_TriggerMidCallProbing) { | 2422 TEST_F(EndToEndTest, DISABLED_TriggerMidCallProbing) { |
| 2421 // Fails on iOS bots: bugs.webrtc.org/7851 | 2423 // Fails on iOS bots: bugs.webrtc.org/7851 |
| 2422 #elif defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR | 2424 #elif defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR |
| 2423 TEST_F(EndToEndTest, DISABLED_TriggerMidCallProbing) { | 2425 TEST_F(EndToEndTest, DISABLED_TriggerMidCallProbing) { |
| 2424 #else | 2426 #else |
| 2425 TEST_F(EndToEndTest, TriggerMidCallProbing) { | 2427 TEST_F(EndToEndTest, TriggerMidCallProbing) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2467 break; | 2469 break; |
| 2468 } | 2470 } |
| 2469 } while (!observation_complete_.Wait(20)); | 2471 } while (!observation_complete_.Wait(20)); |
| 2470 } | 2472 } |
| 2471 | 2473 |
| 2472 private: | 2474 private: |
| 2473 const int kTimeoutMs = 5000; | 2475 const int kTimeoutMs = 5000; |
| 2474 bool* const success_; | 2476 bool* const success_; |
| 2475 }; | 2477 }; |
| 2476 | 2478 |
| 2477 bool success; | 2479 bool success = false; |
| 2478 const int kMaxAttempts = 3; | 2480 const int kMaxAttempts = 3; |
| 2479 for (int i = 0; i < kMaxAttempts; ++i) { | 2481 for (int i = 0; i < kMaxAttempts; ++i) { |
| 2480 TriggerMidCallProbingTest test(&success); | 2482 TriggerMidCallProbingTest test(&success); |
| 2481 RunBaseTest(&test); | 2483 RunBaseTest(&test); |
| 2482 if (success) | 2484 if (success) |
| 2483 return; | 2485 return; |
| 2484 } | 2486 } |
| 2485 EXPECT_TRUE(success) << "Failed to perform mid call probing (" << kMaxAttempts | 2487 EXPECT_TRUE(success) << "Failed to perform mid call probing (" << kMaxAttempts |
| 2486 << " attempts)."; | 2488 << " attempts)."; |
| 2487 } | 2489 } |
| (...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4838 std::unique_ptr<VideoEncoder> encoder_; | 4840 std::unique_ptr<VideoEncoder> encoder_; |
| 4839 std::unique_ptr<VideoDecoder> decoder_; | 4841 std::unique_ptr<VideoDecoder> decoder_; |
| 4840 rtc::CriticalSection crit_; | 4842 rtc::CriticalSection crit_; |
| 4841 int recorded_frames_ GUARDED_BY(crit_); | 4843 int recorded_frames_ GUARDED_BY(crit_); |
| 4842 } test(this); | 4844 } test(this); |
| 4843 | 4845 |
| 4844 RunBaseTest(&test); | 4846 RunBaseTest(&test); |
| 4845 } | 4847 } |
| 4846 | 4848 |
| 4847 } // namespace webrtc | 4849 } // namespace webrtc |
| OLD | NEW |