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 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3185 CreateSendConfig(1, 0, 0, &transport); | 3185 CreateSendConfig(1, 0, 0, &transport); |
3186 video_send_config_.rtp.extensions.clear(); | 3186 video_send_config_.rtp.extensions.clear(); |
3187 if (support_orientation_ext) { | 3187 if (support_orientation_ext) { |
3188 video_send_config_.rtp.extensions.push_back( | 3188 video_send_config_.rtp.extensions.push_back( |
3189 RtpExtension(RtpExtension::kVideoRotationUri, 1)); | 3189 RtpExtension(RtpExtension::kVideoRotationUri, 1)); |
3190 } | 3190 } |
3191 | 3191 |
3192 CreateVideoStreams(); | 3192 CreateVideoStreams(); |
3193 test::FrameForwarder forwarder; | 3193 test::FrameForwarder forwarder; |
3194 video_send_stream_->SetSource( | 3194 video_send_stream_->SetSource( |
3195 &forwarder, VideoSendStream::DegradationPreference::kBalanced); | 3195 &forwarder, VideoSendStream::DegradationPreference::kMaintainFramerate); |
3196 | 3196 |
3197 EXPECT_TRUE(forwarder.sink_wants().rotation_applied != | 3197 EXPECT_TRUE(forwarder.sink_wants().rotation_applied != |
3198 support_orientation_ext); | 3198 support_orientation_ext); |
3199 | 3199 |
3200 DestroyStreams(); | 3200 DestroyStreams(); |
3201 } | 3201 } |
3202 | 3202 |
3203 TEST_F(VideoSendStreamTest, | 3203 TEST_F(VideoSendStreamTest, |
3204 RequestSourceRotateIfVideoOrientationExtensionNotSupported) { | 3204 RequestSourceRotateIfVideoOrientationExtensionNotSupported) { |
3205 TestRequestSourceRotateVideo(false); | 3205 TestRequestSourceRotateVideo(false); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3284 rtc::CriticalSection crit_; | 3284 rtc::CriticalSection crit_; |
3285 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_); | 3285 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_); |
3286 bool first_packet_sent_ GUARDED_BY(&crit_); | 3286 bool first_packet_sent_ GUARDED_BY(&crit_); |
3287 rtc::Event bitrate_changed_event_; | 3287 rtc::Event bitrate_changed_event_; |
3288 } test; | 3288 } test; |
3289 | 3289 |
3290 RunBaseTest(&test); | 3290 RunBaseTest(&test); |
3291 } | 3291 } |
3292 | 3292 |
3293 } // namespace webrtc | 3293 } // namespace webrtc |
OLD | NEW |