OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 EXPECT_TRUE(channel_->SetSink(kSsrc, &renderer_)); | 553 EXPECT_TRUE(channel_->SetSink(kSsrc, &renderer_)); |
554 EXPECT_TRUE(SetSend(true)); | 554 EXPECT_TRUE(SetSend(true)); |
555 EXPECT_TRUE(SendFrame()); | 555 EXPECT_TRUE(SendFrame()); |
556 EXPECT_TRUE_WAIT(NumRtpPackets() > 0, kTimeout); | 556 EXPECT_TRUE_WAIT(NumRtpPackets() > 0, kTimeout); |
557 EXPECT_FRAME_WAIT(1, DefaultCodec().width, DefaultCodec().height, kTimeout); | 557 EXPECT_FRAME_WAIT(1, DefaultCodec().width, DefaultCodec().height, kTimeout); |
558 | 558 |
559 // Add an additional capturer, and hook up a renderer to receive it. | 559 // Add an additional capturer, and hook up a renderer to receive it. |
560 cricket::FakeVideoRenderer renderer2; | 560 cricket::FakeVideoRenderer renderer2; |
561 std::unique_ptr<cricket::FakeVideoCapturer> capturer( | 561 std::unique_ptr<cricket::FakeVideoCapturer> capturer( |
562 CreateFakeVideoCapturer()); | 562 CreateFakeVideoCapturer()); |
563 capturer->SetScreencast(true); | |
564 const int kTestWidth = 160; | 563 const int kTestWidth = 160; |
565 const int kTestHeight = 120; | 564 const int kTestHeight = 120; |
566 cricket::VideoFormat format(kTestWidth, kTestHeight, | 565 cricket::VideoFormat format(kTestWidth, kTestHeight, |
567 cricket::VideoFormat::FpsToInterval(5), | 566 cricket::VideoFormat::FpsToInterval(5), |
568 cricket::FOURCC_I420); | 567 cricket::FOURCC_I420); |
569 EXPECT_EQ(cricket::CS_RUNNING, capturer->Start(format)); | 568 EXPECT_EQ(cricket::CS_RUNNING, capturer->Start(format)); |
570 EXPECT_TRUE(channel_->AddSendStream( | 569 EXPECT_TRUE(channel_->AddSendStream( |
571 cricket::StreamParams::CreateLegacy(5678))); | 570 cricket::StreamParams::CreateLegacy(5678))); |
572 EXPECT_TRUE(channel_->SetCapturer(5678, capturer.get())); | 571 EXPECT_TRUE(channel_->SetCapturer(5678, capturer.get())); |
573 EXPECT_TRUE(channel_->AddRecvStream( | 572 EXPECT_TRUE(channel_->AddRecvStream( |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 codec.height = 240; | 763 codec.height = 240; |
765 const int time_between_send = TimeBetweenSend(codec); | 764 const int time_between_send = TimeBetweenSend(codec); |
766 EXPECT_TRUE(SetOneCodec(codec)); | 765 EXPECT_TRUE(SetOneCodec(codec)); |
767 EXPECT_TRUE(SetSend(true)); | 766 EXPECT_TRUE(SetSend(true)); |
768 EXPECT_TRUE(channel_->SetSink(kDefaultReceiveSsrc, &renderer_)); | 767 EXPECT_TRUE(channel_->SetSink(kDefaultReceiveSsrc, &renderer_)); |
769 EXPECT_EQ(0, renderer_.num_rendered_frames()); | 768 EXPECT_EQ(0, renderer_.num_rendered_frames()); |
770 EXPECT_TRUE(SendFrame()); | 769 EXPECT_TRUE(SendFrame()); |
771 EXPECT_FRAME_WAIT(1, codec.width, codec.height, kTimeout); | 770 EXPECT_FRAME_WAIT(1, codec.width, codec.height, kTimeout); |
772 std::unique_ptr<cricket::FakeVideoCapturer> capturer( | 771 std::unique_ptr<cricket::FakeVideoCapturer> capturer( |
773 CreateFakeVideoCapturer()); | 772 CreateFakeVideoCapturer()); |
774 capturer->SetScreencast(true); | 773 |
| 774 // TODO(nisse): This testcase fails if we don't configure |
| 775 // screencast. It's unclear why, I see nothing obvious in this |
| 776 // test which is related to screencast logic. |
| 777 cricket::VideoOptions video_options; |
| 778 video_options.is_screencast = rtc::Optional<bool>(true); |
| 779 channel_->SetVideoSend(kSsrc, true, &video_options); |
| 780 |
775 cricket::VideoFormat format(480, 360, | 781 cricket::VideoFormat format(480, 360, |
776 cricket::VideoFormat::FpsToInterval(30), | 782 cricket::VideoFormat::FpsToInterval(30), |
777 cricket::FOURCC_I420); | 783 cricket::FOURCC_I420); |
778 EXPECT_EQ(cricket::CS_RUNNING, capturer->Start(format)); | 784 EXPECT_EQ(cricket::CS_RUNNING, capturer->Start(format)); |
779 // All capturers start generating frames with the same timestamp. ViE does | 785 // All capturers start generating frames with the same timestamp. ViE does |
780 // not allow the same timestamp to be used. Capture one frame before | 786 // not allow the same timestamp to be used. Capture one frame before |
781 // associating the capturer with the channel. | 787 // associating the capturer with the channel. |
782 EXPECT_TRUE(capturer->CaptureCustomFrame(format.width, format.height, | 788 EXPECT_TRUE(capturer->CaptureCustomFrame(format.width, format.height, |
783 cricket::FOURCC_I420)); | 789 cricket::FOURCC_I420)); |
784 | 790 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 // Set up additional stream 1. | 867 // Set up additional stream 1. |
862 cricket::FakeVideoRenderer renderer1; | 868 cricket::FakeVideoRenderer renderer1; |
863 EXPECT_FALSE(channel_->SetSink(1, &renderer1)); | 869 EXPECT_FALSE(channel_->SetSink(1, &renderer1)); |
864 EXPECT_TRUE(channel_->AddRecvStream( | 870 EXPECT_TRUE(channel_->AddRecvStream( |
865 cricket::StreamParams::CreateLegacy(1))); | 871 cricket::StreamParams::CreateLegacy(1))); |
866 EXPECT_TRUE(channel_->SetSink(1, &renderer1)); | 872 EXPECT_TRUE(channel_->SetSink(1, &renderer1)); |
867 EXPECT_TRUE(channel_->AddSendStream( | 873 EXPECT_TRUE(channel_->AddSendStream( |
868 cricket::StreamParams::CreateLegacy(1))); | 874 cricket::StreamParams::CreateLegacy(1))); |
869 std::unique_ptr<cricket::FakeVideoCapturer> capturer1( | 875 std::unique_ptr<cricket::FakeVideoCapturer> capturer1( |
870 CreateFakeVideoCapturer()); | 876 CreateFakeVideoCapturer()); |
871 capturer1->SetScreencast(true); | |
872 EXPECT_EQ(cricket::CS_RUNNING, capturer1->Start(capture_format)); | 877 EXPECT_EQ(cricket::CS_RUNNING, capturer1->Start(capture_format)); |
873 // Set up additional stream 2. | 878 // Set up additional stream 2. |
874 cricket::FakeVideoRenderer renderer2; | 879 cricket::FakeVideoRenderer renderer2; |
875 EXPECT_FALSE(channel_->SetSink(2, &renderer2)); | 880 EXPECT_FALSE(channel_->SetSink(2, &renderer2)); |
876 EXPECT_TRUE(channel_->AddRecvStream( | 881 EXPECT_TRUE(channel_->AddRecvStream( |
877 cricket::StreamParams::CreateLegacy(2))); | 882 cricket::StreamParams::CreateLegacy(2))); |
878 EXPECT_TRUE(channel_->SetSink(2, &renderer2)); | 883 EXPECT_TRUE(channel_->SetSink(2, &renderer2)); |
879 EXPECT_TRUE(channel_->AddSendStream( | 884 EXPECT_TRUE(channel_->AddSendStream( |
880 cricket::StreamParams::CreateLegacy(2))); | 885 cricket::StreamParams::CreateLegacy(2))); |
881 std::unique_ptr<cricket::FakeVideoCapturer> capturer2( | 886 std::unique_ptr<cricket::FakeVideoCapturer> capturer2( |
882 CreateFakeVideoCapturer()); | 887 CreateFakeVideoCapturer()); |
883 capturer2->SetScreencast(true); | |
884 EXPECT_EQ(cricket::CS_RUNNING, capturer2->Start(capture_format)); | 888 EXPECT_EQ(cricket::CS_RUNNING, capturer2->Start(capture_format)); |
885 // State for all the streams. | 889 // State for all the streams. |
886 EXPECT_TRUE(SetOneCodec(DefaultCodec())); | 890 EXPECT_TRUE(SetOneCodec(DefaultCodec())); |
887 // A limitation in the lmi implementation requires that SetCapturer() is | 891 // A limitation in the lmi implementation requires that SetCapturer() is |
888 // called after SetOneCodec(). | 892 // called after SetOneCodec(). |
889 // TODO(hellner): this seems like an unnecessary constraint, fix it. | 893 // TODO(hellner): this seems like an unnecessary constraint, fix it. |
890 EXPECT_TRUE(channel_->SetCapturer(1, capturer1.get())); | 894 EXPECT_TRUE(channel_->SetCapturer(1, capturer1.get())); |
891 EXPECT_TRUE(channel_->SetCapturer(2, capturer2.get())); | 895 EXPECT_TRUE(channel_->SetCapturer(2, capturer2.get())); |
892 EXPECT_TRUE(SetSend(true)); | 896 EXPECT_TRUE(SetSend(true)); |
893 // Test capturer associated with engine. | 897 // Test capturer associated with engine. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 EXPECT_EQ(0, renderer.num_rendered_frames()); | 933 EXPECT_EQ(0, renderer.num_rendered_frames()); |
930 | 934 |
931 EXPECT_TRUE(SendFrame()); | 935 EXPECT_TRUE(SendFrame()); |
932 EXPECT_GT_FRAME_ON_RENDERER_WAIT( | 936 EXPECT_GT_FRAME_ON_RENDERER_WAIT( |
933 renderer, 1, codec.width, codec.height, kTimeout); | 937 renderer, 1, codec.width, codec.height, kTimeout); |
934 | 938 |
935 // Registering an external capturer is currently the same as screen casting | 939 // Registering an external capturer is currently the same as screen casting |
936 // (update the test when this changes). | 940 // (update the test when this changes). |
937 std::unique_ptr<cricket::FakeVideoCapturer> capturer( | 941 std::unique_ptr<cricket::FakeVideoCapturer> capturer( |
938 CreateFakeVideoCapturer()); | 942 CreateFakeVideoCapturer()); |
939 capturer->SetScreencast(true); | |
940 const std::vector<cricket::VideoFormat>* formats = | 943 const std::vector<cricket::VideoFormat>* formats = |
941 capturer->GetSupportedFormats(); | 944 capturer->GetSupportedFormats(); |
942 cricket::VideoFormat capture_format = (*formats)[0]; | 945 cricket::VideoFormat capture_format = (*formats)[0]; |
943 EXPECT_EQ(cricket::CS_RUNNING, capturer->Start(capture_format)); | 946 EXPECT_EQ(cricket::CS_RUNNING, capturer->Start(capture_format)); |
944 // Capture frame to not get same frame timestamps as previous capturer. | 947 // Capture frame to not get same frame timestamps as previous capturer. |
945 capturer->CaptureFrame(); | 948 capturer->CaptureFrame(); |
946 EXPECT_TRUE(channel_->SetCapturer(kSsrc, capturer.get())); | 949 EXPECT_TRUE(channel_->SetCapturer(kSsrc, capturer.get())); |
947 EXPECT_TRUE(rtc::Thread::Current()->ProcessMessages(30)); | 950 EXPECT_TRUE(rtc::Thread::Current()->ProcessMessages(30)); |
948 EXPECT_TRUE(capturer->CaptureCustomFrame(kWidth, kHeight, | 951 EXPECT_TRUE(capturer->CaptureCustomFrame(kWidth, kHeight, |
949 cricket::FOURCC_ARGB)); | 952 cricket::FOURCC_ARGB)); |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 std::unique_ptr<C> channel_; | 1186 std::unique_ptr<C> channel_; |
1184 cricket::FakeNetworkInterface network_interface_; | 1187 cricket::FakeNetworkInterface network_interface_; |
1185 cricket::FakeVideoRenderer renderer_; | 1188 cricket::FakeVideoRenderer renderer_; |
1186 cricket::VideoMediaChannel::Error media_error_; | 1189 cricket::VideoMediaChannel::Error media_error_; |
1187 | 1190 |
1188 // Used by test cases where 2 streams are run on the same channel. | 1191 // Used by test cases where 2 streams are run on the same channel. |
1189 cricket::FakeVideoRenderer renderer2_; | 1192 cricket::FakeVideoRenderer renderer2_; |
1190 }; | 1193 }; |
1191 | 1194 |
1192 #endif // WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT | 1195 #endif // WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT |
OLD | NEW |