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

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

Issue 2937403002: Style fixes in rtcp_packet/ (Closed)
Patch Set: CR response Created 3 years, 6 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
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_packet/app.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/modules/rtp_rtcp/source/rtcp_packet.h" 15 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h"
16 16
17 namespace webrtc { 17 namespace webrtc {
18 namespace rtcp { 18 namespace rtcp {
19 class CommonHeader; 19 class CommonHeader;
20 20
21 class App : public RtcpPacket { 21 class App : public RtcpPacket {
22 public: 22 public:
23 static constexpr uint8_t kPacketType = 204; 23 static constexpr uint8_t kPacketType = 204;
24 App() : sub_type_(0), ssrc_(0), name_(0) {} 24 App();
25 ~App() override {} 25 ~App() override;
26 26
27 // Parse assumes header is already parsed and validated. 27 // Parse assumes header is already parsed and validated.
28 bool Parse(const CommonHeader& packet); 28 bool Parse(const CommonHeader& packet);
29 29
30 void SetSsrc(uint32_t ssrc) { ssrc_ = ssrc; } 30 void SetSsrc(uint32_t ssrc) { ssrc_ = ssrc; }
31 void SetSubType(uint8_t subtype); 31 void SetSubType(uint8_t subtype);
32 void SetName(uint32_t name) { name_ = name; } 32 void SetName(uint32_t name) { name_ = name; }
33 void SetData(const uint8_t* data, size_t data_length); 33 void SetData(const uint8_t* data, size_t data_length);
34 34
35 uint8_t sub_type() const { return sub_type_; } 35 uint8_t sub_type() const { return sub_type_; }
36 uint32_t ssrc() const { return ssrc_; } 36 uint32_t ssrc() const { return ssrc_; }
37 uint32_t name() const { return name_; } 37 uint32_t name() const { return name_; }
38 size_t data_size() const { return data_.size(); } 38 size_t data_size() const { return data_.size(); }
39 const uint8_t* data() const { return data_.data(); } 39 const uint8_t* data() const { return data_.data(); }
40 40
41 protected: 41 size_t BlockLength() const override;
42
42 bool Create(uint8_t* packet, 43 bool Create(uint8_t* packet,
43 size_t* index, 44 size_t* index,
44 size_t max_length, 45 size_t max_length,
45 RtcpPacket::PacketReadyCallback* callback) const override; 46 RtcpPacket::PacketReadyCallback* callback) const override;
46 47
47 private: 48 private:
48 static constexpr size_t kAppBaseLength = 8; // Ssrc and Name. 49 static constexpr size_t kAppBaseLength = 8; // Ssrc and Name.
49 static constexpr size_t kMaxDataSize = 0xffff * 4 - kAppBaseLength; 50 static constexpr size_t kMaxDataSize = 0xffff * 4 - kAppBaseLength;
50 size_t BlockLength() const override {
51 return kHeaderLength + kAppBaseLength + data_.size();
52 }
53 51
54 uint8_t sub_type_; 52 uint8_t sub_type_;
55 uint32_t ssrc_; 53 uint32_t ssrc_;
56 uint32_t name_; 54 uint32_t name_;
57 rtc::Buffer data_; 55 rtc::Buffer data_;
58 }; 56 };
59 57
60 } // namespace rtcp 58 } // namespace rtcp
61 } // namespace webrtc 59 } // namespace webrtc
62 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_APP_H_ 60 #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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698