1 /*
2  *  Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  *
10  */
11 
12 #ifndef MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_PSFB_H_
13 #define MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_PSFB_H_
14 
15 #include <stddef.h>
16 #include <stdint.h>
17 
18 #include "modules/rtp_rtcp/source/rtcp_packet.h"
19 
20 namespace webrtc {
21 namespace rtcp {
22 
23 // PSFB: Payload-specific feedback message.
24 // RFC 4585, Section 6.3.
25 class Psfb : public RtcpPacket {
26  public:
27   static constexpr uint8_t kPacketType = 206;
28   static constexpr uint8_t kAfbMessageType = 15;
29 
30   Psfb() = default;
31   ~Psfb() override = default;
32 
SetMediaSsrc(uint32_t ssrc)33   void SetMediaSsrc(uint32_t ssrc) { media_ssrc_ = ssrc; }
34 
media_ssrc()35   uint32_t media_ssrc() const { return media_ssrc_; }
36 
37  protected:
38   static constexpr size_t kCommonFeedbackLength = 8;
39   void ParseCommonFeedback(const uint8_t* payload);
40   void CreateCommonFeedback(uint8_t* payload) const;
41 
42  private:
43   uint32_t media_ssrc_ = 0;
44 };
45 
46 }  // namespace rtcp
47 }  // namespace webrtc
48 #endif  // MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_PSFB_H_
49