| 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 SendRtcp(uint32 packet_type_flags, | 27 void SendRtcpFromRtpSender(uint32 packet_type_flags, |
| 28 const RtcpSenderInfo* sender_info, | 28 const RtcpSenderInfo* sender_info, |
| 29 const RtcpReportBlock* report_block, | 29 const RtcpDlrrReportBlock* dlrr, |
| 30 uint32 pli_remote_ssrc, | 30 const RtcpSenderLogMessage* sender_log); |
| 31 const RtcpDlrrReportBlock* dlrr, | 31 |
| 32 const RtcpReceiverReferenceTimeReport* rrtr, | 32 void SendRtcpFromRtpReceiver(uint32 packet_type_flags, |
| 33 const RtcpCastMessage* cast_message); | 33 const RtcpReportBlock* report_block, |
| 34 const RtcpReceiverReferenceTimeReport* rrtr, |
| 35 const RtcpCastMessage* cast_message, |
| 36 const RtcpReceiverLogMessage* receiver_log); |
| 34 | 37 |
| 35 enum RtcpPacketType { | 38 enum RtcpPacketType { |
| 36 kRtcpSr = 0x0002, | 39 kRtcpSr = 0x0002, |
| 37 kRtcpRr = 0x0004, | 40 kRtcpRr = 0x0004, |
| 38 kRtcpBye = 0x0008, | 41 kRtcpBye = 0x0008, |
| 39 kRtcpPli = 0x0010, | 42 kRtcpPli = 0x0010, |
| 40 kRtcpNack = 0x0020, | 43 kRtcpNack = 0x0020, |
| 41 kRtcpFir = 0x0040, | 44 kRtcpFir = 0x0040, |
| 42 kRtcpSrReq = 0x0200, | 45 kRtcpSrReq = 0x0200, |
| 43 kRtcpDlrr = 0x0400, | 46 kRtcpDlrr = 0x0400, |
| 44 kRtcpRrtr = 0x0800, | 47 kRtcpRrtr = 0x0800, |
| 45 kRtcpRpsi = 0x8000, | 48 kRtcpRpsi = 0x8000, |
| 46 kRtcpRemb = 0x10000, | 49 kRtcpRemb = 0x10000, |
| 47 kRtcpCast = 0x20000, | 50 kRtcpCast = 0x20000, |
| 51 kRtcpSenderLog = 0x40000, |
| 52 kRtcpReceiverLog = 0x80000, |
| 48 }; | 53 }; |
| 49 | 54 |
| 50 private: | 55 private: |
| 51 void BuildSR(const RtcpSenderInfo& sender_info, | 56 void BuildSR(const RtcpSenderInfo& sender_info, |
| 52 const RtcpReportBlock* report_block, | 57 const RtcpReportBlock* report_block, |
| 53 std::vector<uint8>* packet) const; | 58 std::vector<uint8>* packet) const; |
| 54 | 59 |
| 55 void BuildRR(const RtcpReportBlock* report_block, | 60 void BuildRR(const RtcpReportBlock* report_block, |
| 56 std::vector<uint8>* packet) const; | 61 std::vector<uint8>* packet) const; |
| 57 | 62 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 76 | 81 |
| 77 void BuildDlrrRb(const RtcpDlrrReportBlock* dlrr, | 82 void BuildDlrrRb(const RtcpDlrrReportBlock* dlrr, |
| 78 std::vector<uint8>* packet) const; | 83 std::vector<uint8>* packet) const; |
| 79 | 84 |
| 80 void BuildRrtr(const RtcpReceiverReferenceTimeReport* rrtr, | 85 void BuildRrtr(const RtcpReceiverReferenceTimeReport* rrtr, |
| 81 std::vector<uint8>* packet) const; | 86 std::vector<uint8>* packet) const; |
| 82 | 87 |
| 83 void BuildCast(const RtcpCastMessage* cast_message, | 88 void BuildCast(const RtcpCastMessage* cast_message, |
| 84 std::vector<uint8>* packet) const; | 89 std::vector<uint8>* packet) const; |
| 85 | 90 |
| 91 void BuildSenderLog(const RtcpSenderLogMessage* sender_log_message, |
| 92 std::vector<uint8>* packet) const; |
| 93 |
| 94 void BuildReceiverLog(const RtcpReceiverLogMessage* receiver_log_message, |
| 95 std::vector<uint8>* packet) const; |
| 96 |
| 86 inline void BitrateToRembExponentBitrate(uint32 bitrate, | 97 inline void BitrateToRembExponentBitrate(uint32 bitrate, |
| 87 uint8* exponent, | 98 uint8* exponent, |
| 88 uint32* mantissa) const { | 99 uint32* mantissa) const { |
| 89 // 6 bit exponent and a 18 bit mantissa. | 100 // 6 bit exponent and a 18 bit mantissa. |
| 90 *exponent = 0; | 101 *exponent = 0; |
| 91 for (int i = 0; i < 64; ++i) { | 102 for (int i = 0; i < 64; ++i) { |
| 92 if (bitrate <= (262143u << i)) { | 103 if (bitrate <= (262143u << i)) { |
| 93 *exponent = i; | 104 *exponent = i; |
| 94 break; | 105 break; |
| 95 } | 106 } |
| 96 } | 107 } |
| 97 *mantissa = (bitrate >> *exponent); | 108 *mantissa = (bitrate >> *exponent); |
| 98 } | 109 } |
| 99 | 110 |
| 100 const uint32 ssrc_; | 111 const uint32 ssrc_; |
| 101 const std::string c_name_; | 112 const std::string c_name_; |
| 102 | 113 |
| 103 // Not owned by this class. | 114 // Not owned by this class. |
| 104 PacedPacketSender* transport_; | 115 PacedPacketSender* transport_; |
| 105 | 116 |
| 106 DISALLOW_COPY_AND_ASSIGN(RtcpSender); | 117 DISALLOW_COPY_AND_ASSIGN(RtcpSender); |
| 107 }; | 118 }; |
| 108 | 119 |
| 109 } // namespace cast | 120 } // namespace cast |
| 110 } // namespace media | 121 } // namespace media |
| 111 #endif // MEDIA_CAST_RTCP_RTCP_SENDER_H_ | 122 #endif // MEDIA_CAST_RTCP_RTCP_SENDER_H_ |
| OLD | NEW |