Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_NET_RTCP_SENDER_RTCP_SESSION_H_ | 5 #ifndef MEDIA_CAST_NET_RTCP_SENDER_RTCP_SESSION_H_ |
| 6 #define MEDIA_CAST_NET_RTCP_SENDER_RTCP_SESSION_H_ | 6 #define MEDIA_CAST_NET_RTCP_SENDER_RTCP_SESSION_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 | 21 |
| 22 typedef std::pair<uint32_t, base::TimeTicks> RtcpSendTimePair; | 22 typedef std::pair<uint32_t, base::TimeTicks> RtcpSendTimePair; |
| 23 typedef std::map<uint32_t, base::TimeTicks> RtcpSendTimeMap; | 23 typedef std::map<uint32_t, base::TimeTicks> RtcpSendTimeMap; |
| 24 typedef std::queue<RtcpSendTimePair> RtcpSendTimeQueue; | 24 typedef std::queue<RtcpSendTimePair> RtcpSendTimeQueue; |
| 25 | 25 |
| 26 // This class represents a RTCP session on a RTP sender. It provides an | 26 // This class represents a RTCP session on a RTP sender. It provides an |
| 27 // interface to send RTCP sender report (SR). RTCP SR packets allow | 27 // interface to send RTCP sender report (SR). RTCP SR packets allow |
| 28 // receiver to maintain clock offsets and synchronize between audio and video. | 28 // receiver to maintain clock offsets and synchronize between audio and video. |
| 29 // | 29 // |
| 30 // RTCP session on sender handles the following incoming RTCP reports | 30 // RTCP session on sender handles the following incoming RTCP reports |
| 31 // from receiver: | 31 // from receiver and passes the information to the Client: |
| 32 // - Receiver reference time report: Helps with tracking largest timestamp | 32 // - Receiver reference time report: Helps with tracking largest timestamp |
| 33 // seen and as a result rejecting old RTCP reports. | 33 // seen and as a result rejecting old RTCP reports. |
| 34 // - Receiver logs: The sender receives log events from the receiver and | 34 // - Receiver logs: The sender receives log events from the receiver. |
| 35 // invokes a callback passed. | 35 // - cast message: Receives feedback from receiver on missing packets/frames, |
| 36 // - cast message: Receives feedback from receiver on missing packets/frames | 36 // later frames received, and last frame id. |
| 37 // and last frame id received and invokes a callback passed. | |
| 38 // - Last report: The receiver provides feedback on delay since last report | 37 // - Last report: The receiver provides feedback on delay since last report |
| 39 // received which helps it compute round trip time and invoke a callback. | 38 // received which helps it compute round trip time. |
| 39 // - PLI: Receiver sends PLI when decoding error exists on ultra-low latency | |
| 40 // applications. | |
| 40 class SenderRtcpSession : public RtcpSession { | 41 class SenderRtcpSession : public RtcpSession { |
| 41 public: | 42 public: |
| 42 // TODO(xjz): Simplify the interface. http://crbug.com/588275. | 43 // Interface to handel receiving RTCP messages from RTP receiver. |
| 43 SenderRtcpSession(const RtcpCastMessageCallback& cast_callback, | 44 class Client { |
|
miu
2016/04/15 23:14:39
This is identical to RtpSenderRtcpClient, except i
xjz
2016/04/20 01:09:03
Done. Named the interface "SenderRtcpObserver".
| |
| 44 const RtcpRttCallback& rtt_callback, | 45 public: |
| 45 const RtcpLogMessageCallback& log_callback, | 46 virtual ~Client() {} |
| 46 const RtcpPliCallback pli_callback, | 47 |
| 48 // Called to pass the cast message to the Client. | |
| 49 virtual void OnCastMessageReceived(const RtcpCastMessage& cast_message) = 0; | |
| 50 | |
| 51 // Called to pass the current Rtt to the Client. | |
| 52 virtual void OnRttReceived(base::TimeDelta round_trip_time) = 0; | |
| 53 | |
| 54 // Called to pass the RTP receiver logs to the Client. | |
| 55 virtual void OnReceiverLogReceived(const RtcpReceiverLogMessage& log) = 0; | |
| 56 | |
| 57 // Received PLI from RTP receiver. | |
| 58 virtual void OnPliReceived() = 0; | |
| 59 }; | |
| 60 | |
| 61 SenderRtcpSession(std::unique_ptr<Client> client, | |
| 47 base::TickClock* clock, // Not owned. | 62 base::TickClock* clock, // Not owned. |
| 48 PacedPacketSender* packet_sender, // Not owned. | 63 PacedPacketSender* packet_sender, // Not owned. |
| 49 uint32_t local_ssrc, | 64 uint32_t local_ssrc, |
| 50 uint32_t remote_ssrc); | 65 uint32_t remote_ssrc); |
| 51 | 66 |
| 52 ~SenderRtcpSession() override; | 67 ~SenderRtcpSession() override; |
| 53 | 68 |
| 54 // If greater than zero, this is the last measured network round trip time. | 69 // If greater than zero, this is the last measured network round trip time. |
| 55 base::TimeDelta current_round_trip_time() const { | 70 base::TimeDelta current_round_trip_time() const { |
| 56 return current_round_trip_time_; | 71 return current_round_trip_time_; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 // Save last sent NTP time on RTPC SR. This helps map the sent time when a | 106 // Save last sent NTP time on RTPC SR. This helps map the sent time when a |
| 92 // last report is received from RTP receiver to compute RTT. | 107 // last report is received from RTP receiver to compute RTT. |
| 93 void SaveLastSentNtpTime(const base::TimeTicks& now, | 108 void SaveLastSentNtpTime(const base::TimeTicks& now, |
| 94 uint32_t last_ntp_seconds, | 109 uint32_t last_ntp_seconds, |
| 95 uint32_t last_ntp_fraction); | 110 uint32_t last_ntp_fraction); |
| 96 | 111 |
| 97 base::TickClock* const clock_; // Not owned. | 112 base::TickClock* const clock_; // Not owned. |
| 98 PacedPacketSender* packet_sender_; // Not owned. | 113 PacedPacketSender* packet_sender_; // Not owned. |
| 99 const uint32_t local_ssrc_; | 114 const uint32_t local_ssrc_; |
| 100 const uint32_t remote_ssrc_; | 115 const uint32_t remote_ssrc_; |
| 101 | 116 const std::unique_ptr<Client> sender_rtcp_client_; |
| 102 const RtcpCastMessageCallback cast_callback_; | |
| 103 const RtcpRttCallback rtt_callback_; | |
| 104 const RtcpLogMessageCallback log_callback_; | |
| 105 const RtcpPliCallback pli_callback_; | |
| 106 | 117 |
| 107 // Computed from RTCP RRTR report. | 118 // Computed from RTCP RRTR report. |
| 108 base::TimeTicks largest_seen_timestamp_; | 119 base::TimeTicks largest_seen_timestamp_; |
| 109 | 120 |
| 110 // The RTCP packet parser is re-used when parsing each RTCP packet. It | 121 // The RTCP packet parser is re-used when parsing each RTCP packet. It |
| 111 // remembers state about prior RTP timestamps and other sequence values to | 122 // remembers state about prior RTP timestamps and other sequence values to |
| 112 // re-construct "expanded" values. | 123 // re-construct "expanded" values. |
| 113 RtcpParser parser_; | 124 RtcpParser parser_; |
| 114 | 125 |
| 115 // For extending received ACK frame IDs from 8-bit to 32-bit. | 126 // For extending received ACK frame IDs from 8-bit to 32-bit. |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 130 RtcpSendTimeMap last_reports_sent_map_; | 141 RtcpSendTimeMap last_reports_sent_map_; |
| 131 RtcpSendTimeQueue last_reports_sent_queue_; | 142 RtcpSendTimeQueue last_reports_sent_queue_; |
| 132 | 143 |
| 133 DISALLOW_COPY_AND_ASSIGN(SenderRtcpSession); | 144 DISALLOW_COPY_AND_ASSIGN(SenderRtcpSession); |
| 134 }; | 145 }; |
| 135 | 146 |
| 136 } // namespace cast | 147 } // namespace cast |
| 137 } // namespace media | 148 } // namespace media |
| 138 | 149 |
| 139 #endif // MEDIA_CAST_NET_RTCP_SENDER_RTCP_SESSION_H_ | 150 #endif // MEDIA_CAST_NET_RTCP_SENDER_RTCP_SESSION_H_ |
| OLD | NEW |