Update last received keyframe packet timestamp on all packets with the same RTP timestamp.

Bug: webrtc:12579,webrtc:12680
Change-Id: Id6e7b2c4199f52b3872ad407d8b602bed8b6cf3a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215325
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33770}
This commit is contained in:
philipel 2021-04-16 12:10:22 +02:00 committed by Commit Bot
parent 0d3c09a8fe
commit b84931107c
4 changed files with 19 additions and 2 deletions

View File

@ -801,6 +801,12 @@ void RtpVideoStreamReceiver::OnInsertedPacket(
}
RTC_DCHECK(frame_boundary);
if (result.buffer_cleared) {
{
MutexLock lock(&sync_info_lock_);
last_received_rtp_system_time_.reset();
last_received_keyframe_rtp_system_time_.reset();
last_received_keyframe_rtp_timestamp_.reset();
}
RequestKeyFrame();
}
}
@ -1189,7 +1195,9 @@ void RtpVideoStreamReceiver::UpdatePacketReceiveTimestamps(
Timestamp now = clock_->CurrentTime();
{
MutexLock lock(&sync_info_lock_);
if (is_keyframe) {
if (is_keyframe ||
last_received_keyframe_rtp_timestamp_ == packet.Timestamp()) {
last_received_keyframe_rtp_timestamp_ = packet.Timestamp();
last_received_keyframe_rtp_system_time_ = now;
}
last_received_rtp_system_time_ = now;

View File

@ -383,6 +383,8 @@ class RtpVideoStreamReceiver : public LossNotificationSender,
mutable Mutex sync_info_lock_;
absl::optional<uint32_t> last_received_rtp_timestamp_
RTC_GUARDED_BY(sync_info_lock_);
absl::optional<uint32_t> last_received_keyframe_rtp_timestamp_
RTC_GUARDED_BY(sync_info_lock_);
absl::optional<Timestamp> last_received_rtp_system_time_
RTC_GUARDED_BY(sync_info_lock_);
absl::optional<Timestamp> last_received_keyframe_rtp_system_time_

View File

@ -767,6 +767,9 @@ void RtpVideoStreamReceiver2::OnInsertedPacket(
}
RTC_DCHECK(frame_boundary);
if (result.buffer_cleared) {
last_received_rtp_system_time_.reset();
last_received_keyframe_rtp_system_time_.reset();
last_received_keyframe_rtp_timestamp_.reset();
RequestKeyFrame();
}
}
@ -1127,7 +1130,9 @@ void RtpVideoStreamReceiver2::UpdatePacketReceiveTimestamps(
const RtpPacketReceived& packet,
bool is_keyframe) {
Timestamp now = clock_->CurrentTime();
if (is_keyframe) {
if (is_keyframe ||
last_received_keyframe_rtp_timestamp_ == packet.Timestamp()) {
last_received_keyframe_rtp_timestamp_ = packet.Timestamp();
last_received_keyframe_rtp_system_time_ = now;
}
last_received_rtp_system_time_ = now;

View File

@ -336,6 +336,8 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
absl::optional<uint32_t> last_received_rtp_timestamp_
RTC_GUARDED_BY(worker_task_checker_);
absl::optional<uint32_t> last_received_keyframe_rtp_timestamp_
RTC_GUARDED_BY(worker_task_checker_);
absl::optional<Timestamp> last_received_rtp_system_time_
RTC_GUARDED_BY(worker_task_checker_);
absl::optional<Timestamp> last_received_keyframe_rtp_system_time_