Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: webrtc/video/video_send_stream_tests.cc

Issue 2716643002: Add framerate to VideoSinkWants and ability to signal on overuse (Closed)
Patch Set: windows warning Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after
1931 input_frames.push_back(test::FakeNativeHandle::CreateFrame( 1931 input_frames.push_back(test::FakeNativeHandle::CreateFrame(
1932 handle2, width, height, 2, 2, kVideoRotation_0)); 1932 handle2, width, height, 2, 2, kVideoRotation_0));
1933 input_frames.push_back(CreateVideoFrame(width, height, 3)); 1933 input_frames.push_back(CreateVideoFrame(width, height, 3));
1934 input_frames.push_back(CreateVideoFrame(width, height, 4)); 1934 input_frames.push_back(CreateVideoFrame(width, height, 4));
1935 input_frames.push_back(test::FakeNativeHandle::CreateFrame( 1935 input_frames.push_back(test::FakeNativeHandle::CreateFrame(
1936 handle3, width, height, 5, 5, kVideoRotation_0)); 1936 handle3, width, height, 5, 5, kVideoRotation_0));
1937 1937
1938 video_send_stream_->Start(); 1938 video_send_stream_->Start();
1939 test::FrameForwarder forwarder; 1939 test::FrameForwarder forwarder;
1940 video_send_stream_->SetSource( 1940 video_send_stream_->SetSource(
1941 &forwarder, VideoSendStream::DegradationPreference::kBalanced); 1941 &forwarder, VideoSendStream::DegradationPreference::kMaintainFramerate);
1942 for (size_t i = 0; i < input_frames.size(); i++) { 1942 for (size_t i = 0; i < input_frames.size(); i++) {
1943 forwarder.IncomingCapturedFrame(input_frames[i]); 1943 forwarder.IncomingCapturedFrame(input_frames[i]);
1944 // Wait until the output frame is received before sending the next input 1944 // Wait until the output frame is received before sending the next input
1945 // frame. Or the previous input frame may be replaced without delivering. 1945 // frame. Or the previous input frame may be replaced without delivering.
1946 observer.WaitOutputFrame(); 1946 observer.WaitOutputFrame();
1947 } 1947 }
1948 video_send_stream_->Stop(); 1948 video_send_stream_->Stop();
1949 video_send_stream_->SetSource( 1949 video_send_stream_->SetSource(
1950 nullptr, VideoSendStream::DegradationPreference::kBalanced); 1950 nullptr, VideoSendStream::DegradationPreference::kMaintainFramerate);
1951 1951
1952 // Test if the input and output frames are the same. render_time_ms and 1952 // Test if the input and output frames are the same. render_time_ms and
1953 // timestamp are not compared because capturer sets those values. 1953 // timestamp are not compared because capturer sets those values.
1954 ExpectEqualFramesVector(input_frames, observer.output_frames()); 1954 ExpectEqualFramesVector(input_frames, observer.output_frames());
1955 1955
1956 DestroyStreams(); 1956 DestroyStreams();
1957 } 1957 }
1958 1958
1959 void ExpectEqualFramesVector(const std::vector<VideoFrame>& frames1, 1959 void ExpectEqualFramesVector(const std::vector<VideoFrame>& frames1,
1960 const std::vector<VideoFrame>& frames2) { 1960 const std::vector<VideoFrame>& frames2) {
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
3183 CreateSendConfig(1, 0, 0, &transport); 3183 CreateSendConfig(1, 0, 0, &transport);
3184 video_send_config_.rtp.extensions.clear(); 3184 video_send_config_.rtp.extensions.clear();
3185 if (support_orientation_ext) { 3185 if (support_orientation_ext) {
3186 video_send_config_.rtp.extensions.push_back( 3186 video_send_config_.rtp.extensions.push_back(
3187 RtpExtension(RtpExtension::kVideoRotationUri, 1)); 3187 RtpExtension(RtpExtension::kVideoRotationUri, 1));
3188 } 3188 }
3189 3189
3190 CreateVideoStreams(); 3190 CreateVideoStreams();
3191 test::FrameForwarder forwarder; 3191 test::FrameForwarder forwarder;
3192 video_send_stream_->SetSource( 3192 video_send_stream_->SetSource(
3193 &forwarder, VideoSendStream::DegradationPreference::kBalanced); 3193 &forwarder, VideoSendStream::DegradationPreference::kMaintainFramerate);
3194 3194
3195 EXPECT_TRUE(forwarder.sink_wants().rotation_applied != 3195 EXPECT_TRUE(forwarder.sink_wants().rotation_applied !=
3196 support_orientation_ext); 3196 support_orientation_ext);
3197 3197
3198 DestroyStreams(); 3198 DestroyStreams();
3199 } 3199 }
3200 3200
3201 TEST_F(VideoSendStreamTest, 3201 TEST_F(VideoSendStreamTest,
3202 RequestSourceRotateIfVideoOrientationExtensionNotSupported) { 3202 RequestSourceRotateIfVideoOrientationExtensionNotSupported) {
3203 TestRequestSourceRotateVideo(false); 3203 TestRequestSourceRotateVideo(false);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
3282 rtc::CriticalSection crit_; 3282 rtc::CriticalSection crit_;
3283 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_); 3283 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_);
3284 bool first_packet_sent_ GUARDED_BY(&crit_); 3284 bool first_packet_sent_ GUARDED_BY(&crit_);
3285 rtc::Event bitrate_changed_event_; 3285 rtc::Event bitrate_changed_event_;
3286 } test; 3286 } test;
3287 3287
3288 RunBaseTest(&test); 3288 RunBaseTest(&test);
3289 } 3289 }
3290 3290
3291 } // namespace webrtc 3291 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698