Index: webrtc/media/engine/webrtcvideoengine2_unittest.cc |
diff --git a/webrtc/media/engine/webrtcvideoengine2_unittest.cc b/webrtc/media/engine/webrtcvideoengine2_unittest.cc |
index 4d86e6c6f44993266b9cb0880cf5a8c26a3c25af..868ff42b7cde1f0edc88600abd8decc1a90ab5ec 100644 |
--- a/webrtc/media/engine/webrtcvideoengine2_unittest.cc |
+++ b/webrtc/media/engine/webrtcvideoengine2_unittest.cc |
@@ -344,20 +344,24 @@ |
EXPECT_TRUE( |
channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); |
- EXPECT_EQ(0, encoder_factory.GetNumCreatedEncoders()); |
+ ASSERT_TRUE(encoder_factory.WaitForCreatedVideoEncoders(1)); |
+ ASSERT_EQ(1u, encoder_factory.encoders().size()); |
EXPECT_TRUE(channel->SetSend(true)); |
+ |
cricket::FakeVideoCapturer capturer; |
EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer)); |
EXPECT_EQ(cricket::CS_RUNNING, |
capturer.Start(capturer.GetSupportedFormats()->front())); |
EXPECT_TRUE(capturer.CaptureFrame()); |
- // Sending one frame will have allocate the encoder. |
- ASSERT_TRUE(encoder_factory.WaitForCreatedVideoEncoders(1)); |
+ // Sending one frame will have reallocated the encoder since input size |
+ // changes from a small default to the actual frame width/height. Wait for |
+ // that to happen then for the frame to be sent. |
+ ASSERT_TRUE(encoder_factory.WaitForCreatedVideoEncoders(2)); |
EXPECT_TRUE_WAIT(encoder_factory.encoders()[0]->GetNumEncodedFrames() > 0, |
kTimeout); |
int num_created_encoders = encoder_factory.GetNumCreatedEncoders(); |
- EXPECT_EQ(num_created_encoders, 1); |
+ EXPECT_EQ(num_created_encoders, 2); |
// Setting codecs of the same type should not reallocate any encoders |
// (expecting a no-op). |
@@ -665,14 +669,6 @@ |
EXPECT_TRUE( |
channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); |
ASSERT_EQ(1u, encoder_factory.encoders().size()); |
- |
- // Send a frame of 720p. This should trigger a "real" encoder initialization. |
- cricket::VideoFormat format( |
- 1280, 720, cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420); |
- cricket::FakeVideoCapturer capturer; |
- EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer)); |
- EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(format)); |
- EXPECT_TRUE(capturer.CaptureFrame()); |
ASSERT_TRUE(encoder_factory.encoders()[0]->WaitForInitEncode()); |
EXPECT_EQ(webrtc::kVideoCodecH264, |
encoder_factory.encoders()[0]->GetCodecSettings().codecType); |