OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_CAST_RTCP_RTCP_SENDER_H_ | 5 #ifndef MEDIA_CAST_RTCP_RTCP_SENDER_H_ |
6 #define MEDIA_CAST_RTCP_RTCP_SENDER_H_ | 6 #define MEDIA_CAST_RTCP_RTCP_SENDER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 RtcpSender(scoped_refptr<CastEnvironment> cast_environment, | 21 RtcpSender(scoped_refptr<CastEnvironment> cast_environment, |
22 PacedPacketSender* const paced_packet_sender, | 22 PacedPacketSender* const paced_packet_sender, |
23 uint32 sending_ssrc, | 23 uint32 sending_ssrc, |
24 const std::string& c_name); | 24 const std::string& c_name); |
25 | 25 |
26 virtual ~RtcpSender(); | 26 virtual ~RtcpSender(); |
27 | 27 |
28 void SendRtcpFromRtpSender(uint32 packet_type_flags, | 28 void SendRtcpFromRtpSender(uint32 packet_type_flags, |
29 const RtcpSenderInfo* sender_info, | 29 const RtcpSenderInfo* sender_info, |
30 const RtcpDlrrReportBlock* dlrr, | 30 const RtcpDlrrReportBlock* dlrr, |
31 const RtcpSenderLogMessage* sender_log); | 31 RtcpSenderLogMessage* sender_log); |
32 | 32 |
33 void SendRtcpFromRtpReceiver(uint32 packet_type_flags, | 33 void SendRtcpFromRtpReceiver(uint32 packet_type_flags, |
34 const RtcpReportBlock* report_block, | 34 const RtcpReportBlock* report_block, |
35 const RtcpReceiverReferenceTimeReport* rrtr, | 35 const RtcpReceiverReferenceTimeReport* rrtr, |
36 const RtcpCastMessage* cast_message, | 36 const RtcpCastMessage* cast_message, |
37 const RtcpReceiverLogMessage* receiver_log); | 37 RtcpReceiverLogMessage* receiver_log); |
38 | 38 |
39 enum RtcpPacketType { | 39 enum RtcpPacketType { |
40 kRtcpSr = 0x0002, | 40 kRtcpSr = 0x0002, |
41 kRtcpRr = 0x0004, | 41 kRtcpRr = 0x0004, |
42 kRtcpBye = 0x0008, | 42 kRtcpBye = 0x0008, |
43 kRtcpPli = 0x0010, | 43 kRtcpPli = 0x0010, |
44 kRtcpNack = 0x0020, | 44 kRtcpNack = 0x0020, |
45 kRtcpFir = 0x0040, | 45 kRtcpFir = 0x0040, |
46 kRtcpSrReq = 0x0200, | 46 kRtcpSrReq = 0x0200, |
47 kRtcpDlrr = 0x0400, | 47 kRtcpDlrr = 0x0400, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 void BuildDlrrRb(const RtcpDlrrReportBlock* dlrr, | 83 void BuildDlrrRb(const RtcpDlrrReportBlock* dlrr, |
84 std::vector<uint8>* packet) const; | 84 std::vector<uint8>* packet) const; |
85 | 85 |
86 void BuildRrtr(const RtcpReceiverReferenceTimeReport* rrtr, | 86 void BuildRrtr(const RtcpReceiverReferenceTimeReport* rrtr, |
87 std::vector<uint8>* packet) const; | 87 std::vector<uint8>* packet) const; |
88 | 88 |
89 void BuildCast(const RtcpCastMessage* cast_message, | 89 void BuildCast(const RtcpCastMessage* cast_message, |
90 std::vector<uint8>* packet) const; | 90 std::vector<uint8>* packet) const; |
91 | 91 |
92 void BuildSenderLog(const RtcpSenderLogMessage* sender_log_message, | 92 void BuildSenderLog(RtcpSenderLogMessage* sender_log_message, |
93 std::vector<uint8>* packet) const; | 93 std::vector<uint8>* packet) const; |
94 | 94 |
95 void BuildReceiverLog(const RtcpReceiverLogMessage* receiver_log_message, | 95 void BuildReceiverLog(RtcpReceiverLogMessage* receiver_log_message, |
96 std::vector<uint8>* packet) const; | 96 std::vector<uint8>* packet) const; |
97 | 97 |
98 inline void BitrateToRembExponentBitrate(uint32 bitrate, | 98 inline void BitrateToRembExponentBitrate(uint32 bitrate, |
99 uint8* exponent, | 99 uint8* exponent, |
100 uint32* mantissa) const { | 100 uint32* mantissa) const { |
101 // 6 bit exponent and a 18 bit mantissa. | 101 // 6 bit exponent and a 18 bit mantissa. |
102 *exponent = 0; | 102 *exponent = 0; |
103 for (int i = 0; i < 64; ++i) { | 103 for (int i = 0; i < 64; ++i) { |
104 if (bitrate <= (262143u << i)) { | 104 if (bitrate <= (262143u << i)) { |
105 *exponent = i; | 105 *exponent = i; |
106 break; | 106 break; |
107 } | 107 } |
108 } | 108 } |
109 *mantissa = (bitrate >> *exponent); | 109 *mantissa = (bitrate >> *exponent); |
110 } | 110 } |
111 | 111 |
112 const uint32 ssrc_; | 112 const uint32 ssrc_; |
113 const std::string c_name_; | 113 const std::string c_name_; |
114 | 114 |
115 // Not owned by this class. | 115 // Not owned by this class. |
116 PacedPacketSender* transport_; | 116 PacedPacketSender* transport_; |
117 scoped_refptr<CastEnvironment> cast_environment_; | 117 scoped_refptr<CastEnvironment> cast_environment_; |
118 | 118 |
119 DISALLOW_COPY_AND_ASSIGN(RtcpSender); | 119 DISALLOW_COPY_AND_ASSIGN(RtcpSender); |
120 }; | 120 }; |
121 | 121 |
122 } // namespace cast | 122 } // namespace cast |
123 } // namespace media | 123 } // namespace media |
124 #endif // MEDIA_CAST_RTCP_RTCP_SENDER_H_ | 124 #endif // MEDIA_CAST_RTCP_RTCP_SENDER_H_ |
OLD | NEW |