Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h

Issue 1998633002: [rtcp] App::Parse updated not to use RTCPUtility, (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_APP_H_ 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_APP_H_
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_APP_H_ 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_APP_H_
13 13
14 #include "webrtc/base/buffer.h" 14 #include "webrtc/base/buffer.h"
15 #include "webrtc/base/constructormagic.h" 15 #include "webrtc/base/constructormagic.h"
16 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.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"
19 17
20 namespace webrtc { 18 namespace webrtc {
21 namespace rtcp { 19 namespace rtcp {
20 class CommonHeader;
22 21
23 class App : public RtcpPacket { 22 class App : public RtcpPacket {
24 public: 23 public:
25 static const uint8_t kPacketType = 204; 24 static constexpr uint8_t kPacketType = 204;
26 // 28 bytes for UDP header
27 // 12 bytes for RTCP app header
28 static const size_t kMaxDataSize = IP_PACKET_SIZE - 12 - 28;
29 App() : sub_type_(0), ssrc_(0), name_(0) {} 25 App() : sub_type_(0), ssrc_(0), name_(0) {}
30 26 ~App() override {}
31 virtual ~App() {}
32 27
33 // Parse assumes header is already parsed and validated. 28 // Parse assumes header is already parsed and validated.
34 bool Parse(const RTCPUtility::RtcpCommonHeader& header, 29 bool Parse(const CommonHeader& packet);
35 const uint8_t* payload); // Size of the payload is in the header.
36 30
37 void From(uint32_t ssrc) { ssrc_ = ssrc; } 31 void From(uint32_t ssrc) { ssrc_ = ssrc; }
38 void WithSubType(uint8_t subtype); 32 void WithSubType(uint8_t subtype);
39 void WithName(uint32_t name) { name_ = name; } 33 void WithName(uint32_t name) { name_ = name; }
40 void WithData(const uint8_t* data, size_t data_length); 34 void WithData(const uint8_t* data, size_t data_length);
41 35
42 uint8_t sub_type() const { return sub_type_; } 36 uint8_t sub_type() const { return sub_type_; }
43 uint32_t ssrc() const { return ssrc_; } 37 uint32_t ssrc() const { return ssrc_; }
44 uint32_t name() const { return name_; } 38 uint32_t name() const { return name_; }
45 size_t data_size() const { return data_.size(); } 39 size_t data_size() const { return data_.size(); }
46 const uint8_t* data() const { return data_.data(); } 40 const uint8_t* data() const { return data_.data(); }
47 41
48 protected: 42 protected:
49 bool Create(uint8_t* packet, 43 bool Create(uint8_t* packet,
50 size_t* index, 44 size_t* index,
51 size_t max_length, 45 size_t max_length,
52 RtcpPacket::PacketReadyCallback* callback) const override; 46 RtcpPacket::PacketReadyCallback* callback) const override;
53 47
54 private: 48 private:
55 size_t BlockLength() const override { return 12 + data_.size(); } 49 static constexpr size_t kAppBaseLength = 8; // Ssrc and Name.
50 static constexpr size_t kMaxDataSize = 0xffff * 4 - kAppBaseLength;
51 size_t BlockLength() const override {
52 return kHeaderLength + kAppBaseLength + data_.size();
53 }
56 54
57 uint8_t sub_type_; 55 uint8_t sub_type_;
58 uint32_t ssrc_; 56 uint32_t ssrc_;
59 uint32_t name_; 57 uint32_t name_;
60 rtc::Buffer data_; 58 rtc::Buffer data_;
61 59
62 RTC_DISALLOW_COPY_AND_ASSIGN(App); 60 RTC_DISALLOW_COPY_AND_ASSIGN(App);
63 }; 61 };
64 62
65 } // namespace rtcp 63 } // namespace rtcp
66 } // namespace webrtc 64 } // namespace webrtc
67 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_APP_H_ 65 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_APP_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_packet/app.cc » ('j') | webrtc/modules/rtp_rtcp/source/rtcp_packet/app.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698