Storing frame if encoder is paused.
Adds a pending frame to VideoStreamEncoder that is used to store frames that are not sent because the encoder is paused. If the encoder is resumed within 200 ms, the pending frame will be encoded and sent. This ensures that resuming a stream instantly starts sending frames if it is possible. This also protects against a race between submitting the first frame and enabling the encoder that caused flakiness in end to end tests when using the task queue based congestion controller. Bug: webrtc:8415 Change-Id: If4bd897187fbfdc4926855f39503230bdad4a93a Reviewed-on: https://webrtc-review.googlesource.com/67141 Commit-Queue: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22781}
This commit is contained in:
committed by
Commit Bot
parent
b549bdc845
commit
dcc7e88cc7
@ -703,12 +703,18 @@ TEST_F(VideoStreamEncoderTest, DropsFramesBeforeFirstOnBitrateUpdated) {
|
||||
// Dropped since no target bitrate has been set.
|
||||
rtc::Event frame_destroyed_event(false, false);
|
||||
video_source_.IncomingCapturedFrame(CreateFrame(1, &frame_destroyed_event));
|
||||
// Fill the pending frame cache with a new frame so the previous frame is
|
||||
// dropped.
|
||||
video_source_.IncomingCapturedFrame(CreateFrame(2, nullptr));
|
||||
EXPECT_TRUE(frame_destroyed_event.Wait(kDefaultTimeoutMs));
|
||||
|
||||
video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
|
||||
|
||||
video_source_.IncomingCapturedFrame(CreateFrame(2, nullptr));
|
||||
// The pending frame should be received.
|
||||
WaitForEncodedFrame(2);
|
||||
video_source_.IncomingCapturedFrame(CreateFrame(3, nullptr));
|
||||
|
||||
WaitForEncodedFrame(3);
|
||||
video_stream_encoder_->Stop();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user