OLD | NEW |
---|---|
(Empty) | |
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 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_APP_H_ | |
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_APP_H_ | |
13 | |
14 #include <vector> | |
åsapersson
2015/11/17 15:31:36
needed?
danilchap
2015/11/17 17:12:36
Done.
| |
15 | |
16 #include "webrtc/base/buffer.h" | |
17 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | |
18 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" | |
19 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | |
20 | |
21 namespace webrtc { | |
22 namespace rtcp { | |
23 | |
24 class App : public RtcpPacket { | |
25 public: | |
26 static const uint8_t kPacketType = 204; | |
27 // 28 bytes for UDP header | |
28 // 12 bytes for RTCP app header | |
29 static const size_t kMaxDataSize = IP_PACKET_SIZE - 12 - 28; | |
30 App() : sub_type_(0), ssrc_(0), name_(0) {} | |
31 | |
32 virtual ~App() {} | |
33 | |
34 // Parse assumes header is already parsed and validated. | |
35 bool Parse(const RTCPUtility::RtcpCommonHeader& header, | |
36 const uint8_t* payload); // Size of the payload is in the header. | |
37 | |
38 void From(uint32_t ssrc) { ssrc_ = ssrc; } | |
39 bool WithSubType(uint8_t subtype); | |
40 void WithName(uint32_t name) { name_ = name; } | |
41 bool WithData(const uint8_t* data, size_t data_length); | |
42 | |
43 uint8_t sub_type() const { return sub_type_; } | |
44 uint32_t ssrc() const { return ssrc_; } | |
45 uint32_t name() const { return name_; } | |
46 size_t data_size() const { return data_.size(); } | |
47 const uint8_t* data() const { return data_.data(); } | |
48 | |
49 protected: | |
50 bool Create(uint8_t* packet, | |
51 size_t* index, | |
52 size_t max_length, | |
53 RtcpPacket::PacketReadyCallback* callback) const override; | |
54 | |
55 private: | |
56 size_t BlockLength() const override { return 12 + data_.size(); } | |
57 | |
58 uint8_t sub_type_; | |
59 uint32_t ssrc_; | |
60 uint32_t name_; | |
61 rtc::Buffer data_; | |
62 | |
63 RTC_DISALLOW_COPY_AND_ASSIGN(App); | |
64 }; | |
65 | |
66 } // namespace rtcp | |
67 } // namespace webrtc | |
68 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_APP_H_ | |
OLD | NEW |