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 |
(...skipping 15 matching lines...) Expand all Loading... |
26 public: | 26 public: |
27 class PacketStatusChunk; | 27 class PacketStatusChunk; |
28 // TODO(sprang): IANA reg? | 28 // TODO(sprang): IANA reg? |
29 static constexpr uint8_t kFeedbackMessageType = 15; | 29 static constexpr uint8_t kFeedbackMessageType = 15; |
30 // Convert to multiples of 0.25ms. | 30 // Convert to multiples of 0.25ms. |
31 static constexpr int kDeltaScaleFactor = 250; | 31 static constexpr int kDeltaScaleFactor = 250; |
32 | 32 |
33 TransportFeedback(); | 33 TransportFeedback(); |
34 ~TransportFeedback() override; | 34 ~TransportFeedback() override; |
35 | 35 |
36 void WithPacketSenderSsrc(uint32_t ssrc) { From(ssrc); } | 36 void SetBase(uint16_t base_sequence, // Seq# of first packet in this msg. |
37 void WithMediaSourceSsrc(uint32_t ssrc) { To(ssrc); } | 37 int64_t ref_timestamp_us); // Reference timestamp for this msg. |
38 void WithBase(uint16_t base_sequence, // Seq# of first packet in this msg. | 38 void SetFeedbackSequenceNumber(uint8_t feedback_sequence); |
39 int64_t ref_timestamp_us); // Reference timestamp for this msg. | |
40 void WithFeedbackSequenceNumber(uint8_t feedback_sequence); | |
41 // NOTE: This method requires increasing sequence numbers (excepting wraps). | 39 // NOTE: This method requires increasing sequence numbers (excepting wraps). |
42 bool WithReceivedPacket(uint16_t sequence_number, int64_t timestamp_us); | 40 bool AddReceivedPacket(uint16_t sequence_number, int64_t timestamp_us); |
43 | 41 |
44 enum class StatusSymbol { | 42 enum class StatusSymbol { |
45 kNotReceived, | 43 kNotReceived, |
46 kReceivedSmallDelta, | 44 kReceivedSmallDelta, |
47 kReceivedLargeDelta, | 45 kReceivedLargeDelta, |
48 }; | 46 }; |
49 | 47 |
50 uint16_t GetBaseSequence() const; | 48 uint16_t GetBaseSequence() const; |
51 std::vector<TransportFeedback::StatusSymbol> GetStatusVector() const; | 49 std::vector<TransportFeedback::StatusSymbol> GetStatusVector() const; |
52 std::vector<int16_t> GetReceiveDeltas() const; | 50 std::vector<int16_t> GetReceiveDeltas() const; |
53 | 51 |
54 // Get the reference time in microseconds, including any precision loss. | 52 // Get the reference time in microseconds, including any precision loss. |
55 int64_t GetBaseTimeUs() const; | 53 int64_t GetBaseTimeUs() const; |
56 // Convenience method for getting all deltas as microseconds. The first delta | 54 // Convenience method for getting all deltas as microseconds. The first delta |
57 // is relative the base time. | 55 // is relative the base time. |
58 std::vector<int64_t> GetReceiveDeltasUs() const; | 56 std::vector<int64_t> GetReceiveDeltasUs() const; |
59 | 57 |
60 uint32_t GetPacketSenderSsrc() const { return sender_ssrc(); } | |
61 uint32_t GetMediaSourceSsrc() const { return media_ssrc(); } | |
62 | |
63 bool Parse(const CommonHeader& packet); | 58 bool Parse(const CommonHeader& packet); |
64 static std::unique_ptr<TransportFeedback> ParseFrom(const uint8_t* buffer, | 59 static std::unique_ptr<TransportFeedback> ParseFrom(const uint8_t* buffer, |
65 size_t length); | 60 size_t length); |
66 | 61 |
67 protected: | 62 protected: |
68 bool Create(uint8_t* packet, | 63 bool Create(uint8_t* packet, |
69 size_t* position, | 64 size_t* position, |
70 size_t max_length, | 65 size_t max_length, |
71 PacketReadyCallback* callback) const override; | 66 PacketReadyCallback* callback) const override; |
72 | 67 |
(...skipping 24 matching lines...) Expand all Loading... |
97 uint16_t first_symbol_cardinality_; | 92 uint16_t first_symbol_cardinality_; |
98 bool vec_needs_two_bit_symbols_; | 93 bool vec_needs_two_bit_symbols_; |
99 uint32_t size_bytes_; | 94 uint32_t size_bytes_; |
100 | 95 |
101 RTC_DISALLOW_COPY_AND_ASSIGN(TransportFeedback); | 96 RTC_DISALLOW_COPY_AND_ASSIGN(TransportFeedback); |
102 }; | 97 }; |
103 | 98 |
104 } // namespace rtcp | 99 } // namespace rtcp |
105 } // namespace webrtc | 100 } // namespace webrtc |
106 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TRANSPORT_FEEDBACK_H_ | 101 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TRANSPORT_FEEDBACK_H_ |
OLD | NEW |