Chromium Code Reviews| 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 class TransportFeedback : public Rtpfb, public TransportFeedbackInterface { |
|
kwiberg-webrtc
2017/01/05 02:51:12
Can this class be final now?
minyue-webrtc
2017/01/19 10:57:55
sorry, I wanted to make it that way but PacketCoun
| |
| 27 public: | 47 public: |
| 28 class PacketStatusChunk; | 48 class PacketStatusChunk; |
| 29 // TODO(sprang): IANA reg? | 49 // TODO(sprang): IANA reg? |
| 30 static constexpr uint8_t kFeedbackMessageType = 15; | 50 static constexpr uint8_t kFeedbackMessageType = 15; |
| 31 // Convert to multiples of 0.25ms. | 51 // Convert to multiples of 0.25ms. |
| 32 static constexpr int kDeltaScaleFactor = 250; | 52 static constexpr int kDeltaScaleFactor = 250; |
| 33 | 53 |
| 34 TransportFeedback(); | 54 TransportFeedback(); |
| 35 ~TransportFeedback() override; | 55 ~TransportFeedback() override; |
| 36 | 56 |
| 37 void SetBase(uint16_t base_sequence, // Seq# of first packet in this msg. | 57 void SetBase(uint16_t base_sequence, // Seq# of first packet in this msg. |
| 38 int64_t ref_timestamp_us); // Reference timestamp for this msg. | 58 int64_t ref_timestamp_us) // Reference timestamp for this msg. |
| 39 void SetFeedbackSequenceNumber(uint8_t feedback_sequence); | 59 override; |
| 60 void SetFeedbackSequenceNumber(uint8_t feedback_sequence) override; | |
| 40 // NOTE: This method requires increasing sequence numbers (excepting wraps). | 61 // NOTE: This method requires increasing sequence numbers (excepting wraps). |
| 41 bool AddReceivedPacket(uint16_t sequence_number, int64_t timestamp_us); | 62 bool AddReceivedPacket(uint16_t sequence_number, |
| 63 int64_t timestamp_us) override; | |
| 42 | 64 |
| 43 enum class StatusSymbol { | 65 uint16_t GetBaseSequence() const override; |
| 44 kNotReceived, | 66 std::vector<StatusSymbol> GetStatusVector() const override; |
| 45 kReceivedSmallDelta, | 67 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 | 68 |
| 53 // Get the reference time in microseconds, including any precision loss. | 69 // Get the reference time in microseconds, including any precision loss. |
| 54 int64_t GetBaseTimeUs() const; | 70 int64_t GetBaseTimeUs() const override; |
| 55 // Convenience method for getting all deltas as microseconds. The first delta | 71 // Convenience method for getting all deltas as microseconds. The first delta |
| 56 // is relative the base time. | 72 // is relative the base time. |
| 57 std::vector<int64_t> GetReceiveDeltasUs() const; | 73 std::vector<int64_t> GetReceiveDeltasUs() const override; |
| 58 | 74 |
| 59 bool Parse(const CommonHeader& packet); | 75 bool Parse(const CommonHeader& packet); |
| 60 static std::unique_ptr<TransportFeedback> ParseFrom(const uint8_t* buffer, | 76 static std::unique_ptr<TransportFeedback> ParseFrom(const uint8_t* buffer, |
| 61 size_t length); | 77 size_t length); |
| 62 | 78 |
| 63 RTC_DEPRECATED | 79 RTC_DEPRECATED |
| 64 void WithPacketSenderSsrc(uint32_t ssrc) { SetSenderSsrc(ssrc); } | 80 void WithPacketSenderSsrc(uint32_t ssrc) { SetSenderSsrc(ssrc); } |
| 65 RTC_DEPRECATED | 81 RTC_DEPRECATED |
| 66 void WithMediaSourceSsrc(uint32_t ssrc) { SetMediaSsrc(ssrc); } | 82 void WithMediaSourceSsrc(uint32_t ssrc) { SetMediaSsrc(ssrc); } |
| 67 RTC_DEPRECATED | 83 RTC_DEPRECATED |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 uint16_t first_symbol_cardinality_; | 126 uint16_t first_symbol_cardinality_; |
| 111 bool vec_needs_two_bit_symbols_; | 127 bool vec_needs_two_bit_symbols_; |
| 112 uint32_t size_bytes_; | 128 uint32_t size_bytes_; |
| 113 | 129 |
| 114 RTC_DISALLOW_COPY_AND_ASSIGN(TransportFeedback); | 130 RTC_DISALLOW_COPY_AND_ASSIGN(TransportFeedback); |
| 115 }; | 131 }; |
| 116 | 132 |
| 117 } // namespace rtcp | 133 } // namespace rtcp |
| 118 } // namespace webrtc | 134 } // namespace webrtc |
| 119 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TRANSPORT_FEEDBACK_H_ | 135 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TRANSPORT_FEEDBACK_H_ |
| OLD | NEW |