OLD | NEW |
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 FakeVideoRenderer sink2; | 99 FakeVideoRenderer sink2; |
100 VideoSinkWants wants2; | 100 VideoSinkWants wants2; |
101 wants2.max_pixel_count = rtc::Optional<int>(640 * 360); | 101 wants2.max_pixel_count = rtc::Optional<int>(640 * 360); |
102 broadcaster.AddOrUpdateSink(&sink2, wants2); | 102 broadcaster.AddOrUpdateSink(&sink2, wants2); |
103 EXPECT_EQ(640 * 360, *broadcaster.wants().max_pixel_count); | 103 EXPECT_EQ(640 * 360, *broadcaster.wants().max_pixel_count); |
104 | 104 |
105 broadcaster.RemoveSink(&sink2); | 105 broadcaster.RemoveSink(&sink2); |
106 EXPECT_EQ(1280 * 720, *broadcaster.wants().max_pixel_count); | 106 EXPECT_EQ(1280 * 720, *broadcaster.wants().max_pixel_count); |
107 } | 107 } |
108 | 108 |
109 TEST(VideoBroadcasterTest, AppliesMinOfSinkWantsMaxPixelCountStepUp) { | 109 TEST(VideoBroadcasterTest, AppliesMinOfSinkWantsMaxAndTargetPixelCount) { |
110 VideoBroadcaster broadcaster; | 110 VideoBroadcaster broadcaster; |
111 EXPECT_TRUE(!broadcaster.wants().max_pixel_count_step_up); | 111 EXPECT_TRUE(!broadcaster.wants().target_pixel_count); |
112 | 112 |
113 FakeVideoRenderer sink1; | 113 FakeVideoRenderer sink1; |
114 VideoSinkWants wants1; | 114 VideoSinkWants wants1; |
115 wants1.max_pixel_count_step_up = rtc::Optional<int>(1280 * 720); | 115 wants1.target_pixel_count = rtc::Optional<int>(1280 * 720); |
116 | 116 |
117 broadcaster.AddOrUpdateSink(&sink1, wants1); | 117 broadcaster.AddOrUpdateSink(&sink1, wants1); |
118 EXPECT_EQ(1280 * 720, *broadcaster.wants().max_pixel_count_step_up); | 118 EXPECT_EQ(1280 * 720, *broadcaster.wants().target_pixel_count); |
119 | 119 |
120 FakeVideoRenderer sink2; | 120 FakeVideoRenderer sink2; |
121 VideoSinkWants wants2; | 121 VideoSinkWants wants2; |
122 wants2.max_pixel_count_step_up = 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().max_pixel_count_step_up); | 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().max_pixel_count_step_up); | 127 EXPECT_EQ(1280 * 720, *broadcaster.wants().target_pixel_count); |
128 } | 128 } |
129 | 129 |
130 TEST(VideoBroadcasterTest, SinkWantsBlackFrames) { | 130 TEST(VideoBroadcasterTest, SinkWantsBlackFrames) { |
131 VideoBroadcaster broadcaster; | 131 VideoBroadcaster broadcaster; |
132 EXPECT_TRUE(!broadcaster.wants().black_frames); | 132 EXPECT_TRUE(!broadcaster.wants().black_frames); |
133 | 133 |
134 FakeVideoRenderer sink1; | 134 FakeVideoRenderer sink1; |
135 VideoSinkWants wants1; | 135 VideoSinkWants wants1; |
136 wants1.black_frames = true; | 136 wants1.black_frames = true; |
137 broadcaster.AddOrUpdateSink(&sink1, wants1); | 137 broadcaster.AddOrUpdateSink(&sink1, wants1); |
(...skipping 23 matching lines...) Expand all Loading... |
161 broadcaster.AddOrUpdateSink(&sink2, wants2); | 161 broadcaster.AddOrUpdateSink(&sink2, wants2); |
162 | 162 |
163 webrtc::VideoFrame frame2(buffer, webrtc::kVideoRotation_0, | 163 webrtc::VideoFrame frame2(buffer, webrtc::kVideoRotation_0, |
164 30 /* timestamp_us */); | 164 30 /* timestamp_us */); |
165 broadcaster.OnFrame(frame2); | 165 broadcaster.OnFrame(frame2); |
166 EXPECT_FALSE(sink1.black_frame()); | 166 EXPECT_FALSE(sink1.black_frame()); |
167 EXPECT_EQ(30, sink1.timestamp_us()); | 167 EXPECT_EQ(30, sink1.timestamp_us()); |
168 EXPECT_TRUE(sink2.black_frame()); | 168 EXPECT_TRUE(sink2.black_frame()); |
169 EXPECT_EQ(30, sink2.timestamp_us()); | 169 EXPECT_EQ(30, sink2.timestamp_us()); |
170 } | 170 } |
OLD | NEW |