| 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 28 matching lines...) Expand all Loading... |
| 39 broadcaster.AddOrUpdateSink(&sink1, rtc::VideoSinkWants()); | 39 broadcaster.AddOrUpdateSink(&sink1, rtc::VideoSinkWants()); |
| 40 broadcaster.AddOrUpdateSink(&sink2, rtc::VideoSinkWants()); | 40 broadcaster.AddOrUpdateSink(&sink2, rtc::VideoSinkWants()); |
| 41 static int kWidth = 100; | 41 static int kWidth = 100; |
| 42 static int kHeight = 50; | 42 static int kHeight = 50; |
| 43 | 43 |
| 44 rtc::scoped_refptr<webrtc::I420Buffer> buffer( | 44 rtc::scoped_refptr<webrtc::I420Buffer> buffer( |
| 45 webrtc::I420Buffer::Create(kWidth, kHeight)); | 45 webrtc::I420Buffer::Create(kWidth, kHeight)); |
| 46 // Initialize, to avoid warnings on use of initialized values. | 46 // Initialize, to avoid warnings on use of initialized values. |
| 47 webrtc::I420Buffer::SetBlack(buffer); | 47 webrtc::I420Buffer::SetBlack(buffer); |
| 48 | 48 |
| 49 webrtc::VideoFrame frame(buffer, webrtc::kVideoRotation_0, 0); | 49 webrtc::VideoFrame frame(buffer, webrtc::kVideoRotation_0, |
| 50 webrtc::kVideoContent_Default, 0); |
| 50 | 51 |
| 51 broadcaster.OnFrame(frame); | 52 broadcaster.OnFrame(frame); |
| 52 EXPECT_EQ(1, sink1.num_rendered_frames()); | 53 EXPECT_EQ(1, sink1.num_rendered_frames()); |
| 53 EXPECT_EQ(1, sink2.num_rendered_frames()); | 54 EXPECT_EQ(1, sink2.num_rendered_frames()); |
| 54 | 55 |
| 55 broadcaster.RemoveSink(&sink1); | 56 broadcaster.RemoveSink(&sink1); |
| 56 broadcaster.OnFrame(frame); | 57 broadcaster.OnFrame(frame); |
| 57 EXPECT_EQ(1, sink1.num_rendered_frames()); | 58 EXPECT_EQ(1, sink1.num_rendered_frames()); |
| 58 EXPECT_EQ(2, sink2.num_rendered_frames()); | 59 EXPECT_EQ(2, sink2.num_rendered_frames()); |
| 59 | 60 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 VideoSinkWants wants2; | 141 VideoSinkWants wants2; |
| 141 wants2.black_frames = false; | 142 wants2.black_frames = false; |
| 142 broadcaster.AddOrUpdateSink(&sink2, wants2); | 143 broadcaster.AddOrUpdateSink(&sink2, wants2); |
| 143 | 144 |
| 144 rtc::scoped_refptr<webrtc::I420Buffer> buffer( | 145 rtc::scoped_refptr<webrtc::I420Buffer> buffer( |
| 145 webrtc::I420Buffer::Create(100, 200)); | 146 webrtc::I420Buffer::Create(100, 200)); |
| 146 // Makes it not all black. | 147 // Makes it not all black. |
| 147 buffer->InitializeData(); | 148 buffer->InitializeData(); |
| 148 | 149 |
| 149 webrtc::VideoFrame frame1(buffer, webrtc::kVideoRotation_0, | 150 webrtc::VideoFrame frame1(buffer, webrtc::kVideoRotation_0, |
| 151 webrtc::kVideoContent_Default, |
| 150 10 /* timestamp_us */); | 152 10 /* timestamp_us */); |
| 151 broadcaster.OnFrame(frame1); | 153 broadcaster.OnFrame(frame1); |
| 152 EXPECT_TRUE(sink1.black_frame()); | 154 EXPECT_TRUE(sink1.black_frame()); |
| 153 EXPECT_EQ(10, sink1.timestamp_us()); | 155 EXPECT_EQ(10, sink1.timestamp_us()); |
| 154 EXPECT_FALSE(sink2.black_frame()); | 156 EXPECT_FALSE(sink2.black_frame()); |
| 155 EXPECT_EQ(10, sink2.timestamp_us()); | 157 EXPECT_EQ(10, sink2.timestamp_us()); |
| 156 | 158 |
| 157 // Switch the sink wants. | 159 // Switch the sink wants. |
| 158 wants1.black_frames = false; | 160 wants1.black_frames = false; |
| 159 broadcaster.AddOrUpdateSink(&sink1, wants1); | 161 broadcaster.AddOrUpdateSink(&sink1, wants1); |
| 160 wants2.black_frames = true; | 162 wants2.black_frames = true; |
| 161 broadcaster.AddOrUpdateSink(&sink2, wants2); | 163 broadcaster.AddOrUpdateSink(&sink2, wants2); |
| 162 | 164 |
| 163 webrtc::VideoFrame frame2(buffer, webrtc::kVideoRotation_0, | 165 webrtc::VideoFrame frame2(buffer, webrtc::kVideoRotation_0, |
| 166 webrtc::kVideoContent_Default, |
| 164 30 /* timestamp_us */); | 167 30 /* timestamp_us */); |
| 165 broadcaster.OnFrame(frame2); | 168 broadcaster.OnFrame(frame2); |
| 166 EXPECT_FALSE(sink1.black_frame()); | 169 EXPECT_FALSE(sink1.black_frame()); |
| 167 EXPECT_EQ(30, sink1.timestamp_us()); | 170 EXPECT_EQ(30, sink1.timestamp_us()); |
| 168 EXPECT_TRUE(sink2.black_frame()); | 171 EXPECT_TRUE(sink2.black_frame()); |
| 169 EXPECT_EQ(30, sink2.timestamp_us()); | 172 EXPECT_EQ(30, sink2.timestamp_us()); |
| 170 } | 173 } |
| OLD | NEW |