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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 void TestVp9NonFlexMode(uint8_t num_temporal_layers, | 58 void TestVp9NonFlexMode(uint8_t num_temporal_layers, |
59 uint8_t num_spatial_layers); | 59 uint8_t num_spatial_layers); |
60 | 60 |
61 void TestRequestSourceRotateVideo(bool support_orientation_ext); | 61 void TestRequestSourceRotateVideo(bool support_orientation_ext); |
62 }; | 62 }; |
63 | 63 |
64 TEST_F(VideoSendStreamTest, CanStartStartedStream) { | 64 TEST_F(VideoSendStreamTest, CanStartStartedStream) { |
65 CreateSenderCall(Call::Config(&event_log_)); | 65 CreateSenderCall(Call::Config(&event_log_)); |
66 | 66 |
67 test::NullTransport transport; | 67 test::NullTransport transport; |
68 CreateSendConfig(1, 0, &transport); | 68 CreateSendConfig(1, 0, 0, &transport); |
69 CreateVideoStreams(); | 69 CreateVideoStreams(); |
70 video_send_stream_->Start(); | 70 video_send_stream_->Start(); |
71 video_send_stream_->Start(); | 71 video_send_stream_->Start(); |
72 DestroyStreams(); | 72 DestroyStreams(); |
73 } | 73 } |
74 | 74 |
75 TEST_F(VideoSendStreamTest, CanStopStoppedStream) { | 75 TEST_F(VideoSendStreamTest, CanStopStoppedStream) { |
76 CreateSenderCall(Call::Config(&event_log_)); | 76 CreateSenderCall(Call::Config(&event_log_)); |
77 | 77 |
78 test::NullTransport transport; | 78 test::NullTransport transport; |
79 CreateSendConfig(1, 0, &transport); | 79 CreateSendConfig(1, 0, 0, &transport); |
80 CreateVideoStreams(); | 80 CreateVideoStreams(); |
81 video_send_stream_->Stop(); | 81 video_send_stream_->Stop(); |
82 video_send_stream_->Stop(); | 82 video_send_stream_->Stop(); |
83 DestroyStreams(); | 83 DestroyStreams(); |
84 } | 84 } |
85 | 85 |
86 TEST_F(VideoSendStreamTest, SupportsCName) { | 86 TEST_F(VideoSendStreamTest, SupportsCName) { |
87 static std::string kCName = "PjQatC14dGfbVwGPUOA9IH7RlsFDbWl4AhXEiDsBizo="; | 87 static std::string kCName = "PjQatC14dGfbVwGPUOA9IH7RlsFDbWl4AhXEiDsBizo="; |
88 class CNameObserver : public test::SendTest { | 88 class CNameObserver : public test::SendTest { |
89 public: | 89 public: |
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 | 1510 |
1511 rtc::CriticalSection crit_; | 1511 rtc::CriticalSection crit_; |
1512 rtc::Event init_encode_called_; | 1512 rtc::Event init_encode_called_; |
1513 size_t number_of_initializations_ GUARDED_BY(&crit_); | 1513 size_t number_of_initializations_ GUARDED_BY(&crit_); |
1514 int last_initialized_frame_width_ GUARDED_BY(&crit_); | 1514 int last_initialized_frame_width_ GUARDED_BY(&crit_); |
1515 int last_initialized_frame_height_ GUARDED_BY(&crit_); | 1515 int last_initialized_frame_height_ GUARDED_BY(&crit_); |
1516 }; | 1516 }; |
1517 | 1517 |
1518 CreateSenderCall(Call::Config(&event_log_)); | 1518 CreateSenderCall(Call::Config(&event_log_)); |
1519 test::NullTransport transport; | 1519 test::NullTransport transport; |
1520 CreateSendConfig(1, 0, &transport); | 1520 CreateSendConfig(1, 0, 0, &transport); |
1521 EncoderObserver encoder; | 1521 EncoderObserver encoder; |
1522 video_send_config_.encoder_settings.encoder = &encoder; | 1522 video_send_config_.encoder_settings.encoder = &encoder; |
1523 CreateVideoStreams(); | 1523 CreateVideoStreams(); |
1524 CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth, | 1524 CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth, |
1525 kDefaultHeight); | 1525 kDefaultHeight); |
1526 frame_generator_capturer_->Start(); | 1526 frame_generator_capturer_->Start(); |
1527 | 1527 |
1528 encoder.WaitForResolution(kDefaultWidth, kDefaultHeight); | 1528 encoder.WaitForResolution(kDefaultWidth, kDefaultHeight); |
1529 frame_generator_capturer_->ChangeResolution(kDefaultWidth * 2, | 1529 frame_generator_capturer_->ChangeResolution(kDefaultWidth * 2, |
1530 kDefaultHeight * 2); | 1530 kDefaultHeight * 2); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 | 1567 |
1568 private: | 1568 private: |
1569 rtc::CriticalSection crit_; | 1569 rtc::CriticalSection crit_; |
1570 rtc::Event start_bitrate_changed_; | 1570 rtc::Event start_bitrate_changed_; |
1571 int start_bitrate_kbps_ GUARDED_BY(crit_); | 1571 int start_bitrate_kbps_ GUARDED_BY(crit_); |
1572 }; | 1572 }; |
1573 | 1573 |
1574 CreateSenderCall(Call::Config(&event_log_)); | 1574 CreateSenderCall(Call::Config(&event_log_)); |
1575 | 1575 |
1576 test::NullTransport transport; | 1576 test::NullTransport transport; |
1577 CreateSendConfig(1, 0, &transport); | 1577 CreateSendConfig(1, 0, 0, &transport); |
1578 | 1578 |
1579 Call::Config::BitrateConfig bitrate_config; | 1579 Call::Config::BitrateConfig bitrate_config; |
1580 bitrate_config.start_bitrate_bps = 2 * video_encoder_config_.max_bitrate_bps; | 1580 bitrate_config.start_bitrate_bps = 2 * video_encoder_config_.max_bitrate_bps; |
1581 sender_call_->SetBitrateConfig(bitrate_config); | 1581 sender_call_->SetBitrateConfig(bitrate_config); |
1582 | 1582 |
1583 StartBitrateObserver encoder; | 1583 StartBitrateObserver encoder; |
1584 video_send_config_.encoder_settings.encoder = &encoder; | 1584 video_send_config_.encoder_settings.encoder = &encoder; |
1585 // Since this test does not use a capturer, set |internal_source| = true. | 1585 // Since this test does not use a capturer, set |internal_source| = true. |
1586 // Encoder configuration is otherwise updated on the next video frame. | 1586 // Encoder configuration is otherwise updated on the next video frame. |
1587 video_send_config_.encoder_settings.internal_source = true; | 1587 video_send_config_.encoder_settings.internal_source = true; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1648 private: | 1648 private: |
1649 rtc::CriticalSection crit_; | 1649 rtc::CriticalSection crit_; |
1650 rtc::Event encoder_init_; | 1650 rtc::Event encoder_init_; |
1651 rtc::Event bitrate_changed_; | 1651 rtc::Event bitrate_changed_; |
1652 int bitrate_kbps_ GUARDED_BY(crit_); | 1652 int bitrate_kbps_ GUARDED_BY(crit_); |
1653 }; | 1653 }; |
1654 | 1654 |
1655 CreateSenderCall(Call::Config(&event_log_)); | 1655 CreateSenderCall(Call::Config(&event_log_)); |
1656 | 1656 |
1657 test::NullTransport transport; | 1657 test::NullTransport transport; |
1658 CreateSendConfig(1, 0, &transport); | 1658 CreateSendConfig(1, 0, 0, &transport); |
1659 | 1659 |
1660 StartStopBitrateObserver encoder; | 1660 StartStopBitrateObserver encoder; |
1661 video_send_config_.encoder_settings.encoder = &encoder; | 1661 video_send_config_.encoder_settings.encoder = &encoder; |
1662 video_send_config_.encoder_settings.internal_source = true; | 1662 video_send_config_.encoder_settings.internal_source = true; |
1663 | 1663 |
1664 CreateVideoStreams(); | 1664 CreateVideoStreams(); |
1665 | 1665 |
1666 EXPECT_TRUE(encoder.WaitForEncoderInit()); | 1666 EXPECT_TRUE(encoder.WaitForEncoderInit()); |
1667 EXPECT_GT(encoder.GetBitrateKbps(), 0); | 1667 EXPECT_GT(encoder.GetBitrateKbps(), 0); |
1668 video_send_stream_->Start(); | 1668 video_send_stream_->Start(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1703 std::vector<VideoFrame> output_frames_; | 1703 std::vector<VideoFrame> output_frames_; |
1704 | 1704 |
1705 // Indicate an output frame has arrived. | 1705 // Indicate an output frame has arrived. |
1706 rtc::Event output_frame_event_; | 1706 rtc::Event output_frame_event_; |
1707 }; | 1707 }; |
1708 | 1708 |
1709 // Initialize send stream. | 1709 // Initialize send stream. |
1710 CreateSenderCall(Call::Config(&event_log_)); | 1710 CreateSenderCall(Call::Config(&event_log_)); |
1711 | 1711 |
1712 test::NullTransport transport; | 1712 test::NullTransport transport; |
1713 CreateSendConfig(1, 0, &transport); | 1713 CreateSendConfig(1, 0, 0, &transport); |
1714 FrameObserver observer; | 1714 FrameObserver observer; |
1715 video_send_config_.pre_encode_callback = &observer; | 1715 video_send_config_.pre_encode_callback = &observer; |
1716 CreateVideoStreams(); | 1716 CreateVideoStreams(); |
1717 | 1717 |
1718 // Prepare five input frames. Send ordinary VideoFrame and texture frames | 1718 // Prepare five input frames. Send ordinary VideoFrame and texture frames |
1719 // alternatively. | 1719 // alternatively. |
1720 std::vector<VideoFrame> input_frames; | 1720 std::vector<VideoFrame> input_frames; |
1721 int width = 168; | 1721 int width = 168; |
1722 int height = 132; | 1722 int height = 132; |
1723 | 1723 |
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2958 | 2958 |
2959 RunBaseTest(&test); | 2959 RunBaseTest(&test); |
2960 } | 2960 } |
2961 #endif // !defined(RTC_DISABLE_VP9) | 2961 #endif // !defined(RTC_DISABLE_VP9) |
2962 | 2962 |
2963 void VideoSendStreamTest::TestRequestSourceRotateVideo( | 2963 void VideoSendStreamTest::TestRequestSourceRotateVideo( |
2964 bool support_orientation_ext) { | 2964 bool support_orientation_ext) { |
2965 CreateSenderCall(Call::Config(&event_log_)); | 2965 CreateSenderCall(Call::Config(&event_log_)); |
2966 | 2966 |
2967 test::NullTransport transport; | 2967 test::NullTransport transport; |
2968 CreateSendConfig(1, 0, &transport); | 2968 CreateSendConfig(1, 0, 0, &transport); |
2969 video_send_config_.rtp.extensions.clear(); | 2969 video_send_config_.rtp.extensions.clear(); |
2970 if (support_orientation_ext) { | 2970 if (support_orientation_ext) { |
2971 video_send_config_.rtp.extensions.push_back( | 2971 video_send_config_.rtp.extensions.push_back( |
2972 RtpExtension(RtpExtension::kVideoRotationUri, 1)); | 2972 RtpExtension(RtpExtension::kVideoRotationUri, 1)); |
2973 } | 2973 } |
2974 | 2974 |
2975 CreateVideoStreams(); | 2975 CreateVideoStreams(); |
2976 test::FrameForwarder forwarder; | 2976 test::FrameForwarder forwarder; |
2977 video_send_stream_->SetSource( | 2977 video_send_stream_->SetSource( |
2978 &forwarder, VideoSendStream::DegradationPreference::kBalanced); | 2978 &forwarder, VideoSendStream::DegradationPreference::kBalanced); |
2979 | 2979 |
2980 EXPECT_TRUE(forwarder.sink_wants().rotation_applied != | 2980 EXPECT_TRUE(forwarder.sink_wants().rotation_applied != |
2981 support_orientation_ext); | 2981 support_orientation_ext); |
2982 | 2982 |
2983 DestroyStreams(); | 2983 DestroyStreams(); |
2984 } | 2984 } |
2985 | 2985 |
2986 TEST_F(VideoSendStreamTest, | 2986 TEST_F(VideoSendStreamTest, |
2987 RequestSourceRotateIfVideoOrientationExtensionNotSupported) { | 2987 RequestSourceRotateIfVideoOrientationExtensionNotSupported) { |
2988 TestRequestSourceRotateVideo(false); | 2988 TestRequestSourceRotateVideo(false); |
2989 } | 2989 } |
2990 | 2990 |
2991 TEST_F(VideoSendStreamTest, | 2991 TEST_F(VideoSendStreamTest, |
2992 DoNotRequestsRotationIfVideoOrientationExtensionSupported) { | 2992 DoNotRequestsRotationIfVideoOrientationExtensionSupported) { |
2993 TestRequestSourceRotateVideo(true); | 2993 TestRequestSourceRotateVideo(true); |
2994 } | 2994 } |
2995 | 2995 |
2996 } // namespace webrtc | 2996 } // namespace webrtc |
OLD | NEW |