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

Side by Side Diff: webrtc/media/base/videobroadcaster_unittest.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 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2016 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 10
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 FakeVideoRenderer sink2; 120 FakeVideoRenderer sink2;
121 VideoSinkWants wants2; 121 VideoSinkWants wants2;
122 wants2.target_pixel_count = rtc::Optional<int>(640 * 360); 122 wants2.target_pixel_count = rtc::Optional<int>(640 * 360);
123 broadcaster.AddOrUpdateSink(&sink2, wants2); 123 broadcaster.AddOrUpdateSink(&sink2, wants2);
124 EXPECT_EQ(640 * 360, *broadcaster.wants().target_pixel_count); 124 EXPECT_EQ(640 * 360, *broadcaster.wants().target_pixel_count);
125 125
126 broadcaster.RemoveSink(&sink2); 126 broadcaster.RemoveSink(&sink2);
127 EXPECT_EQ(1280 * 720, *broadcaster.wants().target_pixel_count); 127 EXPECT_EQ(1280 * 720, *broadcaster.wants().target_pixel_count);
128 } 128 }
129 129
130 TEST(VideoBroadcasterTest, AppliesMinOfSinkWantsMaxFramerate) {
131 VideoBroadcaster broadcaster;
132 EXPECT_FALSE(broadcaster.wants().max_framerate_fps);
133
134 FakeVideoRenderer sink1;
135 VideoSinkWants wants1;
136 wants1.max_framerate_fps.emplace(30);
137
138 broadcaster.AddOrUpdateSink(&sink1, wants1);
139 EXPECT_EQ(30, *broadcaster.wants().max_framerate_fps);
140
141 FakeVideoRenderer sink2;
142 VideoSinkWants wants2;
143 wants2.max_framerate_fps.emplace(15);
144 broadcaster.AddOrUpdateSink(&sink2, wants2);
145 EXPECT_EQ(15, *broadcaster.wants().max_framerate_fps);
146
147 broadcaster.RemoveSink(&sink2);
148 EXPECT_EQ(30, *broadcaster.wants().max_framerate_fps);
149 }
150
130 TEST(VideoBroadcasterTest, SinkWantsBlackFrames) { 151 TEST(VideoBroadcasterTest, SinkWantsBlackFrames) {
131 VideoBroadcaster broadcaster; 152 VideoBroadcaster broadcaster;
132 EXPECT_TRUE(!broadcaster.wants().black_frames); 153 EXPECT_TRUE(!broadcaster.wants().black_frames);
133 154
134 FakeVideoRenderer sink1; 155 FakeVideoRenderer sink1;
135 VideoSinkWants wants1; 156 VideoSinkWants wants1;
136 wants1.black_frames = true; 157 wants1.black_frames = true;
137 broadcaster.AddOrUpdateSink(&sink1, wants1); 158 broadcaster.AddOrUpdateSink(&sink1, wants1);
138 159
139 FakeVideoRenderer sink2; 160 FakeVideoRenderer sink2;
(...skipping 21 matching lines...) Expand all
161 broadcaster.AddOrUpdateSink(&sink2, wants2); 182 broadcaster.AddOrUpdateSink(&sink2, wants2);
162 183
163 webrtc::VideoFrame frame2(buffer, webrtc::kVideoRotation_0, 184 webrtc::VideoFrame frame2(buffer, webrtc::kVideoRotation_0,
164 30 /* timestamp_us */); 185 30 /* timestamp_us */);
165 broadcaster.OnFrame(frame2); 186 broadcaster.OnFrame(frame2);
166 EXPECT_FALSE(sink1.black_frame()); 187 EXPECT_FALSE(sink1.black_frame());
167 EXPECT_EQ(30, sink1.timestamp_us()); 188 EXPECT_EQ(30, sink1.timestamp_us());
168 EXPECT_TRUE(sink2.black_frame()); 189 EXPECT_TRUE(sink2.black_frame());
169 EXPECT_EQ(30, sink2.timestamp_us()); 190 EXPECT_EQ(30, sink2.timestamp_us());
170 } 191 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698