| 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 3392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3403 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_); | 3403 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_); |
| 3404 bool first_packet_sent_ GUARDED_BY(&crit_); | 3404 bool first_packet_sent_ GUARDED_BY(&crit_); |
| 3405 rtc::Event bitrate_changed_event_; | 3405 rtc::Event bitrate_changed_event_; |
| 3406 } test; | 3406 } test; |
| 3407 | 3407 |
| 3408 RunBaseTest(&test); | 3408 RunBaseTest(&test); |
| 3409 } | 3409 } |
| 3410 | 3410 |
| 3411 TEST_F(VideoSendStreamTest, SendsKeepAlive) { | 3411 TEST_F(VideoSendStreamTest, SendsKeepAlive) { |
| 3412 const int kTimeoutMs = 50; // Really short timeout for testing. | 3412 const int kTimeoutMs = 50; // Really short timeout for testing. |
| 3413 const int kPayloadType = 20; | |
| 3414 | 3413 |
| 3415 class KeepaliveObserver : public test::SendTest { | 3414 class KeepaliveObserver : public test::SendTest { |
| 3416 public: | 3415 public: |
| 3417 KeepaliveObserver() : SendTest(kDefaultTimeoutMs) {} | 3416 KeepaliveObserver() : SendTest(kDefaultTimeoutMs) {} |
| 3418 | 3417 |
| 3419 private: | 3418 private: |
| 3420 Action OnSendRtp(const uint8_t* packet, size_t length) override { | 3419 Action OnSendRtp(const uint8_t* packet, size_t length) override { |
| 3421 RTPHeader header; | 3420 RTPHeader header; |
| 3422 EXPECT_TRUE(parser_->Parse(packet, length, &header)); | 3421 EXPECT_TRUE(parser_->Parse(packet, length, &header)); |
| 3423 | 3422 |
| 3424 if (header.payloadType != kPayloadType) { | 3423 if (header.payloadType != CallTest::kDefaultKeepalivePayloadType) { |
| 3425 // The video stream has started. Stop it now. | 3424 // The video stream has started. Stop it now. |
| 3426 if (capturer_) | 3425 if (capturer_) |
| 3427 capturer_->Stop(); | 3426 capturer_->Stop(); |
| 3428 } else { | 3427 } else { |
| 3429 observation_complete_.Set(); | 3428 observation_complete_.Set(); |
| 3430 } | 3429 } |
| 3431 | 3430 |
| 3432 return SEND_PACKET; | 3431 return SEND_PACKET; |
| 3433 } | 3432 } |
| 3434 | 3433 |
| 3435 void ModifyVideoConfigs( | 3434 void ModifyVideoConfigs( |
| 3436 VideoSendStream::Config* send_config, | 3435 VideoSendStream::Config* send_config, |
| 3437 std::vector<VideoReceiveStream::Config>* receive_configs, | 3436 std::vector<VideoReceiveStream::Config>* receive_configs, |
| 3438 VideoEncoderConfig* encoder_config) override { | 3437 VideoEncoderConfig* encoder_config) override { |
| 3439 send_config->rtp.keep_alive.timeout_interval_ms = kTimeoutMs; | 3438 send_config->rtp.keep_alive.timeout_interval_ms = kTimeoutMs; |
| 3440 send_config->rtp.keep_alive.payload_type = kPayloadType; | 3439 send_config->rtp.keep_alive.payload_type = |
| 3440 CallTest::kDefaultKeepalivePayloadType; |
| 3441 } | 3441 } |
| 3442 | 3442 |
| 3443 void PerformTest() override { | 3443 void PerformTest() override { |
| 3444 EXPECT_TRUE(Wait()) << "Timed out while waiting for keep-alive packet."; | 3444 EXPECT_TRUE(Wait()) << "Timed out while waiting for keep-alive packet."; |
| 3445 } | 3445 } |
| 3446 | 3446 |
| 3447 void OnFrameGeneratorCapturerCreated( | 3447 void OnFrameGeneratorCapturerCreated( |
| 3448 test::FrameGeneratorCapturer* frame_generator_capturer) override { | 3448 test::FrameGeneratorCapturer* frame_generator_capturer) override { |
| 3449 capturer_ = frame_generator_capturer; | 3449 capturer_ = frame_generator_capturer; |
| 3450 } | 3450 } |
| 3451 | 3451 |
| 3452 test::FrameGeneratorCapturer* capturer_ = nullptr; | 3452 test::FrameGeneratorCapturer* capturer_ = nullptr; |
| 3453 } test; | 3453 } test; |
| 3454 | 3454 |
| 3455 RunBaseTest(&test); | 3455 RunBaseTest(&test); |
| 3456 } | 3456 } |
| 3457 | 3457 |
| 3458 } // namespace webrtc | 3458 } // namespace webrtc |
| OLD | NEW |