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 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1936 input_frames.push_back(test::FakeNativeHandle::CreateFrame( | 1936 input_frames.push_back(test::FakeNativeHandle::CreateFrame( |
1937 handle2, width, height, 2, 2, kVideoRotation_0)); | 1937 handle2, width, height, 2, 2, kVideoRotation_0)); |
1938 input_frames.push_back(CreateVideoFrame(width, height, 3)); | 1938 input_frames.push_back(CreateVideoFrame(width, height, 3)); |
1939 input_frames.push_back(CreateVideoFrame(width, height, 4)); | 1939 input_frames.push_back(CreateVideoFrame(width, height, 4)); |
1940 input_frames.push_back(test::FakeNativeHandle::CreateFrame( | 1940 input_frames.push_back(test::FakeNativeHandle::CreateFrame( |
1941 handle3, width, height, 5, 5, kVideoRotation_0)); | 1941 handle3, width, height, 5, 5, kVideoRotation_0)); |
1942 | 1942 |
1943 video_send_stream_->Start(); | 1943 video_send_stream_->Start(); |
1944 test::FrameForwarder forwarder; | 1944 test::FrameForwarder forwarder; |
1945 video_send_stream_->SetSource( | 1945 video_send_stream_->SetSource( |
1946 &forwarder, VideoSendStream::DegradationPreference::kBalanced); | 1946 &forwarder, VideoSendStream::DegradationPreference::kMaintainFramerate); |
1947 for (size_t i = 0; i < input_frames.size(); i++) { | 1947 for (size_t i = 0; i < input_frames.size(); i++) { |
1948 forwarder.IncomingCapturedFrame(input_frames[i]); | 1948 forwarder.IncomingCapturedFrame(input_frames[i]); |
1949 // Wait until the output frame is received before sending the next input | 1949 // Wait until the output frame is received before sending the next input |
1950 // frame. Or the previous input frame may be replaced without delivering. | 1950 // frame. Or the previous input frame may be replaced without delivering. |
1951 observer.WaitOutputFrame(); | 1951 observer.WaitOutputFrame(); |
1952 } | 1952 } |
1953 video_send_stream_->Stop(); | 1953 video_send_stream_->Stop(); |
1954 video_send_stream_->SetSource( | 1954 video_send_stream_->SetSource( |
1955 nullptr, VideoSendStream::DegradationPreference::kBalanced); | 1955 nullptr, VideoSendStream::DegradationPreference::kMaintainFramerate); |
1956 | 1956 |
1957 // Test if the input and output frames are the same. render_time_ms and | 1957 // Test if the input and output frames are the same. render_time_ms and |
1958 // timestamp are not compared because capturer sets those values. | 1958 // timestamp are not compared because capturer sets those values. |
1959 ExpectEqualFramesVector(input_frames, observer.output_frames()); | 1959 ExpectEqualFramesVector(input_frames, observer.output_frames()); |
1960 | 1960 |
1961 DestroyStreams(); | 1961 DestroyStreams(); |
1962 } | 1962 } |
1963 | 1963 |
1964 void ExpectEqualFramesVector(const std::vector<VideoFrame>& frames1, | 1964 void ExpectEqualFramesVector(const std::vector<VideoFrame>& frames1, |
1965 const std::vector<VideoFrame>& frames2) { | 1965 const std::vector<VideoFrame>& frames2) { |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3194 CreateSendConfig(1, 0, 0, &transport); | 3194 CreateSendConfig(1, 0, 0, &transport); |
3195 video_send_config_.rtp.extensions.clear(); | 3195 video_send_config_.rtp.extensions.clear(); |
3196 if (support_orientation_ext) { | 3196 if (support_orientation_ext) { |
3197 video_send_config_.rtp.extensions.push_back( | 3197 video_send_config_.rtp.extensions.push_back( |
3198 RtpExtension(RtpExtension::kVideoRotationUri, 1)); | 3198 RtpExtension(RtpExtension::kVideoRotationUri, 1)); |
3199 } | 3199 } |
3200 | 3200 |
3201 CreateVideoStreams(); | 3201 CreateVideoStreams(); |
3202 test::FrameForwarder forwarder; | 3202 test::FrameForwarder forwarder; |
3203 video_send_stream_->SetSource( | 3203 video_send_stream_->SetSource( |
3204 &forwarder, VideoSendStream::DegradationPreference::kBalanced); | 3204 &forwarder, VideoSendStream::DegradationPreference::kMaintainFramerate); |
3205 | 3205 |
3206 EXPECT_TRUE(forwarder.sink_wants().rotation_applied != | 3206 EXPECT_TRUE(forwarder.sink_wants().rotation_applied != |
3207 support_orientation_ext); | 3207 support_orientation_ext); |
3208 | 3208 |
3209 DestroyStreams(); | 3209 DestroyStreams(); |
3210 } | 3210 } |
3211 | 3211 |
3212 TEST_F(VideoSendStreamTest, | 3212 TEST_F(VideoSendStreamTest, |
3213 RequestSourceRotateIfVideoOrientationExtensionNotSupported) { | 3213 RequestSourceRotateIfVideoOrientationExtensionNotSupported) { |
3214 TestRequestSourceRotateVideo(false); | 3214 TestRequestSourceRotateVideo(false); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3293 rtc::CriticalSection crit_; | 3293 rtc::CriticalSection crit_; |
3294 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_); | 3294 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_); |
3295 bool first_packet_sent_ GUARDED_BY(&crit_); | 3295 bool first_packet_sent_ GUARDED_BY(&crit_); |
3296 rtc::Event bitrate_changed_event_; | 3296 rtc::Event bitrate_changed_event_; |
3297 } test; | 3297 } test; |
3298 | 3298 |
3299 RunBaseTest(&test); | 3299 RunBaseTest(&test); |
3300 } | 3300 } |
3301 | 3301 |
3302 } // namespace webrtc | 3302 } // namespace webrtc |
OLD | NEW |