diff options
Diffstat (limited to 'third_party/libwebrtc/media/engine/webrtc_video_engine_unittest.cc')
-rw-r--r-- | third_party/libwebrtc/media/engine/webrtc_video_engine_unittest.cc | 140 |
1 files changed, 0 insertions, 140 deletions
diff --git a/third_party/libwebrtc/media/engine/webrtc_video_engine_unittest.cc b/third_party/libwebrtc/media/engine/webrtc_video_engine_unittest.cc index 148223f497..4493c9c616 100644 --- a/third_party/libwebrtc/media/engine/webrtc_video_engine_unittest.cc +++ b/third_party/libwebrtc/media/engine/webrtc_video_engine_unittest.cc @@ -9078,105 +9078,6 @@ TEST_F(WebRtcVideoChannelTest, DefaultMinAndMaxBitratePropagatedToEncoder) { stream->GetVideoStreams()[0].target_bitrate_bps); } -// Test that a stream will not be sending if its encoding is made inactive -// through SetRtpSendParameters. -TEST_F(WebRtcVideoChannelTest, SetRtpSendParametersOneEncodingActive) { - FakeVideoSendStream* stream = AddSendStream(); - EXPECT_TRUE(send_channel_->SetSend(true)); - EXPECT_TRUE(stream->IsSending()); - - // Get current parameters and change "active" to false. - webrtc::RtpParameters parameters = - send_channel_->GetRtpSendParameters(last_ssrc_); - ASSERT_EQ(1u, parameters.encodings.size()); - ASSERT_TRUE(parameters.encodings[0].active); - parameters.encodings[0].active = false; - EXPECT_TRUE(send_channel_->SetRtpSendParameters(last_ssrc_, parameters).ok()); - EXPECT_FALSE(stream->IsSending()); - - // Now change it back to active and verify we resume sending. - parameters.encodings[0].active = true; - EXPECT_TRUE(send_channel_->SetRtpSendParameters(last_ssrc_, parameters).ok()); - EXPECT_TRUE(stream->IsSending()); -} - -// Tests that when active is updated for any simulcast layer then the send -// stream's sending state will be updated and it will be reconfigured with the -// new appropriate active simulcast streams. -TEST_F(WebRtcVideoChannelTest, SetRtpSendParametersMultipleEncodingsActive) { - // Create the stream params with multiple ssrcs for simulcast. - const size_t kNumSimulcastStreams = 3; - std::vector<uint32_t> ssrcs = MAKE_VECTOR(kSsrcs3); - StreamParams stream_params = CreateSimStreamParams("cname", ssrcs); - FakeVideoSendStream* fake_video_send_stream = AddSendStream(stream_params); - uint32_t primary_ssrc = stream_params.first_ssrc(); - - // Using the FrameForwarder, we manually send a full size - // frame. This allows us to test that ReconfigureEncoder is called - // appropriately. - webrtc::test::FrameForwarder frame_forwarder; - VideoOptions options; - EXPECT_TRUE( - send_channel_->SetVideoSend(primary_ssrc, &options, &frame_forwarder)); - send_channel_->SetSend(true); - frame_forwarder.IncomingCapturedFrame(frame_source_.GetFrame( - 1920, 1080, webrtc::VideoRotation::kVideoRotation_0, - rtc::kNumMicrosecsPerSec / 30)); - - // Check that all encodings are initially active. - webrtc::RtpParameters parameters = - send_channel_->GetRtpSendParameters(primary_ssrc); - EXPECT_EQ(kNumSimulcastStreams, parameters.encodings.size()); - EXPECT_TRUE(parameters.encodings[0].active); - EXPECT_TRUE(parameters.encodings[1].active); - EXPECT_TRUE(parameters.encodings[2].active); - EXPECT_TRUE(fake_video_send_stream->IsSending()); - - // Only turn on only the middle stream. - parameters.encodings[0].active = false; - parameters.encodings[1].active = true; - parameters.encodings[2].active = false; - EXPECT_TRUE( - send_channel_->SetRtpSendParameters(primary_ssrc, parameters).ok()); - // Verify that the active fields are set on the VideoChannel. - parameters = send_channel_->GetRtpSendParameters(primary_ssrc); - EXPECT_EQ(kNumSimulcastStreams, parameters.encodings.size()); - EXPECT_FALSE(parameters.encodings[0].active); - EXPECT_TRUE(parameters.encodings[1].active); - EXPECT_FALSE(parameters.encodings[2].active); - // Check that the VideoSendStream is updated appropriately. This means its - // send state was updated and it was reconfigured. - EXPECT_TRUE(fake_video_send_stream->IsSending()); - std::vector<webrtc::VideoStream> simulcast_streams = - fake_video_send_stream->GetVideoStreams(); - EXPECT_EQ(kNumSimulcastStreams, simulcast_streams.size()); - EXPECT_FALSE(simulcast_streams[0].active); - EXPECT_TRUE(simulcast_streams[1].active); - EXPECT_FALSE(simulcast_streams[2].active); - - // Turn off all streams. - parameters.encodings[0].active = false; - parameters.encodings[1].active = false; - parameters.encodings[2].active = false; - EXPECT_TRUE( - send_channel_->SetRtpSendParameters(primary_ssrc, parameters).ok()); - // Verify that the active fields are set on the VideoChannel. - parameters = send_channel_->GetRtpSendParameters(primary_ssrc); - EXPECT_EQ(kNumSimulcastStreams, parameters.encodings.size()); - EXPECT_FALSE(parameters.encodings[0].active); - EXPECT_FALSE(parameters.encodings[1].active); - EXPECT_FALSE(parameters.encodings[2].active); - // Check that the VideoSendStream is off. - EXPECT_FALSE(fake_video_send_stream->IsSending()); - simulcast_streams = fake_video_send_stream->GetVideoStreams(); - EXPECT_EQ(kNumSimulcastStreams, simulcast_streams.size()); - EXPECT_FALSE(simulcast_streams[0].active); - EXPECT_FALSE(simulcast_streams[1].active); - EXPECT_FALSE(simulcast_streams[2].active); - - EXPECT_TRUE(send_channel_->SetVideoSend(primary_ssrc, nullptr, nullptr)); -} - // Tests that when some streams are disactivated then the lowest // stream min_bitrate would be reused for the first active stream. TEST_F(WebRtcVideoChannelTest, @@ -9232,47 +9133,6 @@ TEST_F(WebRtcVideoChannelTest, EXPECT_TRUE(send_channel_->SetVideoSend(primary_ssrc, nullptr, nullptr)); } -// Test that if a stream is reconfigured (due to a codec change or other -// change) while its encoding is still inactive, it doesn't start sending. -TEST_F(WebRtcVideoChannelTest, - InactiveStreamDoesntStartSendingWhenReconfigured) { - // Set an initial codec list, which will be modified later. - cricket::VideoSenderParameters parameters1; - parameters1.codecs.push_back(GetEngineCodec("VP8")); - parameters1.codecs.push_back(GetEngineCodec("VP9")); - EXPECT_TRUE(send_channel_->SetSenderParameters(parameters1)); - - FakeVideoSendStream* stream = AddSendStream(); - EXPECT_TRUE(send_channel_->SetSend(true)); - EXPECT_TRUE(stream->IsSending()); - - // Get current parameters and change "active" to false. - webrtc::RtpParameters parameters = - send_channel_->GetRtpSendParameters(last_ssrc_); - ASSERT_EQ(1u, parameters.encodings.size()); - ASSERT_TRUE(parameters.encodings[0].active); - parameters.encodings[0].active = false; - EXPECT_EQ(1u, GetFakeSendStreams().size()); - EXPECT_EQ(1, fake_call_->GetNumCreatedSendStreams()); - EXPECT_TRUE(send_channel_->SetRtpSendParameters(last_ssrc_, parameters).ok()); - EXPECT_FALSE(stream->IsSending()); - - // Reorder the codec list, causing the stream to be reconfigured. - cricket::VideoSenderParameters parameters2; - parameters2.codecs.push_back(GetEngineCodec("VP9")); - parameters2.codecs.push_back(GetEngineCodec("VP8")); - EXPECT_TRUE(send_channel_->SetSenderParameters(parameters2)); - auto new_streams = GetFakeSendStreams(); - // Assert that a new underlying stream was created due to the codec change. - // Otherwise, this test isn't testing what it set out to test. - EXPECT_EQ(1u, GetFakeSendStreams().size()); - EXPECT_EQ(2, fake_call_->GetNumCreatedSendStreams()); - - // Verify that we still are not sending anything, due to the inactive - // encoding. - EXPECT_FALSE(new_streams[0]->IsSending()); -} - // Test that GetRtpSendParameters returns the currently configured codecs. TEST_F(WebRtcVideoChannelTest, GetRtpSendParametersCodecs) { AddSendStream(); |