diff --git a/call/bitrate_estimator_tests.cc b/call/bitrate_estimator_tests.cc index f44cdfd509..f17a037ed2 100644 --- a/call/bitrate_estimator_tests.cc +++ b/call/bitrate_estimator_tests.cc @@ -186,6 +186,7 @@ class BitrateEstimatorTest : public test::CallTest { test::VideoTestConstants::kDefaultFramerate, *test->task_queue_factory_); frame_generator_capturer_->Init(); + frame_generator_capturer_->Start(); send_stream_->SetSource(frame_generator_capturer_.get(), DegradationPreference::MAINTAIN_FRAMERATE); send_stream_->Start(); diff --git a/pc/peer_connection_field_trial_tests.cc b/pc/peer_connection_field_trial_tests.cc index c3b3a2db7f..7799c9d6e3 100644 --- a/pc/peer_connection_field_trial_tests.cc +++ b/pc/peer_connection_field_trial_tests.cc @@ -237,6 +237,7 @@ TEST_F(PeerConnectionFieldTrialTest, ApplyFakeNetworkConfig) { auto video_track_source = rtc::make_ref_counted( config, clock_, /*is_screencast=*/false); + video_track_source->Start(); caller->AddTrack(pc_factory_->CreateVideoTrack(video_track_source, "v")); WrapperPtr callee = CreatePeerConnection(); diff --git a/pc/test/frame_generator_capturer_video_track_source.h b/pc/test/frame_generator_capturer_video_track_source.h index 50a3d26c2e..79a5b3474a 100644 --- a/pc/test/frame_generator_capturer_video_track_source.h +++ b/pc/test/frame_generator_capturer_video_track_source.h @@ -64,9 +64,15 @@ class FrameGeneratorCapturerVideoTrackSource : public VideoTrackSource { ~FrameGeneratorCapturerVideoTrackSource() = default; - void Start() { SetState(kLive); } + void Start() { + SetState(kLive); + video_capturer_->Start(); + } - void Stop() { SetState(kMuted); } + void Stop() { + SetState(kMuted); + video_capturer_->Stop(); + } bool is_screencast() const override { return is_screencast_; } diff --git a/test/BUILD.gn b/test/BUILD.gn index 3a0a35926f..5187205a0a 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -1260,6 +1260,7 @@ if (!build_with_chromium) { ":run_loop", ":scoped_key_value_config", ":test_support", + ":test_video_capturer", ":video_test_common", ":video_test_constants", "../api:array_view", diff --git a/test/call_test.cc b/test/call_test.cc index 7a1bbd2969..b8a1cd76b8 100644 --- a/test/call_test.cc +++ b/test/call_test.cc @@ -634,7 +634,14 @@ void CallTest::Start() { audio_recv_stream->Start(); } +void CallTest::StartVideoSources() { + for (size_t i = 0; i < video_sources_.size(); ++i) { + video_sources_[i]->Start(); + } +} + void CallTest::StartVideoStreams() { + StartVideoSources(); for (size_t i = 0; i < video_send_streams_.size(); ++i) { std::vector active_rtp_streams( video_send_configs_[i].rtp.ssrcs.size(), true); diff --git a/test/call_test.h b/test/call_test.h index 41db9cefd1..08d0e49a68 100644 --- a/test/call_test.h +++ b/test/call_test.h @@ -36,6 +36,7 @@ #include "test/rtp_rtcp_observer.h" #include "test/run_loop.h" #include "test/scoped_key_value_config.h" +#include "test/test_video_capturer.h" #include "test/video_test_constants.h" namespace webrtc { @@ -162,6 +163,7 @@ class CallTest : public ::testing::Test, public RtpPacketSinkInterface { void ConnectVideoSourcesToStreams(); void Start(); + void StartVideoSources(); void StartVideoStreams(); void Stop(); void StopVideoStreams(); @@ -210,8 +212,7 @@ class CallTest : public ::testing::Test, public RtpPacketSinkInterface { std::vector flexfec_receive_streams_; test::FrameGeneratorCapturer* frame_generator_capturer_; - std::vector>> - video_sources_; + std::vector> video_sources_; DegradationPreference degradation_preference_ = DegradationPreference::MAINTAIN_FRAMERATE; diff --git a/test/frame_generator_capturer.cc b/test/frame_generator_capturer.cc index 6ba0807a74..e5d4231b23 100644 --- a/test/frame_generator_capturer.cc +++ b/test/frame_generator_capturer.cc @@ -43,7 +43,7 @@ FrameGeneratorCapturer::FrameGeneratorCapturer( int target_fps, TaskQueueFactory& task_queue_factory) : clock_(clock), - sending_(true), + sending_(false), sink_wants_observer_(nullptr), frame_generator_(std::move(frame_generator)), source_fps_(target_fps), diff --git a/test/pc/e2e/peer_connection_quality_test_test.cc b/test/pc/e2e/peer_connection_quality_test_test.cc index 066fe7d8ee..7f0129d525 100644 --- a/test/pc/e2e/peer_connection_quality_test_test.cc +++ b/test/pc/e2e/peer_connection_quality_test_test.cc @@ -129,7 +129,7 @@ TEST_F(PeerConnectionE2EQualityTestTest, OutputVideoIsDumpedWhenRequested) { auto frame_reader = test::CreateY4mFrameReader( test::JoinFilename(test_directory_, "alice_video_bob_320x180_15.y4m")); - EXPECT_THAT(frame_reader->num_frames(), Eq(31)); // 2 seconds 15 fps + 1 + EXPECT_THAT(frame_reader->num_frames(), Eq(30)); // 2 seconds 15 fps ExpectOutputFilesCount(1); } diff --git a/test/peer_scenario/peer_scenario_client.cc b/test/peer_scenario/peer_scenario_client.cc index 3419b9e069..697bf055a7 100644 --- a/test/peer_scenario/peer_scenario_client.cc +++ b/test/peer_scenario/peer_scenario_client.cc @@ -338,6 +338,7 @@ PeerScenarioClient::VideoSendTrack PeerScenarioClient::CreateVideo( capturer->Init(); res.source = rtc::make_ref_counted( std::move(capturer), config.screencast); + res.source->Start(); auto track = pc_factory_->CreateVideoTrack(res.source, track_id); res.track = track.get(); res.sender = diff --git a/test/scenario/video_stream.cc b/test/scenario/video_stream.cc index ec139763c8..e082aa37c6 100644 --- a/test/scenario/video_stream.cc +++ b/test/scenario/video_stream.cc @@ -419,6 +419,7 @@ SendVideoStream::SendVideoStream(CallClient* sender, send_config.suspend_below_min_bitrate = config.encoder.suspend_below_min_bitrate; + video_capturer_->Start(); sender_->SendTask([&] { if (config.stream.fec_controller_factory) { send_stream_ = sender_->call_->CreateVideoSendStream( diff --git a/video/end_to_end_tests/multi_codec_receive_tests.cc b/video/end_to_end_tests/multi_codec_receive_tests.cc index 377209b8a5..2d8bf0586d 100644 --- a/video/end_to_end_tests/multi_codec_receive_tests.cc +++ b/video/end_to_end_tests/multi_codec_receive_tests.cc @@ -254,6 +254,7 @@ void MultiCodecReceiveTest::RunTestWithCodecs( GetVideoSendStream()->Start(); CreateFrameGeneratorCapturer(kFps, kWidth / 2, kHeight / 2); ConnectVideoSourcesToStreams(); + StartVideoSources(); }); EXPECT_TRUE(observer_.Wait()) << "Timed out waiting for frames."; } diff --git a/video/end_to_end_tests/rtp_rtcp_tests.cc b/video/end_to_end_tests/rtp_rtcp_tests.cc index 009a3878fb..fbd8585907 100644 --- a/video/end_to_end_tests/rtp_rtcp_tests.cc +++ b/video/end_to_end_tests/rtp_rtcp_tests.cc @@ -339,6 +339,7 @@ void RtpRtcpEndToEndTest::TestRtpStatePreservation( ->SendRtcp(packet.data(), packet.size()); } CreateFrameGeneratorCapturer(30, 1280, 720); + StartVideoSources(); }); observer.ResetExpectedSsrcs(1);