16 #include "IAgoraService.h"
17 #include "NGIAgoraRtcConnection.h"
22 struct ExtraReportData;
27 struct network_info_t;
32 class IConfigEngineListener;
38 struct CmdRecordingEventReportArgus;
42 class IRtcEngineEventHandler;
43 class InternalConnectionEventHandler;
44 class IAudioEngineWrapper;
46 class AudioPacketFilter;
47 class VideoPacketFilter;
48 struct audio_packet_t;
50 struct video_packet_t;
51 struct video_rtcp_packet_t;
52 struct video_report_packet_t;
53 struct video_custom_ctrl_broadcast_packet_t;
54 struct WebAgentVideoStats;
56 static const uint8_t AUDIO_MEDIA_PACKET_PAYLOAD_TYPE = 127;
72 enum CongestionControlType {
73 CONGESTION_CONTROLLER_TYPE_AGORA_CC = 0,
75 CONGESTION_CONTROLLER_TYPE_REMB,
77 CONGESTION_CONTROLLER_TYPE_TRANSPORT_CC,
79 CONGESTION_CONTROLLER_TYPE_AUT_CC
85 CONNECTION_MODE_ACTIVE,
89 CONNECTION_MODE_PASSIVE
94 : RtcConnectionConfiguration::RtcConnectionConfiguration(),
96 #ifdef P2P_SWITCH_DEFAULT_VALUE
97 is_p2p_switch_enabled(P2P_SWITCH_DEFAULT_VALUE)
99 is_p2p_switch_enabled(
false)
115 #ifdef P2P_SWITCH_DEFAULT_VALUE
116 is_p2p_switch_enabled = P2P_SWITCH_DEFAULT_VALUE;
118 is_p2p_switch_enabled =
false;
122 bool is_p2p_switch_enabled;
123 std::list<std::string> vosList;
132 using onAudioFrameType = std::function<int(
SAudioFrame&)>;
134 onAudioPacketType onAudioPacket_;
135 onVideoPacketType onVideoPacket_;
136 onVideoRtcpPacketType onVideoRtcpPacket_;
137 onVideoReportPacketType onVideoReportPacket_;
138 onVideoCustomCtrlPacketType onVideoCustomCtrlPacket_;
139 onAudioFrameType onAudioFrame_;
141 onVideoPacketType&& onVideoPacket =
nullptr,
142 onVideoRtcpPacketType&& onVideoRtcpPacket =
nullptr,
143 onVideoReportPacketType&& onVideoReportPacket =
nullptr,
144 onVideoCustomCtrlPacketType&& onVideoCustomCtrlPacket =
nullptr,
145 onAudioFrameType&& onAudioFrame =
nullptr)
146 : onAudioPacket_(std::move(onAudioPacket)),
147 onVideoPacket_(std::move(onVideoPacket)),
148 onVideoRtcpPacket_(std::move(onVideoRtcpPacket)),
149 onVideoReportPacket_(std::move(onVideoReportPacket)),
150 onVideoCustomCtrlPacket_(std::move(onVideoCustomCtrlPacket)),
151 onAudioFrame_(std::move(onAudioFrame)) {}
153 : onAudioPacket_(std::move(rhs.onAudioPacket_)),
154 onVideoPacket_(std::move(rhs.onVideoPacket_)),
155 onVideoRtcpPacket_(std::move(rhs.onVideoRtcpPacket_)),
156 onVideoReportPacket_(std::move(rhs.onVideoReportPacket_)),
157 onVideoCustomCtrlPacket_(std::move(rhs.onVideoCustomCtrlPacket_)),
158 onAudioFrame_(std::move(rhs.onAudioFrame_)) {}
163 uint64_t banned_elapse = 0;
164 uint64_t space_id = UINT64_MAX;
173 virtual int deinitialize() = 0;
174 virtual void setUserRole(CLIENT_ROLE_TYPE role) = 0;
175 virtual CLIENT_ROLE_TYPE getUserRole() = 0;
176 virtual bool isEncryptionEnabled()
const = 0;
177 virtual int sendAudioPacket(
audio_packet_t& packet,
int delay_ms = 0) = 0;
178 virtual int sendAudioFrame(
SAudioFrame& frame) = 0;
180 virtual int batchSendVideoPacket(std::vector<video_packet_t>& packets) = 0;
181 virtual int sendBroadcastPacket(std::string&& data) = 0;
186 virtual void unsubscribeReceivePacketHandler() = 0;
187 virtual void setChannelId(
const char* channel) = 0;
188 virtual void setConnectionState(CONNECTION_STATE_TYPE state) = 0;
189 virtual void setLocalUserId(user_id_t userId) = 0;
192 virtual CallContext* getCallContext() = 0;
193 virtual std::shared_ptr<base::BaseWorker> getIOWorker() = 0;
194 virtual bool getUid(user_id_t userId, rtc::uid_t* uid) = 0;
195 virtual bool getUserId(rtc::uid_t uid, std::string& userId) = 0;
196 virtual rtc::uid_t getLocalUid() = 0;
197 virtual void muteLocalAudio(
bool mute) = 0;
198 virtual void muteRemoteAudio(user_id_t userId,
bool mute) = 0;
199 virtual void muteAllRemoteAudio(
bool mute) = 0;
200 virtual void setDefaultMuteAllRemoteAudioStreams(
bool mute) = 0;
201 virtual void muteLocalVideo(
bool mute) = 0;
202 virtual void muteRemoteVideo(user_id_t userId,
bool mute) = 0;
203 virtual void muteAllRemoteVideo(
bool mute) = 0;
204 virtual void setDefaultMuteAllRemoteVideoStreams(
bool mute) = 0;
205 virtual void setRemoteVideoStreamType(user_id_t userId, VIDEO_STREAM_TYPE type) = 0;
206 virtual void setRemoteDefaultVideoStreamType(VIDEO_STREAM_TYPE type) = 0;
208 virtual void setRtcStats(
const RtcStats& stats) = 0;
209 virtual void setBannedTime(
const uint64_t banned_time) = 0;
211 virtual bool isConnected() = 0;
212 virtual uint32_t getCid() = 0;
213 virtual void setVos(
const char* name,
int port) = 0;
214 virtual int reportArgusCounters(
int* counterId,
int* value,
int count, user_id_t userId) = 0;
215 virtual void setChannelProfile(CHANNEL_PROFILE_TYPE channel_profile) = 0;
218 virtual AudioPacketFilter* getAudioPacketFilter() = 0;
219 virtual VideoPacketFilter* getVideoPacketFilter() = 0;
220 virtual bool hasAudioRemoteTrack(user_id_t
id) = 0;
221 virtual bool hasVideoRemoteTrack(user_id_t
id, uint32_t ssrc) = 0;
224 virtual CongestionControlType ccType() = 0;
227 virtual bool isRtcContextValid() = 0;
228 virtual void onClientRoleChanged(CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole) = 0;
229 virtual void onApiCallExecuted(
int err,
const char* api,
const char* result) = 0;
230 virtual void networkChanged(commons::network::network_info_t&& networkInfo) = 0;
231 virtual int sendReport(
const void* data,
size_t length,
int level,
int type,
int retry,
232 const base::ExtraReportData* extra) = 0;
233 virtual int setParameters(
const std::string& parameters,
bool cache,
234 bool suppressNotification) = 0;
235 virtual int getParameters(
const std::string& parameters, any_document_t& results) = 0;
236 virtual void stopAsyncHandler(
bool waitForExit) = 0;
238 bool isExHandler) = 0;
241 virtual int sendWebAgentVideoStats(
const std::string& uidstr,
243 virtual void sendRecordingArgusEvents(
const protocol::CmdRecordingEventReportArgus& events) = 0;
245 virtual int sendCallRating(
const std::string& callId,
int rating,
246 const std::string& description) = 0;
247 virtual bool isCommunicationMode() = 0;
248 virtual bool isWebrtcPacerEnabled() = 0;
249 virtual void didStreamMessageSync(uid_t userId,
int streamId,
const char* data,
size_t length,
250 uint64_t sentTs) = 0;