OLD | NEW |
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 AssignUWord32(buffer, pos, (*it).SSRC); | 162 AssignUWord32(buffer, pos, (*it).SSRC); |
163 AssignUWord8(buffer, pos, (*it).FractionLost); | 163 AssignUWord8(buffer, pos, (*it).FractionLost); |
164 AssignUWord24(buffer, pos, (*it).CumulativeNumOfPacketsLost); | 164 AssignUWord24(buffer, pos, (*it).CumulativeNumOfPacketsLost); |
165 AssignUWord32(buffer, pos, (*it).ExtendedHighestSequenceNumber); | 165 AssignUWord32(buffer, pos, (*it).ExtendedHighestSequenceNumber); |
166 AssignUWord32(buffer, pos, (*it).Jitter); | 166 AssignUWord32(buffer, pos, (*it).Jitter); |
167 AssignUWord32(buffer, pos, (*it).LastSR); | 167 AssignUWord32(buffer, pos, (*it).LastSR); |
168 AssignUWord32(buffer, pos, (*it).DelayLastSR); | 168 AssignUWord32(buffer, pos, (*it).DelayLastSR); |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 // Transmission Time Offsets in RTP Streams (RFC 5450). | |
173 // | |
174 // 0 1 2 3 | |
175 // 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 | |
176 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
177 // hdr |V=2|P| RC | PT=IJ=195 | length | | |
178 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
179 // | inter-arrival jitter | | |
180 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
181 // . . | |
182 // . . | |
183 // . . | |
184 // | inter-arrival jitter | | |
185 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
186 | |
187 void CreateIj(const std::vector<uint32_t>& ij_items, | |
188 uint8_t* buffer, | |
189 size_t* pos) { | |
190 for (uint32_t item : ij_items) | |
191 AssignUWord32(buffer, pos, item); | |
192 } | |
193 | |
194 // Source Description (SDES) (RFC 3550). | 172 // Source Description (SDES) (RFC 3550). |
195 // | 173 // |
196 // 0 1 2 3 | 174 // 0 1 2 3 |
197 // 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 | 175 // 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 |
198 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 176 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
199 // header |V=2|P| SC | PT=SDES=202 | length | | 177 // header |V=2|P| SC | PT=SDES=202 | length | |
200 // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ | 178 // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ |
201 // chunk | SSRC/CSRC_1 | | 179 // chunk | SSRC/CSRC_1 | |
202 // 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 180 // 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
203 // | SDES items | | 181 // | SDES items | |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 bool ReceiverReport::WithReportBlock(const ReportBlock& block) { | 781 bool ReceiverReport::WithReportBlock(const ReportBlock& block) { |
804 if (report_blocks_.size() >= kMaxNumberOfReportBlocks) { | 782 if (report_blocks_.size() >= kMaxNumberOfReportBlocks) { |
805 LOG(LS_WARNING) << "Max report blocks reached."; | 783 LOG(LS_WARNING) << "Max report blocks reached."; |
806 return false; | 784 return false; |
807 } | 785 } |
808 report_blocks_.push_back(block.report_block_); | 786 report_blocks_.push_back(block.report_block_); |
809 rr_.NumberOfReportBlocks = report_blocks_.size(); | 787 rr_.NumberOfReportBlocks = report_blocks_.size(); |
810 return true; | 788 return true; |
811 } | 789 } |
812 | 790 |
813 bool Ij::Create(uint8_t* packet, | |
814 size_t* index, | |
815 size_t max_length, | |
816 RtcpPacket::PacketReadyCallback* callback) const { | |
817 while (*index + BlockLength() > max_length) { | |
818 if (!OnBufferFull(packet, index, callback)) | |
819 return false; | |
820 } | |
821 size_t length = ij_items_.size(); | |
822 CreateHeader(length, PT_IJ, length, packet, index); | |
823 CreateIj(ij_items_, packet, index); | |
824 return true; | |
825 } | |
826 | |
827 bool Ij::WithJitterItem(uint32_t jitter) { | |
828 if (ij_items_.size() >= kMaxNumberOfIjItems) { | |
829 LOG(LS_WARNING) << "Max inter-arrival jitter items reached."; | |
830 return false; | |
831 } | |
832 ij_items_.push_back(jitter); | |
833 return true; | |
834 } | |
835 | |
836 bool Sdes::Create(uint8_t* packet, | 791 bool Sdes::Create(uint8_t* packet, |
837 size_t* index, | 792 size_t* index, |
838 size_t max_length, | 793 size_t max_length, |
839 RtcpPacket::PacketReadyCallback* callback) const { | 794 RtcpPacket::PacketReadyCallback* callback) const { |
840 assert(!chunks_.empty()); | 795 assert(!chunks_.empty()); |
841 while (*index + BlockLength() > max_length) { | 796 while (*index + BlockLength() > max_length) { |
842 if (!OnBufferFull(packet, index, callback)) | 797 if (!OnBufferFull(packet, index, callback)) |
843 return false; | 798 return false; |
844 } | 799 } |
845 CreateHeader(chunks_.size(), PT_SDES, HeaderLength(), packet, index); | 800 CreateHeader(chunks_.size(), PT_SDES, HeaderLength(), packet, index); |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 return length_; | 1175 return length_; |
1221 } | 1176 } |
1222 | 1177 |
1223 void RawPacket::SetLength(size_t length) { | 1178 void RawPacket::SetLength(size_t length) { |
1224 assert(length <= buffer_length_); | 1179 assert(length <= buffer_length_); |
1225 length_ = length; | 1180 length_ = length; |
1226 } | 1181 } |
1227 | 1182 |
1228 } // namespace rtcp | 1183 } // namespace rtcp |
1229 } // namespace webrtc | 1184 } // namespace webrtc |
OLD | NEW |