OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 * | |
10 */ | 9 */ |
11 | 10 |
12 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_FIR_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RPSI_H_ |
13 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_FIR_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RPSI_H_ |
14 | 13 |
15 #include "webrtc/base/basictypes.h" | 14 #include "webrtc/base/basictypes.h" |
16 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" | 15 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" |
17 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | 16 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
18 | 17 |
19 namespace webrtc { | 18 namespace webrtc { |
20 namespace rtcp { | 19 namespace rtcp { |
21 | 20 // Reference picture selection indication (RPSI) (RFC 4585). |
22 // Full intra request (FIR) (RFC 5104). | 21 class Rpsi : public RtcpPacket { |
23 class Fir : public RtcpPacket { | |
24 public: | 22 public: |
25 Fir() : RtcpPacket() { | 23 Rpsi() |
26 memset(&fir_, 0, sizeof(fir_)); | 24 : RtcpPacket(), |
27 memset(&fir_item_, 0, sizeof(fir_item_)); | 25 padding_bytes_(0) { |
| 26 memset(&rpsi_, 0, sizeof(rpsi_)); |
28 } | 27 } |
29 | 28 |
30 virtual ~Fir() {} | 29 virtual ~Rpsi() {} |
31 | 30 |
32 void From(uint32_t ssrc) { | 31 void From(uint32_t ssrc) { |
33 fir_.SenderSSRC = ssrc; | 32 rpsi_.SenderSSRC = ssrc; |
34 } | 33 } |
35 void To(uint32_t ssrc) { | 34 void To(uint32_t ssrc) { |
36 fir_item_.SSRC = ssrc; | 35 rpsi_.MediaSSRC = ssrc; |
37 } | 36 } |
38 void WithCommandSeqNum(uint8_t seq_num) { | 37 void WithPayloadType(uint8_t payload) { |
39 fir_item_.CommandSequenceNumber = seq_num; | 38 assert(payload <= 0x7f); |
| 39 rpsi_.PayloadType = payload; |
40 } | 40 } |
| 41 void WithPictureId(uint64_t picture_id); |
41 | 42 |
42 protected: | 43 protected: |
43 bool Create(uint8_t* packet, | 44 bool Create(uint8_t* packet, |
44 size_t* index, | 45 size_t* index, |
45 size_t max_length, | 46 size_t max_length, |
46 RtcpPacket::PacketReadyCallback* callback) const override; | 47 RtcpPacket::PacketReadyCallback* callback) const override; |
47 | 48 |
48 private: | 49 private: |
49 size_t BlockLength() const { | 50 size_t BlockLength() const { |
50 const size_t kFciLength = 8; | 51 size_t fci_length = 2 + (rpsi_.NumberOfValidBits / 8) + padding_bytes_; |
51 return kCommonFbFmtLength + kFciLength; | 52 return kCommonFbFmtLength + fci_length; |
52 } | 53 } |
53 | 54 |
54 RTCPUtility::RTCPPacketPSFBFIR fir_; | 55 uint8_t padding_bytes_; |
55 RTCPUtility::RTCPPacketPSFBFIRItem fir_item_; | 56 RTCPUtility::RTCPPacketPSFBRPSI rpsi_; |
| 57 |
| 58 RTC_DISALLOW_COPY_AND_ASSIGN(Rpsi); |
56 }; | 59 }; |
57 | |
58 } // namespace rtcp | 60 } // namespace rtcp |
59 } // namespace webrtc | 61 } // namespace webrtc |
60 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_FIR_H_ | 62 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RPSI_H_ |
OLD | NEW |