Reset prev_unwrapped_timestamp_ in TimestampExtrapolator::Reset

Bug: b/325916306
Change-Id: I7c52ed45d02c8e602670f5e8e345543fed4523f3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/342860
Reviewed-by: Stefan Holmer <holmer@google.com>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41897}
This commit is contained in:
philipel 2024-03-13 13:02:15 +01:00 committed by WebRTC LUCI CQ
parent ed050bf253
commit 2f3b75d30d
3 changed files with 19 additions and 1 deletions

View File

@ -42,6 +42,7 @@ void TimestampExtrapolator::Reset(Timestamp start) {
start_ = start;
prev_ = start_;
first_unwrapped_timestamp_ = absl::nullopt;
prev_unwrapped_timestamp_ = absl::nullopt;
w_[0] = 90.0;
w_[1] = 0;
p_[0][0] = 1;

View File

@ -231,4 +231,20 @@ TEST(TimestampExtrapolatorTest, TimestampJump) {
Optional(clock.CurrentTime()));
}
TEST(TimestampExtrapolatorTest, GapInReceivedFrames) {
SimulatedClock clock(
Timestamp::Seconds(std::numeric_limits<uint32_t>::max() / 90000 - 31));
TimestampExtrapolator ts_extrapolator(clock.CurrentTime());
uint32_t rtp = std::numeric_limits<uint32_t>::max();
clock.AdvanceTime(k25FpsDelay);
ts_extrapolator.Update(clock.CurrentTime(), rtp);
rtp += 30 * 90000;
clock.AdvanceTime(TimeDelta::Seconds(30));
ts_extrapolator.Update(clock.CurrentTime(), rtp);
EXPECT_THAT(ts_extrapolator.ExtrapolateLocalTime(rtp),
Optional(clock.CurrentTime()));
}
} // namespace webrtc

View File

@ -1020,7 +1020,8 @@ TEST_P(VideoReceiveStream2Test, RtpTimestampWrapAround) {
.Build());
EXPECT_CALL(mock_decoder_, Decode(test::RtpTimestamp(kWrapAroundRtp), _))
.Times(1);
EXPECT_THAT(fake_renderer_.WaitForFrame(TimeDelta::Zero()), RenderedFrame());
EXPECT_THAT(fake_renderer_.WaitForFrame(TimeDelta::Seconds(1)),
RenderedFrame());
video_receive_stream_->Stop();
}