Line data Source code
1 : /*
2 : * Copyright (c) 2016 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 : #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_FIR_H_
12 : #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_FIR_H_
13 :
14 : #include <vector>
15 :
16 : #include "webrtc/base/basictypes.h"
17 : #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/psfb.h"
18 :
19 : namespace webrtc {
20 : namespace rtcp {
21 : class CommonHeader;
22 : // Full intra request (FIR) (RFC 5104).
23 : class Fir : public Psfb {
24 : public:
25 : static constexpr uint8_t kFeedbackMessageType = 4;
26 : struct Request {
27 0 : Request() : ssrc(0), seq_nr(0) {}
28 0 : Request(uint32_t ssrc, uint8_t seq_nr) : ssrc(ssrc), seq_nr(seq_nr) {}
29 : uint32_t ssrc;
30 : uint8_t seq_nr;
31 : };
32 :
33 0 : Fir() {}
34 0 : ~Fir() override {}
35 :
36 : // Parse assumes header is already parsed and validated.
37 : bool Parse(const CommonHeader& packet);
38 :
39 0 : void AddRequestTo(uint32_t ssrc, uint8_t seq_num) {
40 0 : items_.emplace_back(ssrc, seq_num);
41 0 : }
42 0 : const std::vector<Request>& requests() const { return items_; }
43 :
44 : protected:
45 : bool Create(uint8_t* packet,
46 : size_t* index,
47 : size_t max_length,
48 : RtcpPacket::PacketReadyCallback* callback) const override;
49 :
50 : private:
51 : static constexpr size_t kFciLength = 8;
52 0 : size_t BlockLength() const override {
53 0 : return kHeaderLength + kCommonFeedbackLength + kFciLength * items_.size();
54 : }
55 : // SSRC of media source is not used in FIR packet. Shadow base functions.
56 : void SetMediaSsrc(uint32_t ssrc);
57 : uint32_t media_ssrc() const;
58 :
59 : std::vector<Request> items_;
60 : };
61 : } // namespace rtcp
62 : } // namespace webrtc
63 : #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_FIR_H_
|