Fix flake in TwoStreamsSendAndReceive.

Whether two streams get 300k or 150k as initial bitrate is flaky, since
InitEncode may happen asynchronously either before or after two streams
have shared the 300k, meaning that the first sender either thinks it
should start at 300k or at 150k.

This should ideally be fixed by reconfiguring encoders to use QVGA if a
lower estimate arrives before the first frame is encoded, but right now
that would require reconfigure logic in all VideoEncoder wrappers, which
is also less than ideal. It would be good to revisit this once
QualityScaler moves outside the VideoEncoder implementations (into
GenericEncoder).

BUG=webrtc:5678
R=stefan@webrtc.org

Review URL: https://codereview.webrtc.org/1902413002 .

Cr-Commit-Position: refs/heads/master@{#12448}
This commit is contained in:
Peter Boström 2016-04-20 16:31:53 +02:00
parent 9b2119be47
commit d1f584bb06
2 changed files with 9 additions and 11 deletions

View File

@ -1063,16 +1063,7 @@ class VideoMediaChannelTest : public testing::Test,
void TwoStreamsSendAndReceive(const cricket::VideoCodec& codec) {
SetUpSecondStream();
// Test sending and receiving on first stream.
EXPECT_TRUE(SetOneCodec(codec));
EXPECT_TRUE(SetSend(true));
EXPECT_TRUE(channel_->SetSink(kDefaultReceiveSsrc, &renderer_));
EXPECT_EQ(0, renderer_.num_rendered_frames());
EXPECT_TRUE(SendFrame());
// Since multiple streams share this link we should be receiving smaller
// initial frames (start at QVGA since shared bitrate is 150k each).
EXPECT_FRAME_WAIT(1, codec.width / 2, codec.height / 2, kTimeout);
std::unique_ptr<const rtc::CopyOnWriteBuffer> p(GetRtpPacket(0));
EXPECT_EQ(codec.id, GetPayloadType(p.get()));
SendAndReceive(codec);
// Test sending and receiving on second stream.
EXPECT_EQ_WAIT(1, renderer2_.num_rendered_frames(), kTimeout);
EXPECT_GT(NumRtpPackets(), 0);

View File

@ -871,7 +871,14 @@ TEST_F(WebRtcVideoChannel2BaseTest, SendAndReceiveVp8SvcQqvga) {
}
TEST_F(WebRtcVideoChannel2BaseTest, TwoStreamsSendAndReceive) {
Base::TwoStreamsSendAndReceive(kVp8Codec);
// Set a high bitrate to not be downscaled by VP8 due to low initial start
// bitrates. This currently happens at <250k, and two streams sharing 300k
// initially will use QVGA instead of VGA.
// TODO(pbos): Set up the quality scaler so that both senders reliably start
// at QVGA, then verify that instead.
cricket::VideoCodec codec = kVp8Codec;
codec.params[kCodecParamStartBitrate] = "1000000";
Base::TwoStreamsSendAndReceive(codec);
}
class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test {