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 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 EXPECT_TRUE(SetSend(true)); | 810 EXPECT_TRUE(SetSend(true)); |
811 EXPECT_TRUE(channel_->SetSink(kDefaultReceiveSsrc, &renderer_)); | 811 EXPECT_TRUE(channel_->SetSink(kDefaultReceiveSsrc, &renderer_)); |
812 EXPECT_EQ(0, renderer_.num_rendered_frames()); | 812 EXPECT_EQ(0, renderer_.num_rendered_frames()); |
813 EXPECT_TRUE(SendFrame()); | 813 EXPECT_TRUE(SendFrame()); |
814 EXPECT_FRAME_WAIT(1, kVideoWidth, kVideoHeight, kTimeout); | 814 EXPECT_FRAME_WAIT(1, kVideoWidth, kVideoHeight, kTimeout); |
815 // Wait for one frame so they don't get dropped because we send frames too | 815 // Wait for one frame so they don't get dropped because we send frames too |
816 // tightly. | 816 // tightly. |
817 rtc::Thread::Current()->ProcessMessages(30); | 817 rtc::Thread::Current()->ProcessMessages(30); |
818 // Remove the capturer. | 818 // Remove the capturer. |
819 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, nullptr)); | 819 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, nullptr)); |
820 // Wait for one black frame for removing the capturer. | |
821 EXPECT_FRAME_WAIT(2, kVideoWidth, kVideoHeight, kTimeout); | |
822 | 820 |
823 // No capturer was added, so this SetVideoSend shouldn't do anything. | 821 // No capturer was added, so this SetVideoSend shouldn't do anything. |
824 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, nullptr)); | 822 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, nullptr)); |
825 rtc::Thread::Current()->ProcessMessages(300); | 823 rtc::Thread::Current()->ProcessMessages(300); |
826 // Verify no more frames were sent. | 824 // Verify no more frames were sent. |
827 EXPECT_EQ(2, renderer_.num_rendered_frames()); | 825 EXPECT_EQ(1, renderer_.num_rendered_frames()); |
828 } | 826 } |
829 | 827 |
830 // Tests that we can add and remove capturer as unique sources. | 828 // Tests that we can add and remove capturer as unique sources. |
831 void AddRemoveCapturerMultipleSources() { | 829 void AddRemoveCapturerMultipleSources() { |
832 // WebRTC implementation will drop frames if pushed to quickly. Wait the | 830 // WebRTC implementation will drop frames if pushed to quickly. Wait the |
833 // interval time to avoid that. | 831 // interval time to avoid that. |
834 // WebRTC implementation will drop frames if pushed to quickly. Wait the | 832 // WebRTC implementation will drop frames if pushed to quickly. Wait the |
835 // interval time to avoid that. | 833 // interval time to avoid that. |
836 // Set up the stream associated with the engine. | 834 // Set up the stream associated with the engine. |
837 EXPECT_TRUE(channel_->AddRecvStream( | 835 EXPECT_TRUE(channel_->AddRecvStream( |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 std::unique_ptr<C> channel_; | 925 std::unique_ptr<C> channel_; |
928 cricket::FakeNetworkInterface network_interface_; | 926 cricket::FakeNetworkInterface network_interface_; |
929 cricket::FakeVideoRenderer renderer_; | 927 cricket::FakeVideoRenderer renderer_; |
930 cricket::VideoMediaChannel::Error media_error_; | 928 cricket::VideoMediaChannel::Error media_error_; |
931 | 929 |
932 // Used by test cases where 2 streams are run on the same channel. | 930 // Used by test cases where 2 streams are run on the same channel. |
933 cricket::FakeVideoRenderer renderer2_; | 931 cricket::FakeVideoRenderer renderer2_; |
934 }; | 932 }; |
935 | 933 |
936 #endif // WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT | 934 #endif // WEBRTC_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT |
OLD | NEW |