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