Reland "Represent RtpPacketToSend::capture_time with Timestamp"

This reverts commit 56db8d09529d5ba92d24954a1d78a90c8ea2cd85.

Reason for revert: downstream problem addressed

Original change's description:
> Revert "Represent RtpPacketToSend::capture_time with Timestamp"
>
> This reverts commit 385eb9714daa80306d2f92d36678c42892dab555.
>
> Reason for revert: Causes problems downstream:
>
> #
> # Fatal error in: rtc_base/units/unit_base.h, line 122
> # last system error: 0
> # Check failed: value >= 0 (-234 vs. 0)
>
> Original change's description:
> > Represent RtpPacketToSend::capture_time with Timestamp
> >
> > Bug: webrtc:13757
> > Change-Id: I0ede22cd34e3a59afe1477d8edd495dce64e3242
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/252586
> > Reviewed-by: Erik Språng <sprang@webrtc.org>
> > Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
> > Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#36083}
>
> Bug: webrtc:13757
> Change-Id: I8442abd438be8726cf671d0f372d50ecfac6847e
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/252720
> Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#36087}

Bug: webrtc:13757
Change-Id: I1fa852757480116f35deb2b6c3c27800bdf5e197
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/252781
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36093}
This commit is contained in:
Danil Chapovalov
2022-02-27 21:10:55 +00:00
committed by WebRTC LUCI CQ
parent 6ccd74816a
commit 9af4aa7cf4
19 changed files with 140 additions and 89 deletions

View File

@ -99,7 +99,7 @@ void PacketSequencer::UpdateLastPacketState(const RtpPacketToSend& packet) {
// Save timestamps to generate timestamp field and extensions for the padding.
last_rtp_timestamp_ = packet.Timestamp();
last_timestamp_time_ms_ = clock_->TimeInMilliseconds();
last_capture_time_ms_ = packet.capture_time_ms();
last_capture_time_ms_ = packet.capture_time().ms();
}
void PacketSequencer::PopulatePaddingFields(RtpPacketToSend& packet) {
@ -107,7 +107,7 @@ void PacketSequencer::PopulatePaddingFields(RtpPacketToSend& packet) {
RTC_DCHECK(CanSendPaddingOnMediaSsrc());
packet.SetTimestamp(last_rtp_timestamp_);
packet.set_capture_time_ms(last_capture_time_ms_);
packet.set_capture_time(Timestamp::Millis(last_capture_time_ms_));
packet.SetPayloadType(last_payload_type_);
return;
}
@ -119,7 +119,7 @@ void PacketSequencer::PopulatePaddingFields(RtpPacketToSend& packet) {
}
packet.SetTimestamp(last_rtp_timestamp_);
packet.set_capture_time_ms(last_capture_time_ms_);
packet.set_capture_time(Timestamp::Millis(last_capture_time_ms_));
// Only change the timestamp of padding packets sent over RTX.
// Padding only packets over RTP has to be sent as part of a media
@ -129,9 +129,10 @@ void PacketSequencer::PopulatePaddingFields(RtpPacketToSend& packet) {
packet.SetTimestamp(packet.Timestamp() +
(now_ms - last_timestamp_time_ms_) *
kTimestampTicksPerMs);
if (packet.capture_time_ms() > 0) {
packet.set_capture_time_ms(packet.capture_time_ms() +
(now_ms - last_timestamp_time_ms_));
if (packet.capture_time() > Timestamp::Zero()) {
packet.set_capture_time(
packet.capture_time() +
TimeDelta::Millis(now_ms - last_timestamp_time_ms_));
}
}
}