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