X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmedia%2Fcast%2Frtcp%2Frtcp.h;h=3fef49cc283325828bc213789988b41cf565645e;hb=ff3e2503a20db9193d323c1d19c38c68004dec4a;hp=7a043c2545bea5ecdd8d481fc76f555b36aa98ef;hpb=4b53d56b8a1db20d4089f6d4f37126d43f907125;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/media/cast/rtcp/rtcp.h b/src/media/cast/rtcp/rtcp.h index 7a043c2..3fef49c 100644 --- a/src/media/cast/rtcp/rtcp.h +++ b/src/media/cast/rtcp/rtcp.h @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -16,7 +17,11 @@ #include "base/time/time.h" #include "media/cast/cast_config.h" #include "media/cast/cast_defines.h" +#include "media/cast/cast_environment.h" #include "media/cast/rtcp/rtcp_defines.h" +#include "media/cast/transport/cast_transport_defines.h" +#include "media/cast/transport/cast_transport_sender.h" +#include "media/cast/transport/pacing/paced_sender.h" namespace media { namespace cast { @@ -24,22 +29,16 @@ namespace cast { class LocalRtcpReceiverFeedback; class LocalRtcpRttFeedback; class PacedPacketSender; +class ReceiverRtcpEventSubscriber; class RtcpReceiver; class RtcpSender; +typedef std::pair RtcpSendTimePair; +typedef std::map RtcpSendTimeMap; +typedef std::queue RtcpSendTimeQueue; + class RtcpSenderFeedback { public: - virtual void OnReceivedReportBlock(const RtcpReportBlock& report_block) = 0; - - virtual void OnReceivedIntraFrameRequest() = 0; - - virtual void OnReceivedRpsi(uint8 payload_type, uint64 picture_id) = 0; - - virtual void OnReceivedRemb(uint32 bitrate) = 0; - - virtual void OnReceivedNackRequest( - const std::list& nack_sequence_numbers) = 0; - virtual void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback) = 0; virtual ~RtcpSenderFeedback() {} @@ -48,7 +47,7 @@ class RtcpSenderFeedback { class RtpSenderStatistics { public: virtual void GetStatistics(const base::TimeTicks& now, - RtcpSenderInfo* sender_info) = 0; + transport::RtcpSenderInfo* sender_info) = 0; virtual ~RtpSenderStatistics() {} }; @@ -65,15 +64,19 @@ class RtpReceiverStatistics { class Rtcp { public: - Rtcp(base::TickClock* clock, + // Rtcp accepts two transports, one to be used by Cast senders + // (CastTransportSender) only, and the other (PacedPacketSender) should only + // be used by the Cast receivers and test applications. + Rtcp(scoped_refptr cast_environment, RtcpSenderFeedback* sender_feedback, - PacedPacketSender* paced_packet_sender, + transport::CastTransportSender* const transport_sender, // Send-side. + transport::PacedPacketSender* paced_packet_sender, // Receive side. RtpSenderStatistics* rtp_sender_statistics, RtpReceiverStatistics* rtp_receiver_statistics, RtcpMode rtcp_mode, const base::TimeDelta& rtcp_interval, - bool sending_media, uint32 local_ssrc, + uint32 remote_ssrc, const std::string& c_name); virtual ~Rtcp(); @@ -83,21 +86,33 @@ class Rtcp { static uint32 GetSsrcOfSender(const uint8* rtcp_buffer, size_t length); base::TimeTicks TimeToSendNextRtcpReport(); - void SendRtcpReport(uint32 media_ssrc); - void SendRtcpPli(uint32 media_ssrc); - void SendRtcpCast(const RtcpCastMessage& cast_message); - void SetRemoteSSRC(uint32 ssrc); + // |sender_log_message| is optional; without it no log messages will be + // attached to the RTCP report; instead a normal RTCP send report will be + // sent. + // Additionally if all messages in |sender_log_message| does + // not fit in the packet the |sender_log_message| will contain the remaining + // unsent messages. + void SendRtcpFromRtpSender( + const transport::RtcpSenderLogMessage& sender_log_message); + + // |cast_message| and |event_subscriber| is optional; if |cast_message| is + // provided the RTCP receiver report will append a Cast message containing + // Acks and Nacks; if |event_subscriber| is provided the RTCP receiver report + // will append the log messages from the subscriber. + void SendRtcpFromRtpReceiver(const RtcpCastMessage* cast_message, + ReceiverRtcpEventSubscriber* event_subscriber); void IncomingRtcpPacket(const uint8* rtcp_buffer, size_t length); - bool Rtt(base::TimeDelta* rtt, base::TimeDelta* avg_rtt, - base::TimeDelta* min_rtt, base::TimeDelta* max_rtt) const; + bool Rtt(base::TimeDelta* rtt, + base::TimeDelta* avg_rtt, + base::TimeDelta* min_rtt, + base::TimeDelta* max_rtt) const; bool RtpTimestampInSenderTime(int frequency, uint32 rtp_timestamp, base::TimeTicks* rtp_timestamp_in_ticks) const; protected: - int CheckForWrapAround(uint32 new_timestamp, - uint32 old_timestamp) const; + int CheckForWrapAround(uint32 new_timestamp, uint32 old_timestamp) const; void OnReceivedLipSyncInfo(uint32 rtp_timestamp, uint32 ntp_seconds, @@ -125,11 +140,25 @@ class Rtcp { void UpdateNextTimeToSendRtcp(); - base::TickClock* const clock_; // Not owned by this class. + void SaveLastSentNtpTime(const base::TimeTicks& now, + uint32 last_ntp_seconds, + uint32 last_ntp_fraction); + + void SendRtcpFromRtpSenderOnTransportThread( + uint32 packet_type_flags, + const transport::RtcpSenderInfo& sender_info, + const transport::RtcpDlrrReportBlock& dlrr, + const transport::RtcpSenderLogMessage& sender_log, + uint32 sending_ssrc, + std::string c_name); + + scoped_refptr cast_environment_; + transport::CastTransportSender* const transport_sender_; const base::TimeDelta rtcp_interval_; const RtcpMode rtcp_mode_; - const bool sending_media_; const uint32 local_ssrc_; + const uint32 remote_ssrc_; + const std::string c_name_; // Not owned by this class. RtpSenderStatistics* const rtp_sender_statistics_; @@ -141,10 +170,8 @@ class Rtcp { scoped_ptr rtcp_receiver_; base::TimeTicks next_time_to_send_rtcp_; - - base::TimeTicks time_last_report_sent_; - uint32 last_report_sent_; - + RtcpSendTimeMap last_reports_sent_map_; + RtcpSendTimeQueue last_reports_sent_queue_; base::TimeTicks time_last_report_received_; uint32 last_report_received_;