Check that capture time is valid before adjusting it.

A packet's capture time may be -1 to indicate an unset value. We need to
check that this is the case before adjusting it when generating padding.
Otherwise, invalid values will result.

Bug: webrtc:11615
Change-Id: Ibbeb959f1d4d37dd4d65702494b97246642b57d6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176281
Commit-Queue: Dan Minor <dminor@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31766}
This commit is contained in:
Dan Minor
2020-05-27 16:25:21 -04:00
committed by Commit Bot
parent fd5df68872
commit fa504e744f

View File

@ -484,8 +484,11 @@ std::vector<std::unique_ptr<RtpPacketToSend>> RTPSender::GeneratePadding(
padding_packet->SetTimestamp(padding_packet->Timestamp() +
(now_ms - last_timestamp_time_ms_) *
kTimestampTicksPerMs);
padding_packet->set_capture_time_ms(padding_packet->capture_time_ms() +
(now_ms - last_timestamp_time_ms_));
if (padding_packet->capture_time_ms() > 0) {
padding_packet->set_capture_time_ms(
padding_packet->capture_time_ms() +
(now_ms - last_timestamp_time_ms_));
}
}
RTC_DCHECK(rtx_ssrc_);
padding_packet->SetSsrc(*rtx_ssrc_);