| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TRANSPORT_FEEDBACK_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TRANSPORT_FEEDBACK_H_ |
| 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TRANSPORT_FEEDBACK_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TRANSPORT_FEEDBACK_H_ |
| 13 | 13 |
| 14 #include <deque> | 14 #include <deque> |
| 15 #include <memory> | 15 #include <memory> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "webrtc/base/constructormagic.h" | 18 #include "webrtc/base/constructormagic.h" |
| 19 #include "webrtc/base/deprecation.h" | 19 #include "webrtc/base/deprecation.h" |
| 20 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h" | 20 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h" |
| 21 | 21 |
| 22 namespace webrtc { | 22 namespace webrtc { |
| 23 namespace rtcp { | 23 namespace rtcp { |
| 24 |
| 25 class TransportFeedbackInterface { |
| 26 public: |
| 27 virtual ~TransportFeedbackInterface() = default; |
| 28 enum class StatusSymbol { |
| 29 kNotReceived, |
| 30 kReceivedSmallDelta, |
| 31 kReceivedLargeDelta, |
| 32 }; |
| 33 virtual void SetBase(uint16_t base_sequence, int64_t ref_timestamp_us) = 0; |
| 34 virtual void SetFeedbackSequenceNumber(uint8_t feedback_sequence) = 0; |
| 35 virtual bool AddReceivedPacket(uint16_t sequence_number, |
| 36 int64_t timestamp_us) = 0; |
| 37 virtual uint16_t GetBaseSequence() const = 0; |
| 38 virtual std::vector<StatusSymbol> GetStatusVector() const = 0; |
| 39 virtual std::vector<int16_t> GetReceiveDeltas() const = 0; |
| 40 virtual int64_t GetBaseTimeUs() const = 0; |
| 41 virtual std::vector<int64_t> GetReceiveDeltasUs() const = 0; |
| 42 }; |
| 43 |
| 24 class CommonHeader; | 44 class CommonHeader; |
| 25 | 45 |
| 26 class TransportFeedback : public Rtpfb { | 46 // TODO(minyue): Update PacketCounter so that TransportFeedback can become a |
| 47 // final class. |
| 48 class TransportFeedback : public Rtpfb, public TransportFeedbackInterface { |
| 27 public: | 49 public: |
| 28 class PacketStatusChunk; | 50 class PacketStatusChunk; |
| 29 // TODO(sprang): IANA reg? | 51 // TODO(sprang): IANA reg? |
| 30 static constexpr uint8_t kFeedbackMessageType = 15; | 52 static constexpr uint8_t kFeedbackMessageType = 15; |
| 31 // Convert to multiples of 0.25ms. | 53 // Convert to multiples of 0.25ms. |
| 32 static constexpr int kDeltaScaleFactor = 250; | 54 static constexpr int kDeltaScaleFactor = 250; |
| 33 | 55 |
| 34 TransportFeedback(); | 56 TransportFeedback(); |
| 35 ~TransportFeedback() override; | 57 ~TransportFeedback() override; |
| 36 | 58 |
| 37 void SetBase(uint16_t base_sequence, // Seq# of first packet in this msg. | 59 void SetBase(uint16_t base_sequence, // Seq# of first packet in this msg. |
| 38 int64_t ref_timestamp_us); // Reference timestamp for this msg. | 60 int64_t ref_timestamp_us) // Reference timestamp for this msg. |
| 39 void SetFeedbackSequenceNumber(uint8_t feedback_sequence); | 61 override; |
| 62 void SetFeedbackSequenceNumber(uint8_t feedback_sequence) override; |
| 40 // NOTE: This method requires increasing sequence numbers (excepting wraps). | 63 // NOTE: This method requires increasing sequence numbers (excepting wraps). |
| 41 bool AddReceivedPacket(uint16_t sequence_number, int64_t timestamp_us); | 64 bool AddReceivedPacket(uint16_t sequence_number, |
| 65 int64_t timestamp_us) override; |
| 42 | 66 |
| 43 enum class StatusSymbol { | 67 uint16_t GetBaseSequence() const override; |
| 44 kNotReceived, | 68 std::vector<StatusSymbol> GetStatusVector() const override; |
| 45 kReceivedSmallDelta, | 69 std::vector<int16_t> GetReceiveDeltas() const override; |
| 46 kReceivedLargeDelta, | |
| 47 }; | |
| 48 | |
| 49 uint16_t GetBaseSequence() const; | |
| 50 std::vector<TransportFeedback::StatusSymbol> GetStatusVector() const; | |
| 51 std::vector<int16_t> GetReceiveDeltas() const; | |
| 52 | 70 |
| 53 // Get the reference time in microseconds, including any precision loss. | 71 // Get the reference time in microseconds, including any precision loss. |
| 54 int64_t GetBaseTimeUs() const; | 72 int64_t GetBaseTimeUs() const override; |
| 55 // Convenience method for getting all deltas as microseconds. The first delta | 73 // Convenience method for getting all deltas as microseconds. The first delta |
| 56 // is relative the base time. | 74 // is relative the base time. |
| 57 std::vector<int64_t> GetReceiveDeltasUs() const; | 75 std::vector<int64_t> GetReceiveDeltasUs() const override; |
| 58 | 76 |
| 59 bool Parse(const CommonHeader& packet); | 77 bool Parse(const CommonHeader& packet); |
| 60 static std::unique_ptr<TransportFeedback> ParseFrom(const uint8_t* buffer, | 78 static std::unique_ptr<TransportFeedback> ParseFrom(const uint8_t* buffer, |
| 61 size_t length); | 79 size_t length); |
| 62 | 80 |
| 63 RTC_DEPRECATED | 81 RTC_DEPRECATED |
| 64 void WithPacketSenderSsrc(uint32_t ssrc) { SetSenderSsrc(ssrc); } | 82 void WithPacketSenderSsrc(uint32_t ssrc) { SetSenderSsrc(ssrc); } |
| 65 RTC_DEPRECATED | 83 RTC_DEPRECATED |
| 66 void WithMediaSourceSsrc(uint32_t ssrc) { SetMediaSsrc(ssrc); } | 84 void WithMediaSourceSsrc(uint32_t ssrc) { SetMediaSsrc(ssrc); } |
| 67 RTC_DEPRECATED | 85 RTC_DEPRECATED |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 uint16_t first_symbol_cardinality_; | 128 uint16_t first_symbol_cardinality_; |
| 111 bool vec_needs_two_bit_symbols_; | 129 bool vec_needs_two_bit_symbols_; |
| 112 uint32_t size_bytes_; | 130 uint32_t size_bytes_; |
| 113 | 131 |
| 114 RTC_DISALLOW_COPY_AND_ASSIGN(TransportFeedback); | 132 RTC_DISALLOW_COPY_AND_ASSIGN(TransportFeedback); |
| 115 }; | 133 }; |
| 116 | 134 |
| 117 } // namespace rtcp | 135 } // namespace rtcp |
| 118 } // namespace webrtc | 136 } // namespace webrtc |
| 119 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TRANSPORT_FEEDBACK_H_ | 137 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TRANSPORT_FEEDBACK_H_ |
| OLD | NEW |