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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 VideoFrame CreateVideoFrame(int width, int height, uint8_t data); | 50 VideoFrame CreateVideoFrame(int width, int height, uint8_t data); |
51 | 51 |
52 class VideoSendStreamTest : public test::CallTest { | 52 class VideoSendStreamTest : public test::CallTest { |
53 protected: | 53 protected: |
54 void TestNackRetransmission(uint32_t retransmit_ssrc, | 54 void TestNackRetransmission(uint32_t retransmit_ssrc, |
55 uint8_t retransmit_payload_type); | 55 uint8_t retransmit_payload_type); |
56 void TestPacketFragmentationSize(VideoFormat format, bool with_fec); | 56 void TestPacketFragmentationSize(VideoFormat format, bool with_fec); |
57 | 57 |
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 | |
61 void TestRequestSourceRotateVideo(bool support_orientation_ext); | |
60 }; | 62 }; |
61 | 63 |
62 TEST_F(VideoSendStreamTest, CanStartStartedStream) { | 64 TEST_F(VideoSendStreamTest, CanStartStartedStream) { |
63 CreateSenderCall(Call::Config(&event_log_)); | 65 CreateSenderCall(Call::Config(&event_log_)); |
64 | 66 |
65 test::NullTransport transport; | 67 test::NullTransport transport; |
66 CreateSendConfig(1, 0, &transport); | 68 CreateSendConfig(1, 0, &transport); |
67 CreateVideoStreams(); | 69 CreateVideoStreams(); |
68 video_send_stream_->Start(); | 70 video_send_stream_->Start(); |
69 video_send_stream_->Start(); | 71 video_send_stream_->Start(); |
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1649 handle1, width, height, 1, 1, kVideoRotation_0)); | 1651 handle1, width, height, 1, 1, kVideoRotation_0)); |
1650 input_frames.push_back(test::FakeNativeHandle::CreateFrame( | 1652 input_frames.push_back(test::FakeNativeHandle::CreateFrame( |
1651 handle2, width, height, 2, 2, kVideoRotation_0)); | 1653 handle2, width, height, 2, 2, kVideoRotation_0)); |
1652 input_frames.push_back(CreateVideoFrame(width, height, 3)); | 1654 input_frames.push_back(CreateVideoFrame(width, height, 3)); |
1653 input_frames.push_back(CreateVideoFrame(width, height, 4)); | 1655 input_frames.push_back(CreateVideoFrame(width, height, 4)); |
1654 input_frames.push_back(test::FakeNativeHandle::CreateFrame( | 1656 input_frames.push_back(test::FakeNativeHandle::CreateFrame( |
1655 handle3, width, height, 5, 5, kVideoRotation_0)); | 1657 handle3, width, height, 5, 5, kVideoRotation_0)); |
1656 | 1658 |
1657 video_send_stream_->Start(); | 1659 video_send_stream_->Start(); |
1658 test::FrameForwarder forwarder; | 1660 test::FrameForwarder forwarder; |
1659 video_send_stream_->SetSource(&forwarder); | 1661 video_send_stream_->SetSource( |
1662 &forwarder, VideoSendStream::DegradationPreference::kBalanced); | |
1660 for (size_t i = 0; i < input_frames.size(); i++) { | 1663 for (size_t i = 0; i < input_frames.size(); i++) { |
1661 forwarder.IncomingCapturedFrame(input_frames[i]); | 1664 forwarder.IncomingCapturedFrame(input_frames[i]); |
1662 // Wait until the output frame is received before sending the next input | 1665 // Wait until the output frame is received before sending the next input |
1663 // frame. Or the previous input frame may be replaced without delivering. | 1666 // frame. Or the previous input frame may be replaced without delivering. |
1664 observer.WaitOutputFrame(); | 1667 observer.WaitOutputFrame(); |
1665 } | 1668 } |
1666 video_send_stream_->Stop(); | 1669 video_send_stream_->Stop(); |
1667 video_send_stream_->SetSource(nullptr); | 1670 video_send_stream_->SetSource( |
1671 nullptr, VideoSendStream::DegradationPreference::kBalanced); | |
1668 | 1672 |
1669 // Test if the input and output frames are the same. render_time_ms and | 1673 // Test if the input and output frames are the same. render_time_ms and |
1670 // timestamp are not compared because capturer sets those values. | 1674 // timestamp are not compared because capturer sets those values. |
1671 ExpectEqualFramesVector(input_frames, observer.output_frames()); | 1675 ExpectEqualFramesVector(input_frames, observer.output_frames()); |
1672 | 1676 |
1673 DestroyStreams(); | 1677 DestroyStreams(); |
1674 } | 1678 } |
1675 | 1679 |
1676 void ExpectEqualFramesVector(const std::vector<VideoFrame>& frames1, | 1680 void ExpectEqualFramesVector(const std::vector<VideoFrame>& frames1, |
1677 const std::vector<VideoFrame>& frames2) { | 1681 const std::vector<VideoFrame>& frames2) { |
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2872 EXPECT_GT(vp9_header.num_ref_pics, 0u); | 2876 EXPECT_GT(vp9_header.num_ref_pics, 0u); |
2873 observation_complete_.Set(); | 2877 observation_complete_.Set(); |
2874 } | 2878 } |
2875 } | 2879 } |
2876 } test; | 2880 } test; |
2877 | 2881 |
2878 RunBaseTest(&test); | 2882 RunBaseTest(&test); |
2879 } | 2883 } |
2880 #endif // !defined(RTC_DISABLE_VP9) | 2884 #endif // !defined(RTC_DISABLE_VP9) |
2881 | 2885 |
2886 void VideoSendStreamTest::TestRequestSourceRotateVideo( | |
2887 bool support_orientation_ext) { | |
2888 CreateSenderCall(Call::Config(&event_log_)); | |
2889 | |
2890 test::NullTransport transport; | |
2891 CreateSendConfig(1, 0, &transport); | |
2892 video_send_config_.rtp.extensions.clear(); | |
2893 if (support_orientation_ext) { | |
2894 video_send_config_.rtp.extensions.push_back( | |
2895 RtpExtension(RtpExtension::kVideoRotationUri, 1)); | |
2896 } | |
2897 | |
2898 CreateVideoStreams(); | |
2899 test::FrameForwarder forwarder; | |
2900 video_send_stream_->SetSource( | |
2901 &forwarder, VideoSendStream::DegradationPreference::kBalanced); | |
2902 | |
2903 EXPECT_TRUE(forwarder.sink_wants().rotation_applied != | |
2904 support_orientation_ext); | |
2905 | |
2906 DestroyStreams(); | |
2907 } | |
2908 | |
2909 TEST_F(VideoSendStreamTest, | |
2910 RequestSourceRotateIfVideoOrientationExtensionNotSupported) { | |
2911 TestRequestSourceRotateVideo(false); | |
2912 } | |
2913 | |
2914 TEST_F(VideoSendStreamTest, | |
2915 DoNotRequestsRotationIfVideoOrientationExtensionSupported) { | |
2916 TestRequestSourceRotateVideo(true); | |
2917 } | |
åsapersson
2016/11/01 08:04:55
Maybe also add a test that verifies the rtp header
perkj_webrtc
2016/11/01 18:00:41
ok, I did not add VideoRotation but I guess it doe
| |
2918 | |
2882 } // namespace webrtc | 2919 } // namespace webrtc |
OLD | NEW |