| 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 19 matching lines...) Expand all Loading... |
| 30 EXPECT_FALSE(broadcaster.frame_wanted()); | 30 EXPECT_FALSE(broadcaster.frame_wanted()); |
| 31 } | 31 } |
| 32 | 32 |
| 33 TEST(VideoBroadcasterTest, OnFrame) { | 33 TEST(VideoBroadcasterTest, OnFrame) { |
| 34 VideoBroadcaster broadcaster; | 34 VideoBroadcaster broadcaster; |
| 35 | 35 |
| 36 FakeVideoRenderer sink1; | 36 FakeVideoRenderer sink1; |
| 37 FakeVideoRenderer sink2; | 37 FakeVideoRenderer sink2; |
| 38 broadcaster.AddOrUpdateSink(&sink1, rtc::VideoSinkWants()); | 38 broadcaster.AddOrUpdateSink(&sink1, rtc::VideoSinkWants()); |
| 39 broadcaster.AddOrUpdateSink(&sink2, rtc::VideoSinkWants()); | 39 broadcaster.AddOrUpdateSink(&sink2, rtc::VideoSinkWants()); |
| 40 static int kWidth = 100; |
| 41 static int kHeight = 50; |
| 40 | 42 |
| 41 webrtc::VideoFrame frame; | 43 webrtc::VideoFrame frame(webrtc::I420Buffer::Create(kWidth, kHeight), |
| 44 webrtc::kVideoRotation_0, 0); |
| 42 | 45 |
| 43 broadcaster.OnFrame(frame); | 46 broadcaster.OnFrame(frame); |
| 44 EXPECT_EQ(1, sink1.num_rendered_frames()); | 47 EXPECT_EQ(1, sink1.num_rendered_frames()); |
| 45 EXPECT_EQ(1, sink2.num_rendered_frames()); | 48 EXPECT_EQ(1, sink2.num_rendered_frames()); |
| 46 | 49 |
| 47 broadcaster.RemoveSink(&sink1); | 50 broadcaster.RemoveSink(&sink1); |
| 48 broadcaster.OnFrame(frame); | 51 broadcaster.OnFrame(frame); |
| 49 EXPECT_EQ(1, sink1.num_rendered_frames()); | 52 EXPECT_EQ(1, sink1.num_rendered_frames()); |
| 50 EXPECT_EQ(2, sink2.num_rendered_frames()); | 53 EXPECT_EQ(2, sink2.num_rendered_frames()); |
| 51 | 54 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 broadcaster.AddOrUpdateSink(&sink2, wants2); | 156 broadcaster.AddOrUpdateSink(&sink2, wants2); |
| 154 | 157 |
| 155 webrtc::VideoFrame frame2(buffer, webrtc::kVideoRotation_0, | 158 webrtc::VideoFrame frame2(buffer, webrtc::kVideoRotation_0, |
| 156 30 /* timestamp_us */); | 159 30 /* timestamp_us */); |
| 157 broadcaster.OnFrame(frame2); | 160 broadcaster.OnFrame(frame2); |
| 158 EXPECT_FALSE(sink1.black_frame()); | 161 EXPECT_FALSE(sink1.black_frame()); |
| 159 EXPECT_EQ(30, sink1.timestamp_us()); | 162 EXPECT_EQ(30, sink1.timestamp_us()); |
| 160 EXPECT_TRUE(sink2.black_frame()); | 163 EXPECT_TRUE(sink2.black_frame()); |
| 161 EXPECT_EQ(30, sink2.timestamp_us()); | 164 EXPECT_EQ(30, sink2.timestamp_us()); |
| 162 } | 165 } |
| OLD | NEW |