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 * | 9 * |
10 */ | 10 */ |
11 | 11 |
12 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBN_H_ | 12 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_FIR_H_ |
13 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBN_H_ | 13 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_FIR_H_ |
14 | 14 |
15 #include <vector> | |
16 #include "webrtc/base/basictypes.h" | 15 #include "webrtc/base/basictypes.h" |
17 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" | 16 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" |
18 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | 17 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
19 | 18 |
20 namespace webrtc { | 19 namespace webrtc { |
21 namespace rtcp { | 20 namespace rtcp { |
22 | 21 |
23 // Temporary Maximum Media Stream Bit Rate Notification (TMMBN) (RFC 5104). | 22 // Full intra request (FIR) (RFC 5104). |
24 class Tmmbn : public RtcpPacket { | 23 class Fir : public RtcpPacket { |
25 public: | 24 public: |
26 Tmmbn() : RtcpPacket() { | 25 Fir() : RtcpPacket() { |
27 memset(&tmmbn_, 0, sizeof(tmmbn_)); | 26 memset(&fir_, 0, sizeof(fir_)); |
| 27 memset(&fir_item_, 0, sizeof(fir_item_)); |
28 } | 28 } |
29 | 29 |
30 virtual ~Tmmbn() {} | 30 virtual ~Fir() {} |
31 | 31 |
32 void From(uint32_t ssrc) { | 32 void From(uint32_t ssrc) { |
33 tmmbn_.SenderSSRC = ssrc; | 33 fir_.SenderSSRC = ssrc; |
34 } | 34 } |
35 // Max 50 TMMBR can be added per TMMBN. | 35 void To(uint32_t ssrc) { |
36 bool WithTmmbr(uint32_t ssrc, uint32_t bitrate_kbps, uint16_t overhead); | 36 fir_item_.SSRC = ssrc; |
| 37 } |
| 38 void WithCommandSeqNum(uint8_t seq_num) { |
| 39 fir_item_.CommandSequenceNumber = seq_num; |
| 40 } |
37 | 41 |
38 protected: | 42 protected: |
39 bool Create(uint8_t* packet, | 43 bool Create(uint8_t* packet, |
40 size_t* index, | 44 size_t* index, |
41 size_t max_length, | 45 size_t max_length, |
42 RtcpPacket::PacketReadyCallback* callback) const override; | 46 RtcpPacket::PacketReadyCallback* callback) const override; |
43 | 47 |
44 private: | 48 private: |
45 static const int kMaxNumberOfTmmbrs = 50; | |
46 | |
47 size_t BlockLength() const { | 49 size_t BlockLength() const { |
48 const size_t kFciLen = 8; | 50 const size_t kFciLength = 8; |
49 return kCommonFbFmtLength + kFciLen * tmmbn_items_.size(); | 51 return kCommonFbFmtLength + kFciLength; |
50 } | 52 } |
51 | 53 |
52 RTCPUtility::RTCPPacketRTPFBTMMBN tmmbn_; | 54 RTCPUtility::RTCPPacketPSFBFIR fir_; |
53 std::vector<RTCPUtility::RTCPPacketRTPFBTMMBRItem> tmmbn_items_; | 55 RTCPUtility::RTCPPacketPSFBFIRItem fir_item_; |
54 | |
55 RTC_DISALLOW_COPY_AND_ASSIGN(Tmmbn); | |
56 }; | 56 }; |
57 | 57 |
58 } // namespace rtcp | 58 } // namespace rtcp |
59 } // namespace webrtc | 59 } // namespace webrtc |
60 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBN_H_ | 60 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_FIR_H_ |
OLD | NEW |