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

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

Issue 1430013003: rtcp::Bye packet moved to own file and got a Parse function (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Merged with 'master' Created 5 years, 1 month 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) 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 private: 312 private:
313 static const int kMaxNumberOfChunks = 0x1f; 313 static const int kMaxNumberOfChunks = 0x1f;
314 314
315 size_t BlockLength() const; 315 size_t BlockLength() const;
316 316
317 std::vector<Chunk> chunks_; 317 std::vector<Chunk> chunks_;
318 318
319 RTC_DISALLOW_COPY_AND_ASSIGN(Sdes); 319 RTC_DISALLOW_COPY_AND_ASSIGN(Sdes);
320 }; 320 };
321 321
322 //
323 // Bye packet (BYE) (RFC 3550).
324 //
325 // 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
326 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
327 // |V=2|P| SC | PT=BYE=203 | length |
328 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
329 // | SSRC/CSRC |
330 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
331 // : ... :
332 // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
333 // (opt) | length | reason for leaving ...
334 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
335
336 class Bye : public RtcpPacket {
337 public:
338 Bye() : RtcpPacket() {
339 memset(&bye_, 0, sizeof(bye_));
340 }
341
342 virtual ~Bye() {}
343
344 void From(uint32_t ssrc) {
345 bye_.SenderSSRC = ssrc;
346 }
347
348 bool WithCsrc(uint32_t csrc);
349
350 // TODO(sprang): Add support for reason field?
351
352 protected:
353 bool Create(uint8_t* packet,
354 size_t* index,
355 size_t max_length,
356 RtcpPacket::PacketReadyCallback* callback) const override;
357
358 private:
359 static const int kMaxNumberOfCsrcs = 0x1f - 1; // First item is sender SSRC.
360
361 size_t BlockLength() const {
362 size_t source_count = 1 + csrcs_.size();
363 return kHeaderLength + 4 * source_count;
364 }
365
366 RTCPUtility::RTCPPacketBYE bye_;
367 std::vector<uint32_t> csrcs_;
368
369 RTC_DISALLOW_COPY_AND_ASSIGN(Bye);
370 };
371
372 // Application-Defined packet (APP) (RFC 3550). 322 // Application-Defined packet (APP) (RFC 3550).
373 // 323 //
374 // 0 1 2 3 324 // 0 1 2 3
375 // 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 325 // 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
376 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 326 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
377 // |V=2|P| subtype | PT=APP=204 | length | 327 // |V=2|P| subtype | PT=APP=204 | length |
378 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 328 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
379 // | SSRC/CSRC | 329 // | SSRC/CSRC |
380 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 330 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
381 // | name (ASCII) | 331 // | name (ASCII) |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 1006
1057 private: 1007 private:
1058 const size_t buffer_length_; 1008 const size_t buffer_length_;
1059 size_t length_; 1009 size_t length_;
1060 rtc::scoped_ptr<uint8_t[]> buffer_; 1010 rtc::scoped_ptr<uint8_t[]> buffer_;
1061 }; 1011 };
1062 1012
1063 } // namespace rtcp 1013 } // namespace rtcp
1064 } // namespace webrtc 1014 } // namespace webrtc
1065 #endif // WEBRTC_MODULES_RTP_RTCP_RTCP_PACKET_H_ 1015 #endif // WEBRTC_MODULES_RTP_RTCP_RTCP_PACKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698