| 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 #include "media/cast/transport/cast_transport_defines.h" |
| 16 #include "media/cast/transport/rtcp/rtcp_builder.h" |
| 15 | 17 |
| 16 namespace media { | 18 namespace media { |
| 17 namespace cast { | 19 namespace cast { |
| 18 | 20 |
| 19 // TODO(mikhal): Resolve duplication between this and RtcpBuilder. | 21 // TODO(mikhal): Resolve duplication between this and RtcpBuilder. |
| 20 class RtcpSender { | 22 class RtcpSender { |
| 21 public: | 23 public: |
| 22 RtcpSender(scoped_refptr<CastEnvironment> cast_environment, | 24 RtcpSender(scoped_refptr<CastEnvironment> cast_environment, |
| 23 PacedPacketSender* const paced_packet_sender, | 25 transport::PacedPacketSender* const paced_packet_sender, |
| 24 uint32 sending_ssrc, | 26 uint32 sending_ssrc, |
| 25 const std::string& c_name); | 27 const std::string& c_name); |
| 26 | 28 |
| 27 virtual ~RtcpSender(); | 29 virtual ~RtcpSender(); |
| 28 | 30 |
| 29 void SendRtcpFromRtpReceiver(uint32 packet_type_flags, | 31 void SendRtcpFromRtpReceiver(uint32 packet_type_flags, |
| 30 const RtcpReportBlock* report_block, | 32 const transport::RtcpReportBlock* report_block, |
| 31 const RtcpReceiverReferenceTimeReport* rrtr, | 33 const RtcpReceiverReferenceTimeReport* rrtr, |
| 32 const RtcpCastMessage* cast_message, | 34 const RtcpCastMessage* cast_message, |
| 33 RtcpReceiverLogMessage* receiver_log); | 35 RtcpReceiverLogMessage* receiver_log); |
| 34 | |
| 35 enum RtcpPacketType { | 36 enum RtcpPacketType { |
| 36 kRtcpSr = 0x0002, | 37 kRtcpSr = 0x0002, |
| 37 kRtcpRr = 0x0004, | 38 kRtcpRr = 0x0004, |
| 38 kRtcpBye = 0x0008, | 39 kRtcpBye = 0x0008, |
| 39 kRtcpPli = 0x0010, | 40 kRtcpPli = 0x0010, |
| 40 kRtcpNack = 0x0020, | 41 kRtcpNack = 0x0020, |
| 41 kRtcpFir = 0x0040, | 42 kRtcpFir = 0x0040, |
| 42 kRtcpSrReq = 0x0200, | 43 kRtcpSrReq = 0x0200, |
| 43 kRtcpDlrr = 0x0400, | 44 kRtcpDlrr = 0x0400, |
| 44 kRtcpRrtr = 0x0800, | 45 kRtcpRrtr = 0x0800, |
| 45 kRtcpRpsi = 0x8000, | 46 kRtcpRpsi = 0x8000, |
| 46 kRtcpRemb = 0x10000, | 47 kRtcpRemb = 0x10000, |
| 47 kRtcpCast = 0x20000, | 48 kRtcpCast = 0x20000, |
| 48 kRtcpSenderLog = 0x40000, | 49 kRtcpSenderLog = 0x40000, |
| 49 kRtcpReceiverLog = 0x80000, | 50 kRtcpReceiverLog = 0x80000, |
| 50 }; | 51 }; |
| 51 | |
| 52 private: | 52 private: |
| 53 void BuildRR(const RtcpReportBlock* report_block, | 53 void BuildRR(const transport::RtcpReportBlock* report_block, |
| 54 std::vector<uint8>* packet) const; | 54 std::vector<uint8>* packet) const; |
| 55 | 55 |
| 56 void AddReportBlocks(const RtcpReportBlock& report_block, | 56 void AddReportBlocks(const transport::RtcpReportBlock& report_block, |
| 57 std::vector<uint8>* packet) const; | 57 std::vector<uint8>* packet) const; |
| 58 | 58 |
| 59 void BuildSdec(std::vector<uint8>* packet) const; | 59 void BuildSdec(std::vector<uint8>* packet) const; |
| 60 | 60 |
| 61 void BuildPli(uint32 remote_ssrc, | 61 void BuildPli(uint32 remote_ssrc, |
| 62 std::vector<uint8>* packet) const; | 62 std::vector<uint8>* packet) const; |
| 63 | 63 |
| 64 void BuildRemb(const RtcpRembMessage* remb, | 64 void BuildRemb(const RtcpRembMessage* remb, |
| 65 std::vector<uint8>* packet) const; | 65 std::vector<uint8>* packet) const; |
| 66 | 66 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 92 break; | 92 break; |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 *mantissa = (bitrate >> *exponent); | 95 *mantissa = (bitrate >> *exponent); |
| 96 } | 96 } |
| 97 | 97 |
| 98 const uint32 ssrc_; | 98 const uint32 ssrc_; |
| 99 const std::string c_name_; | 99 const std::string c_name_; |
| 100 | 100 |
| 101 // Not owned by this class. | 101 // Not owned by this class. |
| 102 PacedPacketSender* transport_; | 102 transport::PacedPacketSender* transport_; |
| 103 scoped_refptr<CastEnvironment> cast_environment_; | 103 scoped_refptr<CastEnvironment> cast_environment_; |
| 104 | 104 |
| 105 DISALLOW_COPY_AND_ASSIGN(RtcpSender); | 105 DISALLOW_COPY_AND_ASSIGN(RtcpSender); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 } // namespace cast | 108 } // namespace cast |
| 109 } // namespace media | 109 } // namespace media |
| 110 #endif // MEDIA_CAST_RTCP_RTCP_SENDER_H_ | 110 #endif // MEDIA_CAST_RTCP_RTCP_SENDER_H_ |
| OLD | NEW |