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

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

Issue 1175263002: Add packetization and coding/decoding of feedback message format. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Make size constants unsigned Created 5 years, 4 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 | « webrtc/modules/rtp_rtcp/rtp_rtcp.gypi ('k') | webrtc/modules/rtp_rtcp/source/rtcp_packet.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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 */
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // IP_PACKET_SIZE will be allocated and reused between calls to callback. 85 // IP_PACKET_SIZE will be allocated and reused between calls to callback.
86 bool Build(PacketReadyCallback* callback) const; 86 bool Build(PacketReadyCallback* callback) const;
87 87
88 // Returns true if all calls to Create succeeded. Provided buffer reference 88 // Returns true if all calls to Create succeeded. Provided buffer reference
89 // will be used for all calls to callback. 89 // will be used for all calls to callback.
90 bool BuildExternalBuffer(uint8_t* buffer, 90 bool BuildExternalBuffer(uint8_t* buffer,
91 size_t max_length, 91 size_t max_length,
92 PacketReadyCallback* callback) const; 92 PacketReadyCallback* callback) const;
93 93
94 protected: 94 protected:
95 RtcpPacket() : kHeaderLength(4) {} 95 RtcpPacket() {}
96 96
97 virtual bool Create(uint8_t* packet, 97 virtual bool Create(uint8_t* packet,
98 size_t* index, 98 size_t* index,
99 size_t max_length, 99 size_t max_length,
100 PacketReadyCallback* callback) const = 0; 100 PacketReadyCallback* callback) const = 0;
101 101
102 void CreateHeader(uint8_t count_or_format,
103 uint8_t packet_type,
104 size_t length,
105 uint8_t* buffer,
106 size_t* pos) const;
107
102 bool OnBufferFull(uint8_t* packet, 108 bool OnBufferFull(uint8_t* packet,
103 size_t* index, 109 size_t* index,
104 RtcpPacket::PacketReadyCallback* callback) const; 110 RtcpPacket::PacketReadyCallback* callback) const;
105 111
106 const size_t kHeaderLength; 112 virtual size_t BlockLength() const = 0;
113 size_t HeaderLength() const;
114
115 static const size_t kHeaderLength = 4;
107 116
108 private: 117 private:
109 bool CreateAndAddAppended(uint8_t* packet, 118 bool CreateAndAddAppended(uint8_t* packet,
110 size_t* index, 119 size_t* index,
111 size_t max_length, 120 size_t max_length,
112 PacketReadyCallback* callback) const; 121 PacketReadyCallback* callback) const;
113 122
114 std::vector<RtcpPacket*> appended_packets_; 123 std::vector<RtcpPacket*> appended_packets_;
115 }; 124 };
116 125
126 // TODO(sprang): Move RtcpPacket subclasses out to separate files.
127
117 class Empty : public RtcpPacket { 128 class Empty : public RtcpPacket {
118 public: 129 public:
119 Empty() : RtcpPacket() {} 130 Empty() : RtcpPacket() {}
120 131
121 virtual ~Empty() {} 132 virtual ~Empty() {}
122 133
123 protected: 134 protected:
124 bool Create(uint8_t* packet, 135 bool Create(uint8_t* packet,
125 size_t* index, 136 size_t* index,
126 size_t max_length, 137 size_t max_length,
127 RtcpPacket::PacketReadyCallback* callback) const override; 138 RtcpPacket::PacketReadyCallback* callback) const override;
128 139
140 size_t BlockLength() const override;
141
129 private: 142 private:
130 DISALLOW_COPY_AND_ASSIGN(Empty); 143 DISALLOW_COPY_AND_ASSIGN(Empty);
131 }; 144 };
132 145
133 // From RFC 3550, RTP: A Transport Protocol for Real-Time Applications. 146 // From RFC 3550, RTP: A Transport Protocol for Real-Time Applications.
134 // 147 //
135 // RTCP report block (RFC 3550). 148 // RTCP report block (RFC 3550).
136 // 149 //
137 // 0 1 2 3 150 // 0 1 2 3
138 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 151 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 nack_.MediaSSRC = ssrc; 657 nack_.MediaSSRC = ssrc;
645 } 658 }
646 void WithList(const uint16_t* nack_list, int length); 659 void WithList(const uint16_t* nack_list, int length);
647 660
648 protected: 661 protected:
649 bool Create(uint8_t* packet, 662 bool Create(uint8_t* packet,
650 size_t* index, 663 size_t* index,
651 size_t max_length, 664 size_t max_length,
652 RtcpPacket::PacketReadyCallback* callback) const override; 665 RtcpPacket::PacketReadyCallback* callback) const override;
653 666
667 size_t BlockLength() const override;
668
654 private: 669 private:
655 670
656 RTCPUtility::RTCPPacketRTPFBNACK nack_; 671 RTCPUtility::RTCPPacketRTPFBNACK nack_;
657 std::vector<RTCPUtility::RTCPPacketRTPFBNACKItem> nack_fields_; 672 std::vector<RTCPUtility::RTCPPacketRTPFBNACKItem> nack_fields_;
658 673
659 DISALLOW_COPY_AND_ASSIGN(Nack); 674 DISALLOW_COPY_AND_ASSIGN(Nack);
660 }; 675 };
661 676
662 // Reference picture selection indication (RPSI) (RFC 4585). 677 // Reference picture selection indication (RPSI) (RFC 4585).
663 // 678 //
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 1155
1141 private: 1156 private:
1142 const size_t buffer_length_; 1157 const size_t buffer_length_;
1143 size_t length_; 1158 size_t length_;
1144 rtc::scoped_ptr<uint8_t[]> buffer_; 1159 rtc::scoped_ptr<uint8_t[]> buffer_;
1145 }; 1160 };
1146 1161
1147 } // namespace rtcp 1162 } // namespace rtcp
1148 } // namespace webrtc 1163 } // namespace webrtc
1149 #endif // WEBRTC_MODULES_RTP_RTCP_RTCP_PACKET_H_ 1164 #endif // WEBRTC_MODULES_RTP_RTCP_RTCP_PACKET_H_
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/rtp_rtcp.gypi ('k') | webrtc/modules/rtp_rtcp/source/rtcp_packet.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698