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 14 matching lines...) Expand all Loading... | |
25 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 25 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
26 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 26 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
27 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" | 27 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" |
28 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h" | 28 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h" |
29 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 29 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
30 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" | 30 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
31 #include "webrtc/system_wrappers/include/sleep.h" | 31 #include "webrtc/system_wrappers/include/sleep.h" |
32 #include "webrtc/test/call_test.h" | 32 #include "webrtc/test/call_test.h" |
33 #include "webrtc/test/configurable_frame_size_encoder.h" | 33 #include "webrtc/test/configurable_frame_size_encoder.h" |
34 #include "webrtc/test/fake_texture_frame.h" | 34 #include "webrtc/test/fake_texture_frame.h" |
35 #include "webrtc/test/field_trial.h" | |
35 #include "webrtc/test/frame_generator.h" | 36 #include "webrtc/test/frame_generator.h" |
37 #include "webrtc/test/frame_generator_capturer.h" | |
36 #include "webrtc/test/frame_utils.h" | 38 #include "webrtc/test/frame_utils.h" |
37 #include "webrtc/test/gtest.h" | 39 #include "webrtc/test/gtest.h" |
38 #include "webrtc/test/null_transport.h" | 40 #include "webrtc/test/null_transport.h" |
39 #include "webrtc/test/rtcp_packet_parser.h" | 41 #include "webrtc/test/rtcp_packet_parser.h" |
40 #include "webrtc/test/testsupport/perf_test.h" | 42 #include "webrtc/test/testsupport/perf_test.h" |
41 #include "webrtc/test/field_trial.h" | |
42 | 43 |
43 #include "webrtc/video/send_statistics_proxy.h" | 44 #include "webrtc/video/send_statistics_proxy.h" |
44 #include "webrtc/video/transport_adapter.h" | 45 #include "webrtc/video/transport_adapter.h" |
45 #include "webrtc/video_send_stream.h" | 46 #include "webrtc/video_send_stream.h" |
46 | 47 |
47 namespace webrtc { | 48 namespace webrtc { |
48 | 49 |
49 enum VideoFormat { kGeneric, kVP8, }; | 50 enum VideoFormat { kGeneric, kVP8, }; |
50 | 51 |
51 void ExpectEqualFramesVector(const std::vector<VideoFrame>& frames1, | 52 void ExpectEqualFramesVector(const std::vector<VideoFrame>& frames1, |
(...skipping 3348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3400 Call* call_; | 3401 Call* call_; |
3401 rtc::CriticalSection crit_; | 3402 rtc::CriticalSection crit_; |
3402 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_); | 3403 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_); |
3403 bool first_packet_sent_ GUARDED_BY(&crit_); | 3404 bool first_packet_sent_ GUARDED_BY(&crit_); |
3404 rtc::Event bitrate_changed_event_; | 3405 rtc::Event bitrate_changed_event_; |
3405 } test; | 3406 } test; |
3406 | 3407 |
3407 RunBaseTest(&test); | 3408 RunBaseTest(&test); |
3408 } | 3409 } |
3409 | 3410 |
3411 TEST_F(VideoSendStreamTest, SendsKeepAlive) { | |
3412 const int kTimeoutMs = 50; // Really short timeout for testing. | |
3413 const int kPayloadType = 20; | |
3414 | |
3415 class CNameObserver : public test::SendTest { | |
åsapersson
2017/06/30 15:09:13
rename class
sprang_webrtc
2017/06/30 16:21:00
Done.
| |
3416 public: | |
3417 CNameObserver() : SendTest(kDefaultTimeoutMs) {} | |
3418 | |
3419 private: | |
3420 Action OnSendRtp(const uint8_t* packet, size_t length) override { | |
3421 RTPHeader header; | |
3422 EXPECT_TRUE(parser_->Parse(packet, length, &header)); | |
3423 | |
3424 if (header.payloadType != kPayloadType) { | |
3425 // The video stream has start. Stop it now. But only once. | |
åsapersson
2017/06/30 15:09:13
But only once?
sprang_webrtc
2017/06/30 16:21:00
Missed cleanup. Removed.
| |
3426 if (capturer_) | |
3427 capturer_->Stop(); | |
3428 } else { | |
3429 observation_complete_.Set(); | |
3430 } | |
3431 | |
3432 return SEND_PACKET; | |
3433 } | |
3434 | |
3435 void ModifyVideoConfigs( | |
3436 VideoSendStream::Config* send_config, | |
3437 std::vector<VideoReceiveStream::Config>* receive_configs, | |
3438 VideoEncoderConfig* encoder_config) override { | |
3439 send_config->rtp.keep_alive.timeout_interval_ms = kTimeoutMs; | |
3440 send_config->rtp.keep_alive.payload_type = kPayloadType; | |
3441 } | |
3442 | |
3443 void PerformTest() override { | |
3444 EXPECT_TRUE(Wait()) << "Timed out while waiting for keep-alive packet."; | |
3445 } | |
3446 | |
3447 void OnFrameGeneratorCapturerCreated( | |
3448 test::FrameGeneratorCapturer* frame_generator_capturer) override { | |
3449 capturer_ = frame_generator_capturer; | |
3450 } | |
3451 | |
3452 test::FrameGeneratorCapturer* capturer_ = nullptr; | |
3453 } test; | |
3454 | |
3455 RunBaseTest(&test); | |
3456 } | |
3457 | |
3410 } // namespace webrtc | 3458 } // namespace webrtc |
OLD | NEW |