in rtcp::TransportFeedback delete functions with time represented as raw int

Bug: webrtc:13757
Change-Id: I53c8ed21ac37a3aee13482c6bb68a0c5ee8fcbee
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265681
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37259}
This commit is contained in:
Danil Chapovalov
2022-06-17 10:49:16 +02:00
committed by WebRTC LUCI CQ
parent a116da5d03
commit a3cb977679
10 changed files with 56 additions and 102 deletions

View File

@ -387,20 +387,9 @@ Timestamp TransportFeedback::BaseTime() const {
int64_t{base_time_ticks_} * kBaseTimeTick;
}
int64_t TransportFeedback::GetBaseTimeUs() const {
// Historically BaseTime was stored as signed integer and could be negative.
// However with new api it is not possible, but for compatibility with legacy
// tests return base time as negative when it used to be negative.
int64_t base_time_us = BaseTime().us() % kTimeWrapPeriod.us();
if (base_time_us >= kTimeWrapPeriod.us() / 2) {
return base_time_us - kTimeWrapPeriod.us();
} else {
return base_time_us;
}
}
namespace {
TimeDelta CompensateForWrapAround(TimeDelta delta) {
TimeDelta TransportFeedback::GetBaseDelta(Timestamp prev_timestamp) const {
TimeDelta delta = BaseTime() - prev_timestamp;
// Compensate for wrap around.
if ((delta - kTimeWrapPeriod).Abs() < delta.Abs()) {
delta -= kTimeWrapPeriod; // Wrap backwards.
} else if ((delta + kTimeWrapPeriod).Abs() < delta.Abs()) {
@ -408,20 +397,6 @@ TimeDelta CompensateForWrapAround(TimeDelta delta) {
}
return delta;
}
} // namespace
int64_t TransportFeedback::GetBaseDeltaUs(int64_t prev_timestamp_us) const {
int64_t delta_us = GetBaseTimeUs() - prev_timestamp_us;
return CompensateForWrapAround(TimeDelta::Micros(delta_us)).us();
}
TimeDelta TransportFeedback::GetBaseDelta(TimeDelta prev_timestamp) const {
return CompensateForWrapAround(GetBaseTime() - prev_timestamp);
}
TimeDelta TransportFeedback::GetBaseDelta(Timestamp prev_timestamp) const {
return CompensateForWrapAround(BaseTime() - prev_timestamp);
}
// De-serialize packet.
bool TransportFeedback::Parse(const CommonHeader& packet) {

View File

@ -23,8 +23,6 @@ namespace webrtc {
namespace rtcp {
class CommonHeader;
// TODO(bugs.webrtc.org/13757): Uncomment ABSL_DEPRECATED attributes or delete
// functions they are attached to when all usage within webrtc is updated.
class TransportFeedback : public Rtpfb {
public:
class ReceivedPacket {
@ -40,8 +38,6 @@ class TransportFeedback : public Rtpfb {
uint16_t sequence_number() const { return sequence_number_; }
int16_t delta_ticks() const { return delta_ticks_; }
// ABSL_DEPRECATED("Use delta() that returns TimeDelta")
int32_t delta_us() const { return delta().us(); }
TimeDelta delta() const { return delta_ticks_ * kDeltaTick; }
bool received() const { return received_; }
@ -53,8 +49,6 @@ class TransportFeedback : public Rtpfb {
// TODO(sprang): IANA reg?
static constexpr uint8_t kFeedbackMessageType = 15;
// Convert to multiples of 0.25ms.
// ABSL_DEPRECATED("Use kDeltaTick")
static constexpr int kDeltaScaleFactor = 250;
static constexpr TimeDelta kDeltaTick = TimeDelta::Micros(250);
// Maximum number of packets (including missing) TransportFeedback can report.
static constexpr size_t kMaxReportedPackets = 0xffff;
@ -70,20 +64,11 @@ class TransportFeedback : public Rtpfb {
~TransportFeedback() override;
// ABSL_DEPRECATED("Use version that takes Timestamp")
void SetBase(uint16_t base_sequence, // Seq# of first packet in this msg.
int64_t ref_timestamp_us) { // Reference timestamp for this msg.
SetBase(base_sequence, Timestamp::Micros(ref_timestamp_us));
}
void SetBase(uint16_t base_sequence, // Seq# of first packet in this msg.
Timestamp ref_timestamp); // Reference timestamp for this msg.
void SetFeedbackSequenceNumber(uint8_t feedback_sequence);
// NOTE: This method requires increasing sequence numbers (excepting wraps).
// ABSL_DEPRECATED("Use version that takes Timestamp")
bool AddReceivedPacket(uint16_t sequence_number, int64_t timestamp_us) {
return AddReceivedPacket(sequence_number, Timestamp::Micros(timestamp_us));
}
bool AddReceivedPacket(uint16_t sequence_number, Timestamp timestamp);
const std::vector<ReceivedPacket>& GetReceivedPackets() const;
const std::vector<ReceivedPacket>& GetAllPackets() const;
@ -94,17 +79,9 @@ class TransportFeedback : public Rtpfb {
size_t GetPacketStatusCount() const { return num_seq_no_; }
// Get the reference time including any precision loss.
// ABSL_DEPRECATED("Use BaseTime that returns Timestamp")
int64_t GetBaseTimeUs() const;
// ABSL_DEPRECATED("Use BaseTime that returns Timestamp")
TimeDelta GetBaseTime() const { return BaseTime() - Timestamp::Zero(); }
Timestamp BaseTime() const;
// Get the unwrapped delta between current base time and `prev_timestamp_us`.
// ABSL_DEPRECATED("Use GetBaseDelta that takes Timestamp")
int64_t GetBaseDeltaUs(int64_t prev_timestamp_us) const;
// ABSL_DEPRECATED("Use GetBaseDelta that takes Timestamp")
TimeDelta GetBaseDelta(TimeDelta prev_timestamp) const;
// Get the unwrapped delta between current base time and `prev_timestamp`.
TimeDelta GetBaseDelta(Timestamp prev_timestamp) const;
// Does the feedback packet contain timestamp information?