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 */ |
11 | 11 |
12 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_H_ | 12 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_H_ |
13 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_H_ | 13 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_H_ |
14 | 14 |
15 #include <map> | 15 #include <map> |
16 #include <string> | 16 #include <string> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "webrtc/base/scoped_ptr.h" | 19 #include "webrtc/base/scoped_ptr.h" |
20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 21 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/dlrr.h" |
21 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.h" | 22 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.h" |
22 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rrtr.h" | 23 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rrtr.h" |
23 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | 24 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
24 #include "webrtc/typedefs.h" | 25 #include "webrtc/typedefs.h" |
25 | 26 |
26 namespace webrtc { | 27 namespace webrtc { |
27 namespace rtcp { | 28 namespace rtcp { |
28 | 29 |
29 static const int kCommonFbFmtLength = 12; | 30 static const int kCommonFbFmtLength = 12; |
30 static const int kReportBlockLength = 24; | 31 static const int kReportBlockLength = 24; |
31 | 32 |
32 class Dlrr; | |
33 class RawPacket; | 33 class RawPacket; |
34 class VoipMetric; | 34 class VoipMetric; |
35 | 35 |
36 // Class for building RTCP packets. | 36 // Class for building RTCP packets. |
37 // | 37 // |
38 // Example: | 38 // Example: |
39 // ReportBlock report_block; | 39 // ReportBlock report_block; |
40 // report_block.To(234) | 40 // report_block.To(234) |
41 // report_block.FractionLost(10); | 41 // report_block.FractionLost(10); |
42 // | 42 // |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 | 673 |
674 size_t DlrrLength() const; | 674 size_t DlrrLength() const; |
675 | 675 |
676 size_t VoipMetricLength() const { | 676 size_t VoipMetricLength() const { |
677 const size_t kVoipMetricBlockLength = 36; | 677 const size_t kVoipMetricBlockLength = 36; |
678 return kVoipMetricBlockLength * voip_metric_blocks_.size(); | 678 return kVoipMetricBlockLength * voip_metric_blocks_.size(); |
679 } | 679 } |
680 | 680 |
681 RTCPUtility::RTCPPacketXR xr_header_; | 681 RTCPUtility::RTCPPacketXR xr_header_; |
682 std::vector<Rrtr> rrtr_blocks_; | 682 std::vector<Rrtr> rrtr_blocks_; |
683 std::vector<DlrrBlock> dlrr_blocks_; | 683 std::vector<Dlrr> dlrr_blocks_; |
684 std::vector<RTCPUtility::RTCPPacketXRVOIPMetricItem> voip_metric_blocks_; | 684 std::vector<RTCPUtility::RTCPPacketXRVOIPMetricItem> voip_metric_blocks_; |
685 | 685 |
686 RTC_DISALLOW_COPY_AND_ASSIGN(Xr); | 686 RTC_DISALLOW_COPY_AND_ASSIGN(Xr); |
687 }; | 687 }; |
688 | 688 |
689 // DLRR Report Block (RFC 3611). | |
690 // | |
691 // 0 1 2 3 | |
692 // 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 | |
693 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
694 // | BT=5 | reserved | block length | | |
695 // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ | |
696 // | SSRC_1 (SSRC of first receiver) | sub- | |
697 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ block | |
698 // | last RR (LRR) | 1 | |
699 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
700 // | delay since last RR (DLRR) | | |
701 // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ | |
702 // | SSRC_2 (SSRC of second receiver) | sub- | |
703 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ block | |
704 // : ... : 2 | |
705 | |
706 class Dlrr { | |
707 public: | |
708 Dlrr() {} | |
709 ~Dlrr() {} | |
710 | |
711 // Max 100 DLRR Items can be added per DLRR report block. | |
712 bool WithDlrrItem(uint32_t ssrc, uint32_t last_rr, uint32_t delay_last_rr); | |
713 | |
714 private: | |
715 friend class Xr; | |
716 static const int kMaxNumberOfDlrrItems = 100; | |
717 | |
718 std::vector<RTCPUtility::RTCPPacketXRDLRRReportBlockItem> dlrr_block_; | |
719 | |
720 RTC_DISALLOW_COPY_AND_ASSIGN(Dlrr); | |
721 }; | |
722 | |
723 // VoIP Metrics Report Block (RFC 3611). | 689 // VoIP Metrics Report Block (RFC 3611). |
724 // | 690 // |
725 // 0 1 2 3 | 691 // 0 1 2 3 |
726 // 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 | 692 // 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 |
727 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 693 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
728 // | BT=7 | reserved | block length = 8 | | 694 // | BT=7 | reserved | block length = 8 | |
729 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 695 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
730 // | SSRC of source | | 696 // | SSRC of source | |
731 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 697 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
732 // | loss rate | discard rate | burst density | gap density | | 698 // | loss rate | discard rate | burst density | gap density | |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 | 778 |
813 private: | 779 private: |
814 const size_t buffer_length_; | 780 const size_t buffer_length_; |
815 size_t length_; | 781 size_t length_; |
816 rtc::scoped_ptr<uint8_t[]> buffer_; | 782 rtc::scoped_ptr<uint8_t[]> buffer_; |
817 }; | 783 }; |
818 | 784 |
819 } // namespace rtcp | 785 } // namespace rtcp |
820 } // namespace webrtc | 786 } // namespace webrtc |
821 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_H_ | 787 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_H_ |
OLD | NEW |