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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 EXPECT_TRUE(SetSend(true)); | 823 EXPECT_TRUE(SetSend(true)); |
824 EXPECT_TRUE(channel_->SetSink(kDefaultReceiveSsrc, &renderer_)); | 824 EXPECT_TRUE(channel_->SetSink(kDefaultReceiveSsrc, &renderer_)); |
825 EXPECT_EQ(0, renderer_.num_rendered_frames()); | 825 EXPECT_EQ(0, renderer_.num_rendered_frames()); |
826 EXPECT_TRUE(SendFrame()); | 826 EXPECT_TRUE(SendFrame()); |
827 EXPECT_FRAME_WAIT(1, kVideoWidth, kVideoHeight, kTimeout); | 827 EXPECT_FRAME_WAIT(1, kVideoWidth, kVideoHeight, kTimeout); |
828 // Wait for one frame so they don't get dropped because we send frames too | 828 // Wait for one frame so they don't get dropped because we send frames too |
829 // tightly. | 829 // tightly. |
830 rtc::Thread::Current()->ProcessMessages(30); | 830 rtc::Thread::Current()->ProcessMessages(30); |
831 // Remove the capturer. | 831 // Remove the capturer. |
832 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, nullptr)); | 832 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, nullptr)); |
833 // Wait for one black frame for removing the capturer. | |
834 EXPECT_FRAME_WAIT(2, kVideoWidth, kVideoHeight, kTimeout); | |
835 | 833 |
836 // No capturer was added, so this SetVideoSend shouldn't do anything. | 834 // No capturer was added, so this SetVideoSend shouldn't do anything. |
837 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, nullptr)); | 835 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, nullptr)); |
838 rtc::Thread::Current()->ProcessMessages(300); | 836 rtc::Thread::Current()->ProcessMessages(300); |
839 // Verify no more frames were sent. | 837 // Verify no more frames were sent. |
840 EXPECT_EQ(2, renderer_.num_rendered_frames()); | 838 EXPECT_EQ(1, renderer_.num_rendered_frames()); |
841 } | 839 } |
842 | 840 |
843 // Tests that we can add and remove capturer as unique sources. | 841 // Tests that we can add and remove capturer as unique sources. |
844 void AddRemoveCapturerMultipleSources() { | 842 void AddRemoveCapturerMultipleSources() { |
845 // WebRTC implementation will drop frames if pushed to quickly. Wait the | 843 // WebRTC implementation will drop frames if pushed to quickly. Wait the |
846 // interval time to avoid that. | 844 // interval time to avoid that. |
847 // WebRTC implementation will drop frames if pushed to quickly. Wait the | 845 // WebRTC implementation will drop frames if pushed to quickly. Wait the |
848 // interval time to avoid that. | 846 // interval time to avoid that. |
849 // Set up the stream associated with the engine. | 847 // Set up the stream associated with the engine. |
850 EXPECT_TRUE(channel_->AddRecvStream( | 848 EXPECT_TRUE(channel_->AddRecvStream( |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 std::unique_ptr<C> channel_; | 938 std::unique_ptr<C> channel_; |
941 cricket::FakeNetworkInterface network_interface_; | 939 cricket::FakeNetworkInterface network_interface_; |
942 cricket::FakeVideoRenderer renderer_; | 940 cricket::FakeVideoRenderer renderer_; |
943 cricket::VideoMediaChannel::Error media_error_; | 941 cricket::VideoMediaChannel::Error media_error_; |
944 | 942 |
945 // Used by test cases where 2 streams are run on the same channel. | 943 // Used by test cases where 2 streams are run on the same channel. |
946 cricket::FakeVideoRenderer renderer2_; | 944 cricket::FakeVideoRenderer renderer2_; |
947 }; | 945 }; |
948 | 946 |
949 #endif // WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT | 947 #endif // WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT |
OLD | NEW |