| OLD | NEW |
| (Empty) |
| 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 // This sub-API supports the following functionalities: | |
| 12 // | |
| 13 // - Callbacks for RTP and RTCP events such as modified SSRC or CSRC. | |
| 14 // - SSRC handling. | |
| 15 // - Transmission of RTCP sender reports. | |
| 16 // - Obtaining RTCP data from incoming RTCP sender reports. | |
| 17 // - RTP and RTCP statistics (jitter, packet loss, RTT etc.). | |
| 18 // - Redundant Coding (RED) | |
| 19 // - Writing RTP and RTCP packets to binary files for off-line analysis of | |
| 20 // the call quality. | |
| 21 // | |
| 22 // Usage example, omitting error checking: | |
| 23 // | |
| 24 // using namespace webrtc; | |
| 25 // VoiceEngine* voe = VoiceEngine::Create(); | |
| 26 // VoEBase* base = VoEBase::GetInterface(voe); | |
| 27 // VoERTP_RTCP* rtp_rtcp = VoERTP_RTCP::GetInterface(voe); | |
| 28 // base->Init(); | |
| 29 // int ch = base->CreateChannel(); | |
| 30 // ... | |
| 31 // rtp_rtcp->SetLocalSSRC(ch, 12345); | |
| 32 // ... | |
| 33 // base->DeleteChannel(ch); | |
| 34 // base->Terminate(); | |
| 35 // base->Release(); | |
| 36 // rtp_rtcp->Release(); | |
| 37 // VoiceEngine::Delete(voe); | |
| 38 // | |
| 39 #ifndef VOICE_ENGINE_VOE_RTP_RTCP_H_ | |
| 40 #define VOICE_ENGINE_VOE_RTP_RTCP_H_ | |
| 41 | |
| 42 #include <vector> | |
| 43 #include "common_types.h" // NOLINT(build/include) | |
| 44 | |
| 45 namespace webrtc { | |
| 46 | |
| 47 class VoiceEngine; | |
| 48 | |
| 49 // VoERTPObserver | |
| 50 class WEBRTC_DLLEXPORT VoERTPObserver { | |
| 51 public: | |
| 52 virtual void OnIncomingCSRCChanged(int channel, | |
| 53 unsigned int CSRC, | |
| 54 bool added) = 0; | |
| 55 | |
| 56 virtual void OnIncomingSSRCChanged(int channel, unsigned int SSRC) = 0; | |
| 57 | |
| 58 protected: | |
| 59 virtual ~VoERTPObserver() {} | |
| 60 }; | |
| 61 | |
| 62 // CallStatistics | |
| 63 struct CallStatistics { | |
| 64 unsigned short fractionLost; | |
| 65 unsigned int cumulativeLost; | |
| 66 unsigned int extendedMax; | |
| 67 unsigned int jitterSamples; | |
| 68 int64_t rttMs; | |
| 69 size_t bytesSent; | |
| 70 int packetsSent; | |
| 71 size_t bytesReceived; | |
| 72 int packetsReceived; | |
| 73 // The capture ntp time (in local timebase) of the first played out audio | |
| 74 // frame. | |
| 75 int64_t capture_start_ntp_time_ms_; | |
| 76 }; | |
| 77 | |
| 78 // See section 6.4.1 in http://www.ietf.org/rfc/rfc3550.txt for details. | |
| 79 struct SenderInfo { | |
| 80 uint32_t NTP_timestamp_high; | |
| 81 uint32_t NTP_timestamp_low; | |
| 82 uint32_t RTP_timestamp; | |
| 83 uint32_t sender_packet_count; | |
| 84 uint32_t sender_octet_count; | |
| 85 }; | |
| 86 | |
| 87 // See section 6.4.2 in http://www.ietf.org/rfc/rfc3550.txt for details. | |
| 88 struct ReportBlock { | |
| 89 uint32_t sender_SSRC; // SSRC of sender | |
| 90 uint32_t source_SSRC; | |
| 91 uint8_t fraction_lost; | |
| 92 uint32_t cumulative_num_packets_lost; | |
| 93 uint32_t extended_highest_sequence_number; | |
| 94 uint32_t interarrival_jitter; | |
| 95 uint32_t last_SR_timestamp; | |
| 96 uint32_t delay_since_last_SR; | |
| 97 }; | |
| 98 | |
| 99 // VoERTP_RTCP | |
| 100 class WEBRTC_DLLEXPORT VoERTP_RTCP { | |
| 101 public: | |
| 102 // Factory for the VoERTP_RTCP sub-API. Increases an internal | |
| 103 // reference counter if successful. Returns NULL if the API is not | |
| 104 // supported or if construction fails. | |
| 105 static VoERTP_RTCP* GetInterface(VoiceEngine* voiceEngine); | |
| 106 | |
| 107 // Releases the VoERTP_RTCP sub-API and decreases an internal | |
| 108 // reference counter. Returns the new reference count. This value should | |
| 109 // be zero for all sub-API:s before the VoiceEngine object can be safely | |
| 110 // deleted. | |
| 111 virtual int Release() = 0; | |
| 112 | |
| 113 // Sets the local RTP synchronization source identifier (SSRC) explicitly. | |
| 114 virtual int SetLocalSSRC(int channel, unsigned int ssrc) = 0; | |
| 115 | |
| 116 // Gets the local RTP SSRC of a specified |channel|. | |
| 117 virtual int GetLocalSSRC(int channel, unsigned int& ssrc) = 0; | |
| 118 | |
| 119 // Gets the SSRC of the incoming RTP packets. | |
| 120 virtual int GetRemoteSSRC(int channel, unsigned int& ssrc) = 0; | |
| 121 | |
| 122 // Sets the status of rtp-audio-level-indication on a specific |channel|. | |
| 123 virtual int SetSendAudioLevelIndicationStatus(int channel, | |
| 124 bool enable, | |
| 125 unsigned char id = 1) = 0; | |
| 126 | |
| 127 // Sets the RTCP status on a specific |channel|. | |
| 128 virtual int SetRTCPStatus(int channel, bool enable) = 0; | |
| 129 | |
| 130 // Gets the RTCP status on a specific |channel|. | |
| 131 virtual int GetRTCPStatus(int channel, bool& enabled) = 0; | |
| 132 | |
| 133 // Sets the canonical name (CNAME) parameter for RTCP reports on a | |
| 134 // specific |channel|. | |
| 135 virtual int SetRTCP_CNAME(int channel, const char cName[256]) = 0; | |
| 136 | |
| 137 // Gets the canonical name (CNAME) parameter for incoming RTCP reports | |
| 138 // on a specific channel. | |
| 139 virtual int GetRemoteRTCP_CNAME(int channel, char cName[256]) = 0; | |
| 140 | |
| 141 // Gets RTCP statistics for a specific |channel|. | |
| 142 virtual int GetRTCPStatistics(int channel, CallStatistics& stats) = 0; | |
| 143 | |
| 144 protected: | |
| 145 VoERTP_RTCP() {} | |
| 146 virtual ~VoERTP_RTCP() {} | |
| 147 }; | |
| 148 | |
| 149 } // namespace webrtc | |
| 150 | |
| 151 #endif // #ifndef VOICE_ENGINE_VOE_RTP_RTCP_H_ | |
| OLD | NEW |