1 /* 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef WEBRTC_VIDEO_ENGINE_VIE_RTP_RTCP_IMPL_H_ 12 #define WEBRTC_VIDEO_ENGINE_VIE_RTP_RTCP_IMPL_H_ 13 14 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" 15 #include "webrtc/typedefs.h" 16 #include "webrtc/video_engine/include/vie_rtp_rtcp.h" 17 #include "webrtc/video_engine/vie_ref_count.h" 18 19 namespace webrtc { 20 21 class ViESharedData; 22 23 class ViERTP_RTCPImpl 24 : public ViERTP_RTCP, 25 public ViERefCount { 26 public: 27 // Implements ViERTP_RTCP. 28 virtual int Release(); 29 virtual int SetLocalSSRC(const int video_channel, 30 const unsigned int SSRC, 31 const StreamType usage, 32 const unsigned char simulcast_idx); 33 virtual int GetLocalSSRC(const int video_channel, 34 unsigned int& SSRC) const; // NOLINT 35 virtual int SetRemoteSSRCType(const int video_channel, 36 const StreamType usage, 37 const unsigned int SSRC) const; 38 virtual int GetRemoteSSRC(const int video_channel, 39 unsigned int& SSRC) const; // NOLINT 40 virtual int GetRemoteCSRCs(const int video_channel, 41 unsigned int CSRCs[kRtpCsrcSize]) const; 42 virtual int SetRtxSendPayloadType(const int video_channel, 43 const uint8_t payload_type); 44 virtual int SetPadWithRedundantPayloads(int video_channel, bool enable); 45 virtual int SetRtxReceivePayloadType(const int video_channel, 46 const uint8_t payload_type); 47 virtual int SetStartSequenceNumber(const int video_channel, 48 uint16_t sequence_number); 49 virtual void SetRtpStateForSsrc(int video_channel, 50 uint32_t ssrc, 51 const RtpState& rtp_state) OVERRIDE; 52 virtual RtpState GetRtpStateForSsrc(int video_channel, 53 uint32_t ssrc) OVERRIDE; 54 virtual int SetRTCPStatus(const int video_channel, 55 const ViERTCPMode rtcp_mode); 56 virtual int GetRTCPStatus(const int video_channel, 57 ViERTCPMode& rtcp_mode) const; 58 virtual int SetRTCPCName(const int video_channel, 59 const char rtcp_cname[KMaxRTCPCNameLength]); 60 virtual int GetRemoteRTCPCName(const int video_channel, 61 char rtcp_cname[KMaxRTCPCNameLength]) const; 62 virtual int SendApplicationDefinedRTCPPacket( 63 const int video_channel, 64 const unsigned char sub_type, 65 unsigned int name, 66 const char* data, 67 uint16_t data_length_in_bytes); 68 virtual int SetNACKStatus(const int video_channel, const bool enable); 69 virtual int SetFECStatus(const int video_channel, const bool enable, 70 const unsigned char payload_typeRED, 71 const unsigned char payload_typeFEC); 72 virtual int SetHybridNACKFECStatus(const int video_channel, const bool enable, 73 const unsigned char payload_typeRED, 74 const unsigned char payload_typeFEC); 75 virtual int SetSenderBufferingMode(int video_channel, 76 int target_delay_ms); 77 virtual int SetReceiverBufferingMode(int video_channel, 78 int target_delay_ms); 79 virtual int SetKeyFrameRequestMethod(const int video_channel, 80 const ViEKeyFrameRequestMethod method); 81 virtual int SetTMMBRStatus(const int video_channel, const bool enable); 82 virtual int SetRembStatus(int video_channel, bool sender, bool receiver); 83 virtual int SetSendTimestampOffsetStatus(int video_channel, 84 bool enable, 85 int id); 86 virtual int SetReceiveTimestampOffsetStatus(int video_channel, 87 bool enable, 88 int id); 89 virtual int SetSendAbsoluteSendTimeStatus(int video_channel, 90 bool enable, 91 int id); 92 virtual int SetReceiveAbsoluteSendTimeStatus(int video_channel, 93 bool enable, 94 int id); 95 virtual int SetRtcpXrRrtrStatus(int video_channel, bool enable); 96 virtual int SetTransmissionSmoothingStatus(int video_channel, bool enable); 97 virtual int SetMinTransmitBitrate(int video_channel, 98 int min_transmit_bitrate_kbps); 99 virtual int SetReservedTransmitBitrate( 100 int video_channel, unsigned int reserved_transmit_bitrate_bps); 101 virtual int GetReceiveChannelRtcpStatistics(const int video_channel, 102 RtcpStatistics& basic_stats, 103 int& rtt_ms) const; 104 virtual int GetSendChannelRtcpStatistics(const int video_channel, 105 RtcpStatistics& basic_stats, 106 int& rtt_ms) const; 107 virtual int GetRtpStatistics(const int video_channel, 108 StreamDataCounters& sent, 109 StreamDataCounters& received) const; 110 virtual int GetRtcpPacketTypeCounters( 111 int video_channel, 112 RtcpPacketTypeCounter* packets_sent, 113 RtcpPacketTypeCounter* packets_received) const; 114 virtual int GetBandwidthUsage(const int video_channel, 115 unsigned int& total_bitrate_sent, 116 unsigned int& video_bitrate_sent, 117 unsigned int& fec_bitrate_sent, 118 unsigned int& nackBitrateSent) const; 119 virtual int GetEstimatedSendBandwidth( 120 const int video_channel, 121 unsigned int* estimated_bandwidth) const; 122 virtual int GetEstimatedReceiveBandwidth( 123 const int video_channel, 124 unsigned int* estimated_bandwidth) const; 125 virtual int GetReceiveBandwidthEstimatorStats( 126 const int video_channel, ReceiveBandwidthEstimatorStats* output) const; 127 virtual int GetPacerQueuingDelayMs(const int video_channel, 128 int* delay_ms) const; 129 virtual int StartRTPDump(const int video_channel, 130 const char file_nameUTF8[1024], 131 RTPDirections direction); 132 virtual int StopRTPDump(const int video_channel, RTPDirections direction); 133 virtual int RegisterRTPObserver(const int video_channel, 134 ViERTPObserver& observer); 135 virtual int DeregisterRTPObserver(const int video_channel); 136 virtual int RegisterRTCPObserver(const int video_channel, 137 ViERTCPObserver& observer); 138 virtual int DeregisterRTCPObserver(const int video_channel); 139 140 virtual int RegisterSendChannelRtcpStatisticsCallback( 141 int channel, RtcpStatisticsCallback* callback); 142 virtual int DeregisterSendChannelRtcpStatisticsCallback( 143 int channel, RtcpStatisticsCallback* callback); 144 virtual int RegisterReceiveChannelRtcpStatisticsCallback( 145 int channel, RtcpStatisticsCallback* callback); 146 virtual int DeregisterReceiveChannelRtcpStatisticsCallback( 147 int channel, RtcpStatisticsCallback* callback); 148 virtual int RegisterSendChannelRtpStatisticsCallback( 149 int channel, StreamDataCountersCallback* callback); 150 virtual int DeregisterSendChannelRtpStatisticsCallback( 151 int channel, StreamDataCountersCallback* callback); 152 virtual int RegisterReceiveChannelRtpStatisticsCallback( 153 int channel, StreamDataCountersCallback* callback); 154 virtual int DeregisterReceiveChannelRtpStatisticsCallback( 155 int channel, StreamDataCountersCallback* callback); 156 virtual int RegisterSendBitrateObserver( 157 int channel, BitrateStatisticsObserver* callback); 158 virtual int DeregisterSendBitrateObserver( 159 int channel, BitrateStatisticsObserver* callback); 160 virtual int RegisterSendFrameCountObserver( 161 int channel, FrameCountObserver* callback); 162 virtual int DeregisterSendFrameCountObserver( 163 int channel, FrameCountObserver* callback); 164 165 protected: 166 explicit ViERTP_RTCPImpl(ViESharedData* shared_data); 167 virtual ~ViERTP_RTCPImpl(); 168 169 private: 170 ViESharedData* shared_data_; 171 }; 172 173 } // namespace webrtc 174 175 #endif // WEBRTC_VIDEO_ENGINE_VIE_RTP_RTCP_IMPL_H_ 176