Agora Server Gateway SDK C++ API Reference
NGIAgoraLocalUser.h
Go to the documentation of this file.
1//
2// Agora SDK
3//
4// Created by Zheng Ender in 2018-01.
5// Copyright (c) 2018 Agora.io. All rights reserved.
6//
7
8#pragma once // NOLINT(build/header_guard)
9
10#include <cstring>
11
12#include "AgoraBase.h"
13#include "AgoraOptional.h"
14
15namespace agora {
16namespace media {
18}
19
20namespace rtc {
21class IAudioEngineWrapper;
22
23class ILocalUserObserver;
24class ILocalVideoTrack;
25class IRemoteVideoTrack;
26class IVideoFrameObserver2;
27
28struct AudioEncoderConfiguration;
29struct VideoEncoderConfiguration;
30
31class ILocalAudioTrack;
32struct RemoteAudioTrackStats;
33class IRemoteAudioTrack;
34struct LocalVideoTrackStats;
35struct RemoteVideoTrackStats;
36class IVideoSinkBase;
49 public:
51
54 struct ANAStats {
60 agora::Optional<uint32_t> bitrate_action_counter;
66 agora::Optional<uint32_t> channel_action_counter;
72 agora::Optional<uint32_t> dtx_action_counter;
78 agora::Optional<uint32_t> fec_action_counter;
85 agora::Optional<uint32_t> frame_length_increase_counter;
92 agora::Optional<uint32_t> frame_length_decrease_counter;
98 agora::Optional<float> uplink_packet_loss_fraction;
99 };
100
104 struct AudioProcessingStats {
113 agora::Optional<double> echo_return_loss;
114 //
125 agora::Optional<double> echo_return_loss_enhancement;
130 agora::Optional<double> divergent_filter_fraction;
131
144 agora::Optional<int32_t> delay_median_ms;
148 agora::Optional<int32_t> delay_standard_deviation_ms;
149
153 agora::Optional<double> residual_echo_likelihood;
157 agora::Optional<double> residual_echo_likelihood_recent_max;
158
164 };
166 public:
167 virtual ~ILocalUser() {}
168
185 virtual void setUserRole(rtc::CLIENT_ROLE_TYPE role) = 0;
186
193
195 virtual void setAudienceLatencyLevel(AUDIENCE_LATENCY_LEVEL_TYPE level) = 0;
196
197 virtual AUDIENCE_LATENCY_LEVEL_TYPE getAudienceLatencyLevel() = 0;
199
210
222 virtual int publishAudio(agora_refptr<ILocalAudioTrack> audioTrack) = 0;
223
232 virtual int unpublishAudio(agora_refptr<ILocalAudioTrack> audioTrack) = 0;
233
242 virtual int publishVideo(agora_refptr<ILocalVideoTrack> videoTrack) = 0;
243
252 virtual int unpublishVideo(agora_refptr<ILocalVideoTrack> videoTrack) = 0;
253
263 virtual int subscribeAudio(user_id_t userId) = 0;
264
274 virtual int subscribeAllAudio() = 0;
275
285 virtual int unsubscribeAudio(user_id_t userId) = 0;
286
297 virtual int unsubscribeAllAudio() = 0;
298
315 virtual int setPlaybackAudioFrameParameters(size_t numberOfChannels,
316 uint32_t sampleRateHz,
318 int samplesPerCall = 0) = 0;
335 virtual int setRecordingAudioFrameParameters(size_t numberOfChannels,
336 uint32_t sampleRateHz,
338 int samplesPerCall = 0) = 0;
353 virtual int setMixedAudioFrameParameters(size_t numberOfChannels,
354 uint32_t sampleRateHz,
355 int samplesPerCall = 0) = 0;
356
371 virtual int setPlaybackAudioFrameBeforeMixingParameters(size_t numberOfChannels,
372 uint32_t sampleRateHz) = 0;
373
390 virtual int registerAudioFrameObserver(agora::media::IAudioFrameObserverBase * observer) = 0;
399 virtual int unregisterAudioFrameObserver(agora::media::IAudioFrameObserverBase * observer) = 0;
400
413 virtual int registerVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver* observer) = 0;
421 virtual int unregisterVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver* observer) = 0;
422
444
457 virtual int subscribeVideo(user_id_t userId,
458 const rtc::VideoSubscriptionOptions &subscriptionOptions) = 0;
459
470 virtual int subscribeAllVideo(const rtc::VideoSubscriptionOptions &subscriptionOptions) = 0;
471
481 virtual int unsubscribeVideo(user_id_t userId) = 0;
482
493 virtual int unsubscribeAllVideo() = 0;
494
507 ILocalUserObserver* observer,
508 void(*safeDeleter)(ILocalUserObserver*) = NULL) = 0;
509
519
530 virtual int sendIntraRequest(user_id_t userId) = 0;
531};
532
541
545 unsigned int volume;
546
547 /*
548 * The activity status of remote users
549 */
550 unsigned int vad;
551
556
558};
559
564 public:
566
573 virtual void onAudioTrackPublishSuccess(agora_refptr<ILocalAudioTrack> audioTrack) = 0;
574
576
582 virtual void onAudioTrackPublicationFailure(agora_refptr<ILocalAudioTrack> audioTrack,
583 ERROR_CODE_TYPE error) = 0;
585
592 virtual void onLocalAudioTrackStateChanged(agora_refptr<rtc::ILocalAudioTrack> audioTrack,
594 LOCAL_AUDIO_STREAM_ERROR errorCode) = 0;
600 virtual void onLocalAudioTrackStatistics(const LocalAudioStats& stats) = 0;
607 virtual void onRemoteAudioTrackStatistics(agora_refptr<rtc::IRemoteAudioTrack> audioTrack, const RemoteAudioTrackStats& stats) = 0;
618 agora_refptr<rtc::IRemoteAudioTrack> audioTrack) = 0;
619
630 agora_refptr<rtc::IRemoteAudioTrack> audioTrack,
631 REMOTE_AUDIO_STATE state,
633 int elapsed) = 0;
634
640 virtual void onVideoTrackPublishSuccess(agora_refptr<ILocalVideoTrack> videoTrack) = 0;
641
643
649 virtual void onVideoTrackPublicationFailure(agora_refptr<ILocalVideoTrack> videoTrack,
650 ERROR_CODE_TYPE error) = 0;
652
663 virtual void onLocalVideoTrackStateChanged(agora_refptr<rtc::ILocalVideoTrack> videoTrack,
665 LOCAL_VIDEO_STREAM_ERROR errorCode) = 0;
666
673 virtual void onLocalVideoTrackStatistics(agora_refptr<rtc::ILocalVideoTrack> videoTrack,
674 const LocalVideoTrackStats& stats) = 0;
675
687 agora_refptr<rtc::IRemoteVideoTrack> videoTrack) = 0;
688
699 agora_refptr<rtc::IRemoteVideoTrack> videoTrack,
700 REMOTE_VIDEO_STATE state,
702 int elapsed) = 0;
703
712 virtual void onFirstRemoteVideoFrameRendered(user_id_t userId, int width,
713 int height, int elapsed) = 0;
714
715
722 virtual void onRemoteVideoTrackStatistics(agora_refptr<rtc::IRemoteVideoTrack> videoTrack,
723 const RemoteVideoTrackStats& stats) = 0;
725
754 virtual void onAudioVolumeIndication(const AudioVolumeInformation* speakers, unsigned int speakerNumber,
755 int totalVolume) = 0;
756
769 virtual void onActiveSpeaker(user_id_t userId) = 0;
771
780 virtual void onAudioSubscribeStateChanged(const char* channel, user_id_t userId, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) = 0;
781
791 virtual void onVideoSubscribeStateChanged(const char* channel, user_id_t userId, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState) = 0;
792
801 virtual void onAudioPublishStateChanged(const char* channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState) = 0;
802
811 virtual void onVideoPublishStateChanged(const char* channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState) = 0;
812
818 virtual void onFirstRemoteAudioFrame(user_id_t userId, int elapsed) = 0;
819
826 virtual void onFirstRemoteAudioDecoded(user_id_t userId, int elapsed) = 0;
828
837 virtual void onFirstRemoteVideoFrame(user_id_t userId, int width, int height, int elapsed) = 0;
839
847 virtual void onFirstRemoteVideoDecoded(user_id_t userId, int width, int height, int elapsed) = 0;
848
866
869 USER_MEDIA_INFO_ENABLE_LOCAL_VIDEO = 8,
871 };
872
881 virtual void onUserInfoUpdated(user_id_t userId, USER_MEDIA_INFO msg, bool val) {
882 (void)userId;
883 (void)msg;
884 (void)val;
885 }
886
893 virtual void onIntraRequestReceived() {}
894
907 virtual void onStreamMessage(user_id_t userId, int streamId, const char* data, size_t length) {}
928
929 };
930
936 virtual void onUserStateChanged(user_id_t userId, uint32_t state){}
937};
938
940 public:
950 virtual void onFrame(const char* channelId, user_id_t remoteUid, const media::base::VideoFrame* frame) = 0;
951
953};
954
955} // namespace rtc
956} // namespace agora
Definition: AgoraMediaBase.h:765
Definition: AgoraOptional.h:413
Definition: NGIAgoraLocalUser.h:48
virtual int subscribeAllAudio()=0
virtual int registerAudioFrameObserver(agora::media::IAudioFrameObserverBase *observer)=0
virtual int setAudioEncoderConfiguration(const rtc::AudioEncoderConfiguration &config)=0
virtual int unpublishAudio(agora_refptr< ILocalAudioTrack > audioTrack)=0
virtual void setUserRole(rtc::CLIENT_ROLE_TYPE role)=0
virtual int registerVideoFrameObserver(IVideoFrameObserver2 *observer)=0
virtual int unsubscribeAudio(user_id_t userId)=0
virtual int unsubscribeAllVideo()=0
virtual int subscribeVideo(user_id_t userId, const rtc::VideoSubscriptionOptions &subscriptionOptions)=0
virtual int setRecordingAudioFrameParameters(size_t numberOfChannels, uint32_t sampleRateHz, RAW_AUDIO_FRAME_OP_MODE_TYPE mode=RAW_AUDIO_FRAME_OP_MODE_READ_ONLY, int samplesPerCall=0)=0
virtual int publishAudio(agora_refptr< ILocalAudioTrack > audioTrack)=0
virtual int unpublishVideo(agora_refptr< ILocalVideoTrack > videoTrack)=0
virtual int publishVideo(agora_refptr< ILocalVideoTrack > videoTrack)=0
virtual int unsubscribeAllAudio()=0
virtual CLIENT_ROLE_TYPE getUserRole()=0
virtual int registerLocalUserObserver(ILocalUserObserver *observer, void(*safeDeleter)(ILocalUserObserver *)=NULL)=0
virtual int unregisterLocalUserObserver(ILocalUserObserver *observer)=0
virtual ~ILocalUser()
Definition: NGIAgoraLocalUser.h:167
virtual int unregisterAudioFrameObserver(agora::media::IAudioFrameObserverBase *observer)=0
virtual int subscribeAllVideo(const rtc::VideoSubscriptionOptions &subscriptionOptions)=0
virtual int unregisterVideoFrameObserver(IVideoFrameObserver2 *observer)=0
virtual int setPlaybackAudioFrameBeforeMixingParameters(size_t numberOfChannels, uint32_t sampleRateHz)=0
virtual int unregisterVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver *observer)=0
virtual int subscribeAudio(user_id_t userId)=0
virtual int unsubscribeVideo(user_id_t userId)=0
virtual int registerVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver *observer)=0
virtual int sendIntraRequest(user_id_t userId)=0
virtual int setMixedAudioFrameParameters(size_t numberOfChannels, uint32_t sampleRateHz, int samplesPerCall=0)=0
virtual int setPlaybackAudioFrameParameters(size_t numberOfChannels, uint32_t sampleRateHz, RAW_AUDIO_FRAME_OP_MODE_TYPE mode=RAW_AUDIO_FRAME_OP_MODE_READ_ONLY, int samplesPerCall=0)=0
Definition: NGIAgoraLocalUser.h:563
virtual void onVideoPublishStateChanged(const char *channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState)=0
virtual ~ILocalUserObserver()
Definition: NGIAgoraLocalUser.h:565
virtual void onAudioSubscribeStateChanged(const char *channel, user_id_t userId, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)=0
virtual void onStreamMessage(user_id_t userId, int streamId, const char *data, size_t length)
Definition: NGIAgoraLocalUser.h:907
virtual void onLocalVideoTrackStatistics(agora_refptr< rtc::ILocalVideoTrack > videoTrack, const LocalVideoTrackStats &stats)=0
virtual void onAudioTrackPublishSuccess(agora_refptr< ILocalAudioTrack > audioTrack)=0
virtual void onAudioPublishStateChanged(const char *channel, STREAM_PUBLISH_STATE oldState, STREAM_PUBLISH_STATE newState, int elapseSinceLastState)=0
virtual void onVideoSubscribeStateChanged(const char *channel, user_id_t userId, STREAM_SUBSCRIBE_STATE oldState, STREAM_SUBSCRIBE_STATE newState, int elapseSinceLastState)=0
virtual void onUserInfoUpdated(user_id_t userId, USER_MEDIA_INFO msg, bool val)
Definition: NGIAgoraLocalUser.h:881
virtual void onLocalAudioTrackStatistics(const LocalAudioStats &stats)=0
virtual void onUserVideoTrackSubscribed(user_id_t userId, VideoTrackInfo trackInfo, agora_refptr< rtc::IRemoteVideoTrack > videoTrack)=0
virtual void onUserVideoTrackStateChanged(user_id_t userId, agora_refptr< rtc::IRemoteVideoTrack > videoTrack, REMOTE_VIDEO_STATE state, REMOTE_VIDEO_STATE_REASON reason, int elapsed)=0
virtual void onFirstRemoteAudioDecoded(user_id_t userId, int elapsed)=0
virtual void onVideoTrackPublishSuccess(agora_refptr< ILocalVideoTrack > videoTrack)=0
virtual void onRemoteAudioTrackStatistics(agora_refptr< rtc::IRemoteAudioTrack > audioTrack, const RemoteAudioTrackStats &stats)=0
virtual void onFirstRemoteVideoFrameRendered(user_id_t userId, int width, int height, int elapsed)=0
virtual void onUserAudioTrackSubscribed(user_id_t userId, agora_refptr< rtc::IRemoteAudioTrack > audioTrack)=0
virtual void onUserStateChanged(user_id_t userId, uint32_t state)
Definition: NGIAgoraLocalUser.h:936
virtual void onFirstRemoteAudioFrame(user_id_t userId, int elapsed)=0
virtual void onIntraRequestReceived()
Definition: NGIAgoraLocalUser.h:893
virtual void onFirstRemoteVideoDecoded(user_id_t userId, int width, int height, int elapsed)=0
REMOTE_USER_STATE
Definition: NGIAgoraLocalUser.h:911
@ PEER_STATE_ENABLE_VIDEO
Definition: NGIAgoraLocalUser.h:923
@ PEER_STATE_MUTE_AUDIO
Definition: NGIAgoraLocalUser.h:915
@ PEER_STATE_ENABLE_LOCAL_VIDEO
Definition: NGIAgoraLocalUser.h:927
@ PEER_STATE_MUTE_VIDEO
Definition: NGIAgoraLocalUser.h:919
virtual void onRemoteVideoTrackStatistics(agora_refptr< rtc::IRemoteVideoTrack > videoTrack, const RemoteVideoTrackStats &stats)=0
virtual void onLocalAudioTrackStateChanged(agora_refptr< rtc::ILocalAudioTrack > audioTrack, LOCAL_AUDIO_STREAM_STATE state, LOCAL_AUDIO_STREAM_ERROR errorCode)=0
virtual void onLocalVideoTrackStateChanged(agora_refptr< rtc::ILocalVideoTrack > videoTrack, LOCAL_VIDEO_STREAM_STATE state, LOCAL_VIDEO_STREAM_ERROR errorCode)=0
virtual void onUserAudioTrackStateChanged(user_id_t userId, agora_refptr< rtc::IRemoteAudioTrack > audioTrack, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason, int elapsed)=0
USER_MEDIA_INFO
Definition: NGIAgoraLocalUser.h:852
@ USER_MEDIA_INFO_MUTE_VIDEO
Definition: NGIAgoraLocalUser.h:860
@ USER_MEDIA_INFO_ENABLE_VIDEO
Definition: NGIAgoraLocalUser.h:864
@ USER_MEDIA_INFO_MUTE_AUDIO
Definition: NGIAgoraLocalUser.h:856
Definition: NGIAgoraLocalUser.h:939
virtual ~IVideoFrameObserver2()
Definition: NGIAgoraLocalUser.h:952
virtual void onFrame(const char *channelId, user_id_t remoteUid, const media::base::VideoFrame *frame)=0
LOCAL_AUDIO_STREAM_STATE
Definition: AgoraBase.h:2731
LOCAL_AUDIO_STREAM_ERROR
Definition: AgoraBase.h:2754
CLIENT_ROLE_TYPE
Definition: AgoraBase.h:2414
REMOTE_AUDIO_STATE_REASON
Definition: AgoraBase.h:2874
STREAM_PUBLISH_STATE
Definition: AgoraBase.h:4878
LOCAL_VIDEO_STREAM_STATE
Definition: AgoraBase.h:2785
REMOTE_VIDEO_STATE
Definition: AgoraBase.h:2915
REMOTE_AUDIO_STATE
Definition: AgoraBase.h:2839
STREAM_SUBSCRIBE_STATE
Definition: AgoraBase.h:4855
LOCAL_VIDEO_STREAM_ERROR
Definition: AgoraBase.h:2808
REMOTE_VIDEO_STATE_REASON
Definition: AgoraBase.h:2944
RAW_AUDIO_FRAME_OP_MODE_TYPE
Definition: AgoraMediaBase.h:56
@ RAW_AUDIO_FRAME_OP_MODE_READ_ONLY
Definition: AgoraMediaBase.h:61
Definition: AgoraBase.h:86
const char * user_id_t
Definition: AgoraBase.h:1198
Definition: IAgoraService.h:33
Definition: NGIAgoraLocalUser.h:536
unsigned int vad
Definition: NGIAgoraLocalUser.h:550
unsigned int volume
Definition: NGIAgoraLocalUser.h:545
AudioVolumeInformation()
Definition: NGIAgoraLocalUser.h:557
user_id_t userId
Definition: NGIAgoraLocalUser.h:540
double voicePitch
Definition: NGIAgoraLocalUser.h:555
Definition: AgoraBase.h:3250
Definition: NGIAgoraVideoTrack.h:87
Definition: NGIAgoraAudioTrack.h:274
Definition: NGIAgoraVideoTrack.h:298
Definition: AgoraBase.h:1851
Definition: AgoraBase.h:3011