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 3 // found in the LICENSE file. 4 5 #ifndef MEDIA_CAST_RTCP_RTCP_RECEIVER_H_ 6 #define MEDIA_CAST_RTCP_RTCP_RECEIVER_H_ 7 8 #include "media/cast/net/cast_net_defines.h" 9 #include "media/cast/rtcp/rtcp.h" 10 #include "media/cast/rtcp/rtcp_defines.h" 11 #include "media/cast/rtcp/rtcp_utility.h" 12 13 namespace media { 14 namespace cast { 15 16 class RtcpReceiverFeedback { 17 public: 18 virtual void OnReceivedSenderReport( 19 const RtcpSenderInfo& remote_sender_info) = 0; 20 21 virtual void OnReceiverReferenceTimeReport( 22 const RtcpReceiverReferenceTimeReport& remote_time_report) = 0; 23 24 virtual void OnReceivedSendReportRequest() = 0; 25 26 virtual void OnReceivedReceiverLog( 27 const RtcpReceiverLogMessage& receiver_log) = 0; 28 29 virtual void OnReceivedSenderLog( 30 const RtcpSenderLogMessage& sender_log) = 0; 31 32 virtual ~RtcpReceiverFeedback() {} 33 }; 34 35 class RtcpRttFeedback { 36 public: 37 virtual void OnReceivedDelaySinceLastReport( 38 uint32 receivers_ssrc, 39 uint32 last_report, 40 uint32 delay_since_last_report) = 0; 41 42 virtual ~RtcpRttFeedback() {} 43 }; 44 45 class RtcpReceiver { 46 public: 47 explicit RtcpReceiver(scoped_refptr<CastEnvironment> cast_environment, 48 RtcpSenderFeedback* sender_feedback, 49 RtcpReceiverFeedback* receiver_feedback, 50 RtcpRttFeedback* rtt_feedback, 51 uint32 local_ssrc); 52 virtual ~RtcpReceiver(); 53 54 void SetRemoteSSRC(uint32 ssrc); 55 56 void IncomingRtcpPacket(RtcpParser* rtcp_parser); 57 58 private: 59 void HandleSenderReport(RtcpParser* rtcp_parser); 60 61 void HandleReceiverReport(RtcpParser* rtcp_parser); 62 63 void HandleReportBlock(const RtcpField* rtcp_field, 64 uint32 remote_ssrc); 65 66 void HandleSDES(RtcpParser* rtcp_parser); 67 void HandleSDESChunk(RtcpParser* rtcp_parser); 68 69 void HandleBYE(RtcpParser* rtcp_parser); 70 71 void HandleXr(RtcpParser* rtcp_parser); 72 void HandleRrtr(RtcpParser* rtcp_parser, uint32 remote_ssrc); 73 void HandleDlrr(RtcpParser* rtcp_parser); 74 75 // Generic RTP Feedback. 76 void HandleNACK(RtcpParser* rtcp_parser); 77 void HandleNACKItem(const RtcpField* rtcp_field, 78 std::list<uint16>* nack_sequence_numbers); 79 80 void HandleSendReportRequest(RtcpParser* rtcp_parser); 81 82 // Payload-specific. 83 void HandlePLI(RtcpParser* rtcp_parser); 84 85 void HandleSLI(RtcpParser* rtcp_parser); 86 void HandleSLIItem(RtcpField* rtcpPacket); 87 88 void HandleRpsi(RtcpParser* rtcp_parser); 89 90 void HandleFIR(RtcpParser* rtcp_parser); 91 void HandleFIRItem(const RtcpField* rtcp_field); 92 93 void HandlePayloadSpecificApp(RtcpParser* rtcp_parser); 94 void HandlePayloadSpecificRembItem(RtcpParser* rtcp_parser); 95 void HandlePayloadSpecificCastItem(RtcpParser* rtcp_parser); 96 void HandlePayloadSpecificCastNackItem( 97 const RtcpField* rtcp_field, 98 MissingFramesAndPacketsMap* missing_frames_and_packets); 99 100 void HandleApplicationSpecificCastReceiverLog(RtcpParser* rtcp_parser); 101 void HandleApplicationSpecificCastSenderLog(RtcpParser* rtcp_parser); 102 void HandleApplicationSpecificCastReceiverEventLog( 103 RtcpParser* rtcp_parser, 104 RtcpReceiverEventLogMessages* event_log_messages); 105 106 const uint32 ssrc_; 107 uint32 remote_ssrc_; 108 109 // Not owned by this class. 110 RtcpSenderFeedback* const sender_feedback_; 111 RtcpReceiverFeedback* const receiver_feedback_; 112 RtcpRttFeedback* const rtt_feedback_; 113 scoped_refptr<CastEnvironment> cast_environment_; 114 115 FrameIdWrapHelper ack_frame_id_wrap_helper_; 116 117 DISALLOW_COPY_AND_ASSIGN(RtcpReceiver); 118 }; 119 120 } // namespace cast 121 } // namespace media 122 123 #endif // MEDIA_CAST_RTCP_RTCP_RECEIVER_H_ 124