`RtpPacketInfo`: new ctor + deprecated ctors clean-up New ctor added without optional and media specific fields. Bug: webrtc:10739, b/246753278 Change-Id: I7e15849aced6ed0a7ada725ea171a15ea1e9bc5a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275941 Reviewed-by: Ivo Creusen <ivoc@webrtc.org> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38124}
diff --git a/api/rtp_packet_info.h b/api/rtp_packet_info.h index bc9839f..f9980a1c 100644 --- a/api/rtp_packet_info.h +++ b/api/rtp_packet_info.h
@@ -34,6 +34,13 @@ RtpPacketInfo(uint32_t ssrc, std::vector<uint32_t> csrcs, uint32_t rtp_timestamp, + Timestamp receive_time); + + // TODO(bugs.webrtc.org/12722): Deprecated, remove once downstream projects + // are updated. + RtpPacketInfo(uint32_t ssrc, + std::vector<uint32_t> csrcs, + uint32_t rtp_timestamp, absl::optional<uint8_t> audio_level, absl::optional<AbsoluteCaptureTime> absolute_capture_time, Timestamp receive_time); @@ -64,31 +71,36 @@ uint32_t rtp_timestamp() const { return rtp_timestamp_; } void set_rtp_timestamp(uint32_t value) { rtp_timestamp_ = value; } - absl::optional<uint8_t> audio_level() const { return audio_level_; } - void set_audio_level(absl::optional<uint8_t> value) { audio_level_ = value; } - - const absl::optional<AbsoluteCaptureTime>& absolute_capture_time() const { - return absolute_capture_time_; - } - void set_absolute_capture_time( - const absl::optional<AbsoluteCaptureTime>& value) { - absolute_capture_time_ = value; - } - - const absl::optional<int64_t>& local_capture_clock_offset() const { - return local_capture_clock_offset_; - } - - void set_local_capture_clock_offset(const absl::optional<int64_t>& value) { - local_capture_clock_offset_ = value; - } - Timestamp receive_time() const { return receive_time_; } void set_receive_time(Timestamp value) { receive_time_ = value; } // TODO(bugs.webrtc.org/12722): Deprecated, remove once downstream projects // are updated. int64_t receive_time_ms() const { return receive_time_.ms(); } + absl::optional<uint8_t> audio_level() const { return audio_level_; } + RtpPacketInfo& set_audio_level(absl::optional<uint8_t> value) { + audio_level_ = value; + return *this; + } + + const absl::optional<AbsoluteCaptureTime>& absolute_capture_time() const { + return absolute_capture_time_; + } + RtpPacketInfo& set_absolute_capture_time( + const absl::optional<AbsoluteCaptureTime>& value) { + absolute_capture_time_ = value; + return *this; + } + + const absl::optional<int64_t>& local_capture_clock_offset() const { + return local_capture_clock_offset_; + } + RtpPacketInfo& set_local_capture_clock_offset( + const absl::optional<int64_t>& value) { + local_capture_clock_offset_ = value; + return *this; + } + private: // Fields from the RTP header: // https://tools.ietf.org/html/rfc3550#section-5.1 @@ -96,6 +108,9 @@ std::vector<uint32_t> csrcs_; uint32_t rtp_timestamp_; + // Local `webrtc::Clock`-based timestamp of when the packet was received. + Timestamp receive_time_; + // Fields from the Audio Level header extension: // https://tools.ietf.org/html/rfc6464#section-3 absl::optional<uint8_t> audio_level_; @@ -112,9 +127,6 @@ // Clock offset against capturer's clock. Should be derived from the estimated // capture clock offset defined in the Absolute Capture Time header extension. absl::optional<int64_t> local_capture_clock_offset_; - - // Local `webrtc::Clock`-based timestamp of when the packet was received. - Timestamp receive_time_; }; bool operator==(const RtpPacketInfo& lhs, const RtpPacketInfo& rhs);