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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 size_t source_count = 1 + csrcs_.size(); | 362 size_t source_count = 1 + csrcs_.size(); |
363 return kHeaderLength + 4 * source_count; | 363 return kHeaderLength + 4 * source_count; |
364 } | 364 } |
365 | 365 |
366 RTCPUtility::RTCPPacketBYE bye_; | 366 RTCPUtility::RTCPPacketBYE bye_; |
367 std::vector<uint32_t> csrcs_; | 367 std::vector<uint32_t> csrcs_; |
368 | 368 |
369 RTC_DISALLOW_COPY_AND_ASSIGN(Bye); | 369 RTC_DISALLOW_COPY_AND_ASSIGN(Bye); |
370 }; | 370 }; |
371 | 371 |
372 // Application-Defined packet (APP) (RFC 3550). | |
373 // | |
374 // 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 | |
376 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
377 // |V=2|P| subtype | PT=APP=204 | length | | |
378 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
379 // | SSRC/CSRC | | |
380 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
381 // | name (ASCII) | | |
382 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
383 // | application-dependent data ... | |
384 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
385 | |
386 class App : public RtcpPacket { | |
387 public: | |
388 App() | |
389 : RtcpPacket(), | |
390 ssrc_(0) { | |
391 memset(&app_, 0, sizeof(app_)); | |
392 } | |
393 | |
394 virtual ~App() {} | |
395 | |
396 void From(uint32_t ssrc) { | |
397 ssrc_ = ssrc; | |
398 } | |
399 void WithSubType(uint8_t subtype) { | |
400 assert(subtype <= 0x1f); | |
401 app_.SubType = subtype; | |
402 } | |
403 void WithName(uint32_t name) { | |
404 app_.Name = name; | |
405 } | |
406 void WithData(const uint8_t* data, uint16_t data_length) { | |
407 assert(data); | |
408 assert(data_length <= kRtcpAppCode_DATA_SIZE); | |
409 assert(data_length % 4 == 0); | |
410 memcpy(app_.Data, data, data_length); | |
411 app_.Size = data_length; | |
412 } | |
413 | |
414 protected: | |
415 bool Create(uint8_t* packet, | |
416 size_t* index, | |
417 size_t max_length, | |
418 RtcpPacket::PacketReadyCallback* callback) const override; | |
419 | |
420 private: | |
421 size_t BlockLength() const { | |
422 return 12 + app_.Size; | |
423 } | |
424 | |
425 uint32_t ssrc_; | |
426 RTCPUtility::RTCPPacketAPP app_; | |
427 | |
428 RTC_DISALLOW_COPY_AND_ASSIGN(App); | |
429 }; | |
430 | |
431 // RFC 4585: Feedback format. | 372 // RFC 4585: Feedback format. |
432 // | 373 // |
433 // Common packet format: | 374 // Common packet format: |
434 // | 375 // |
435 // 0 1 2 3 | 376 // 0 1 2 3 |
436 // 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 | 377 // 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 |
437 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 378 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
438 // |V=2|P| FMT | PT | length | | 379 // |V=2|P| FMT | PT | length | |
439 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 380 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
440 // | SSRC of packet sender | | 381 // | SSRC of packet sender | |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 | 997 |
1057 private: | 998 private: |
1058 const size_t buffer_length_; | 999 const size_t buffer_length_; |
1059 size_t length_; | 1000 size_t length_; |
1060 rtc::scoped_ptr<uint8_t[]> buffer_; | 1001 rtc::scoped_ptr<uint8_t[]> buffer_; |
1061 }; | 1002 }; |
1062 | 1003 |
1063 } // namespace rtcp | 1004 } // namespace rtcp |
1064 } // namespace webrtc | 1005 } // namespace webrtc |
1065 #endif // WEBRTC_MODULES_RTP_RTCP_RTCP_PACKET_H_ | 1006 #endif // WEBRTC_MODULES_RTP_RTCP_RTCP_PACKET_H_ |
OLD | NEW |