| 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 |
| 11 #include "media/cast/cast_config.h" | 11 #include "media/cast/cast_config.h" |
| 12 #include "media/cast/cast_defines.h" | 12 #include "media/cast/cast_defines.h" |
| 13 #include "media/cast/rtcp/rtcp.h" | 13 #include "media/cast/rtcp/rtcp.h" |
| 14 #include "media/cast/rtcp/rtcp_defines.h" | 14 #include "media/cast/rtcp/rtcp_defines.h" |
| 15 | 15 |
| 16 namespace media { | 16 namespace media { |
| 17 namespace cast { | 17 namespace cast { |
| 18 | 18 |
| 19 class RtcpSender { | 19 class RtcpSender { |
| 20 public: | 20 public: |
| 21 RtcpSender(PacedPacketSender* const paced_packet_sender, | 21 RtcpSender(PacedPacketSender* const paced_packet_sender, |
| 22 uint32 sending_ssrc, | 22 uint32 sending_ssrc, |
| 23 const std::string& c_name); | 23 const std::string& c_name); |
| 24 | 24 |
| 25 virtual ~RtcpSender(); | 25 virtual ~RtcpSender(); |
| 26 | 26 |
| 27 void SendRtcpFromRtpSender(uint32 packet_type_flags, | 27 void SendRtcpFromRtpSender(uint32 packet_type_flags, |
| 28 const RtcpSenderInfo* sender_info, | 28 const RtcpSenderInfo* sender_info, |
| 29 const RtcpDlrrReportBlock* dlrr, | 29 const RtcpDlrrReportBlock* dlrr, |
| 30 const RtcpSenderLogMessage* sender_log); | 30 RtcpSenderLogMessage* sender_log); |
| 31 | 31 |
| 32 void SendRtcpFromRtpReceiver(uint32 packet_type_flags, | 32 void SendRtcpFromRtpReceiver(uint32 packet_type_flags, |
| 33 const RtcpReportBlock* report_block, | 33 const RtcpReportBlock* report_block, |
| 34 const RtcpReceiverReferenceTimeReport* rrtr, | 34 const RtcpReceiverReferenceTimeReport* rrtr, |
| 35 const RtcpCastMessage* cast_message, | 35 const RtcpCastMessage* cast_message, |
| 36 const RtcpReceiverLogMessage* receiver_log); | 36 RtcpReceiverLogMessage* receiver_log); |
| 37 | 37 |
| 38 enum RtcpPacketType { | 38 enum RtcpPacketType { |
| 39 kRtcpSr = 0x0002, | 39 kRtcpSr = 0x0002, |
| 40 kRtcpRr = 0x0004, | 40 kRtcpRr = 0x0004, |
| 41 kRtcpBye = 0x0008, | 41 kRtcpBye = 0x0008, |
| 42 kRtcpPli = 0x0010, | 42 kRtcpPli = 0x0010, |
| 43 kRtcpNack = 0x0020, | 43 kRtcpNack = 0x0020, |
| 44 kRtcpFir = 0x0040, | 44 kRtcpFir = 0x0040, |
| 45 kRtcpSrReq = 0x0200, | 45 kRtcpSrReq = 0x0200, |
| 46 kRtcpDlrr = 0x0400, | 46 kRtcpDlrr = 0x0400, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 void BuildDlrrRb(const RtcpDlrrReportBlock* dlrr, | 82 void BuildDlrrRb(const RtcpDlrrReportBlock* dlrr, |
| 83 std::vector<uint8>* packet) const; | 83 std::vector<uint8>* packet) const; |
| 84 | 84 |
| 85 void BuildRrtr(const RtcpReceiverReferenceTimeReport* rrtr, | 85 void BuildRrtr(const RtcpReceiverReferenceTimeReport* rrtr, |
| 86 std::vector<uint8>* packet) const; | 86 std::vector<uint8>* packet) const; |
| 87 | 87 |
| 88 void BuildCast(const RtcpCastMessage* cast_message, | 88 void BuildCast(const RtcpCastMessage* cast_message, |
| 89 std::vector<uint8>* packet) const; | 89 std::vector<uint8>* packet) const; |
| 90 | 90 |
| 91 void BuildSenderLog(const RtcpSenderLogMessage* sender_log_message, | 91 void BuildSenderLog(RtcpSenderLogMessage* sender_log_message, |
| 92 std::vector<uint8>* packet) const; | 92 std::vector<uint8>* packet) const; |
| 93 | 93 |
| 94 void BuildReceiverLog(const RtcpReceiverLogMessage* receiver_log_message, | 94 void BuildReceiverLog(RtcpReceiverLogMessage* receiver_log_message, |
| 95 std::vector<uint8>* packet) const; | 95 std::vector<uint8>* packet) const; |
| 96 | 96 |
| 97 inline void BitrateToRembExponentBitrate(uint32 bitrate, | 97 inline void BitrateToRembExponentBitrate(uint32 bitrate, |
| 98 uint8* exponent, | 98 uint8* exponent, |
| 99 uint32* mantissa) const { | 99 uint32* mantissa) const { |
| 100 // 6 bit exponent and a 18 bit mantissa. | 100 // 6 bit exponent and a 18 bit mantissa. |
| 101 *exponent = 0; | 101 *exponent = 0; |
| 102 for (int i = 0; i < 64; ++i) { | 102 for (int i = 0; i < 64; ++i) { |
| 103 if (bitrate <= (262143u << i)) { | 103 if (bitrate <= (262143u << i)) { |
| 104 *exponent = i; | 104 *exponent = i; |
| 105 break; | 105 break; |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 *mantissa = (bitrate >> *exponent); | 108 *mantissa = (bitrate >> *exponent); |
| 109 } | 109 } |
| 110 | 110 |
| 111 const uint32 ssrc_; | 111 const uint32 ssrc_; |
| 112 const std::string c_name_; | 112 const std::string c_name_; |
| 113 | 113 |
| 114 // Not owned by this class. | 114 // Not owned by this class. |
| 115 PacedPacketSender* transport_; | 115 PacedPacketSender* transport_; |
| 116 | 116 |
| 117 DISALLOW_COPY_AND_ASSIGN(RtcpSender); | 117 DISALLOW_COPY_AND_ASSIGN(RtcpSender); |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 } // namespace cast | 120 } // namespace cast |
| 121 } // namespace media | 121 } // namespace media |
| 122 #endif // MEDIA_CAST_RTCP_RTCP_SENDER_H_ | 122 #endif // MEDIA_CAST_RTCP_RTCP_SENDER_H_ |
| OLD | NEW |