Skip to content

Commit 7ca2399

Browse files
author
xianing
committed
adapt 3.7.200 sdk, finish ios android macos developing
1 parent ccf6580 commit 7ca2399

63 files changed

Lines changed: 13303 additions & 498 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Binary file not shown.
Binary file not shown.

Android/APIExample/agora-simple-filter/src/main/cpp/AgoraRtcKit/AgoraBase.h

Lines changed: 260 additions & 26 deletions
Large diffs are not rendered by default.

Android/APIExample/agora-simple-filter/src/main/cpp/AgoraRtcKit/AgoraMediaBase.h

Lines changed: 221 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ typedef unsigned int conn_id_t;
2929
static const unsigned int DEFAULT_CONNECTION_ID = 0;
3030
static const unsigned int DUMMY_CONNECTION_ID = (std::numeric_limits<unsigned int>::max)();
3131

32+
3233
struct EncodedVideoFrameInfo;
3334

3435
/**
@@ -63,7 +64,15 @@ enum AudioRoute
6364
/**
6465
* The Bluetooth headset.
6566
*/
66-
ROUTE_HEADSETBLUETOOTH
67+
ROUTE_HEADSETBLUETOOTH,
68+
/**
69+
* The HDMI
70+
*/
71+
ROUTE_HDMI,
72+
/**
73+
* The USB
74+
*/
75+
ROUTE_USB
6776
};
6877

6978
/**
@@ -104,6 +113,67 @@ enum RAW_AUDIO_FRAME_OP_MODE_TYPE {
104113
} // namespace rtc
105114

106115
namespace media {
116+
/**
117+
* The type of media device.
118+
*/
119+
enum MEDIA_SOURCE_TYPE {
120+
/**
121+
* 0: The audio playback device.
122+
*/
123+
AUDIO_PLAYOUT_SOURCE = 0,
124+
/**
125+
* 1: Microphone.
126+
*/
127+
AUDIO_RECORDING_SOURCE = 1,
128+
/**
129+
* 2: Video captured by primary camera.
130+
*/
131+
PRIMARY_CAMERA_SOURCE = 2,
132+
/**
133+
* 3: Video captured by secondary camera.
134+
*/
135+
SECONDARY_CAMERA_SOURCE = 3,
136+
/**
137+
* 4: Video captured by primary screen capturer.
138+
*/
139+
PRIMARY_SCREEN_SOURCE = 4,
140+
/**
141+
* 5: Video captured by secondary screen capturer.
142+
*/
143+
SECONDARY_SCREEN_SOURCE = 5,
144+
/**
145+
* 6: Video captured by custom video source.
146+
*/
147+
CUSTOM_VIDEO_SOURCE = 6,
148+
/**
149+
* 7: Video for media player sharing.
150+
*/
151+
MEDIA_PLAYER_SOURCE = 7,
152+
/**
153+
* 8: Video for png image.
154+
*/
155+
RTC_IMAGE_PNG_SOURCE = 8,
156+
/**
157+
* 9: Video for jpeg image.
158+
*/
159+
RTC_IMAGE_JPEG_SOURCE = 9,
160+
/**
161+
* 10: Video for gif image.
162+
*/
163+
RTC_IMAGE_GIF_SOURCE = 10,
164+
/**
165+
* 11: Remote video received from network.
166+
*/
167+
REMOTE_VIDEO_SOURCE = 11,
168+
/**
169+
* 12: Video for transcoded.
170+
*/
171+
TRANSCODED_VIDEO_SOURCE = 12,
172+
/**
173+
* 100: Internal Usage only.
174+
*/
175+
UNKNOWN_MEDIA_SOURCE = 100
176+
};
107177
namespace base {
108178

109179
typedef void* view_t;
@@ -185,7 +255,7 @@ struct AudioPcmFrame {
185255
this->num_channels_ = src.num_channels_;
186256

187257
size_t length = src.samples_per_channel_ * src.num_channels_;
188-
if ( length > kMaxDataSizeSamples) {
258+
if (length > kMaxDataSizeSamples) {
189259
length = kMaxDataSizeSamples;
190260
}
191261

@@ -194,14 +264,41 @@ struct AudioPcmFrame {
194264
return *this;
195265
}
196266

197-
AudioPcmFrame() :
198-
capture_timestamp(0),
199-
samples_per_channel_(0),
200-
sample_rate_hz_(0),
201-
num_channels_(0),
202-
bytes_per_sample(rtc::TWO_BYTES_PER_SAMPLE) {
267+
AudioPcmFrame()
268+
: capture_timestamp(0),
269+
samples_per_channel_(0),
270+
sample_rate_hz_(0),
271+
num_channels_(0),
272+
bytes_per_sample(rtc::TWO_BYTES_PER_SAMPLE) {
203273
memset(data_, 0, sizeof(data_));
204274
}
275+
276+
AudioPcmFrame(const AudioPcmFrame& src)
277+
: capture_timestamp(src.capture_timestamp),
278+
samples_per_channel_(src.samples_per_channel_),
279+
sample_rate_hz_(src.sample_rate_hz_),
280+
num_channels_(src.num_channels_),
281+
bytes_per_sample(src.bytes_per_sample) {
282+
size_t length = src.samples_per_channel_ * src.num_channels_;
283+
if (length > kMaxDataSizeSamples) {
284+
length = kMaxDataSizeSamples;
285+
}
286+
287+
memcpy(this->data_, src.data_, length * sizeof(int16_t));
288+
}
289+
};
290+
291+
/** Audio dual-mono output mode
292+
*/
293+
enum AUDIO_DUAL_MONO_MODE {
294+
/**< ChanLOut=ChanLin, ChanRout=ChanRin */
295+
AUDIO_DUAL_MONO_STEREO = 0,
296+
/**< ChanLOut=ChanRout=ChanLin */
297+
AUDIO_DUAL_MONO_L = 1,
298+
/**< ChanLOut=ChanRout=ChanRin */
299+
AUDIO_DUAL_MONO_R = 2,
300+
/**< ChanLout=ChanRout=(ChanLin+ChanRin)/2 */
301+
AUDIO_DUAL_MONO_MIX = 3
205302
};
206303

207304
class IAudioFrameObserver {
@@ -214,7 +311,7 @@ class IAudioFrameObserver {
214311
* reporting the detailed information of the audio frame.
215312
* @param frame The detailed information of the audio frame. See {@link AudioPcmFrame}.
216313
*/
217-
virtual void onFrame(const AudioPcmFrame* frame) = 0;
314+
virtual void onFrame(AudioPcmFrame* frame) = 0;
218315
virtual ~IAudioFrameObserver() {}
219316
};
220317

@@ -540,9 +637,9 @@ enum VIDEO_MODULE_POSITION {
540637
} // namespace base
541638

542639
/**
543-
* The IAudioFrameObserver class.
640+
* The IAudioFrameObserverBase class.
544641
*/
545-
class IAudioFrameObserver {
642+
class IAudioFrameObserverBase {
546643
public:
547644
/**
548645
* Audio frame types.
@@ -602,7 +699,7 @@ class IAudioFrameObserver {
602699
};
603700

604701
public:
605-
virtual ~IAudioFrameObserver() {}
702+
virtual ~IAudioFrameObserverBase() {}
606703

607704
/**
608705
* Occurs when the recorded audio frame is received.
@@ -628,6 +725,27 @@ class IAudioFrameObserver {
628725
* - false: The mixed audio data is invalid and is not encoded or sent.
629726
*/
630727
virtual bool onMixedAudioFrame(AudioFrame& audioFrame) = 0;
728+
/**
729+
* Occurs when the before-mixing playback audio frame is received.
730+
* @param userId ID of the remote user.
731+
* @param audioFrame The reference to the audio frame: AudioFrame.
732+
* @return
733+
* - true: The before-mixing playback audio frame is valid and is encoded and sent.
734+
* - false: The before-mixing playback audio frame is invalid and is not encoded or sent.
735+
*/
736+
virtual bool onPlaybackAudioFrameBeforeMixing(base::user_id_t userId, AudioFrame& audioFrame) {
737+
(void) userId;
738+
(void) audioFrame;
739+
return true;
740+
}
741+
};
742+
743+
/**
744+
* The IAudioFrameObserver class.
745+
*/
746+
class IAudioFrameObserver : public IAudioFrameObserverBase {
747+
public:
748+
using IAudioFrameObserverBase::onPlaybackAudioFrameBeforeMixing;
631749
/**
632750
* Occurs when the before-mixing playback audio frame is received.
633751
* @param uid ID of the remote user.
@@ -636,7 +754,7 @@ class IAudioFrameObserver {
636754
* - true: The before-mixing playback audio frame is valid and is encoded and sent.
637755
* - false: The before-mixing playback audio frame is invalid and is not encoded or sent.
638756
*/
639-
virtual bool onPlaybackAudioFrameBeforeMixing(unsigned int uid, AudioFrame& audioFrame) = 0;
757+
virtual bool onPlaybackAudioFrameBeforeMixing(rtc::uid_t uid, AudioFrame& audioFrame) = 0;
640758
};
641759

642760
struct AudioSpectrumData {
@@ -811,15 +929,14 @@ class IVideoFrameObserver {
811929
* After post-processing, you can send the processed data back to the SDK by setting the `videoFrame`
812930
* parameter in this callback.
813931
*
814-
* @param uid ID of the remote user who sends the current video frame.
815-
* @param connectionId ID of the connection.
932+
* @param channelId The channel name
933+
* @param remoteUid ID of the remote user who sends the current video frame.
816934
* @param videoFrame A pointer to the video frame: VideoFrame
817935
* @return Determines whether to ignore the current video frame if the post-processing fails:
818936
* - true: Do not ignore.
819937
* - false: Ignore, in which case this method does not sent the current video frame to the SDK.
820938
*/
821-
virtual bool onRenderVideoFrame(rtc::uid_t uid, rtc::conn_id_t connectionId,
822-
VideoFrame& videoFrame) = 0;
939+
virtual bool onRenderVideoFrame(const char* channelId, rtc::uid_t remoteUid, VideoFrame& videoFrame) = 0;
823940

824941
virtual bool onTranscodedVideoFrame(VideoFrame& videoFrame) = 0;
825942

@@ -841,9 +958,11 @@ class IVideoFrameObserver {
841958
/**
842959
* Occurs each time needs to get rotation angle.
843960
*
844-
* @return rotation angle.
961+
* @return Determines whether to rotate.
962+
* - true: need to rotate.
963+
* - false: no rotate.
845964
*/
846-
virtual int getRotationApplied() { return 0; }
965+
virtual bool getRotationApplied() { return false; }
847966

848967
/**
849968
* Occurs each time needs to get whether mirror is applied or not.
@@ -863,6 +982,89 @@ class IVideoFrameObserver {
863982
*/
864983
virtual bool isExternal() { return true; }
865984
};
985+
/** Definition of contentinspect
986+
*/
987+
#define MAX_CONTENT_INSPECT_MODULE_COUNT 32
988+
enum CONTENT_INSPECT_RESULT {
989+
CONTENT_INSPECT_NEUTRAL = 1,
990+
CONTENT_INSPECT_SEXY = 2,
991+
CONTENT_INSPECT_PORN = 3,
992+
};
993+
enum CONTENT_INSPECT_DEVICE_TYPE{
994+
CONTENT_INSPECT_DEVICE_INVALID = 0,
995+
CONTENT_INSPECT_DEVICE_AGORA = 1,
996+
CONTENT_INSPECT_DEVICE_HIVE = 2,
997+
CONTENT_INSPECT_DEVICE_TUPU = 3
998+
};
999+
enum CONTENT_INSPECT_TYPE {
1000+
/**
1001+
* (Default) content inspect type invalid
1002+
*/
1003+
CONTENT_INSPECT_INVALIDE = 0,
1004+
/**
1005+
* Content inspect type moderation
1006+
*/
1007+
CONTENT_INSPECT_MODERATION = 1,
1008+
/**
1009+
* Content inspect type supervise
1010+
*/
1011+
CONTENT_INSPECT_SUPERVISE = 2
1012+
};
1013+
struct ContentInspectModule {
1014+
/**
1015+
* The content inspect module type.
1016+
*/
1017+
CONTENT_INSPECT_TYPE type;
1018+
/**The content inspect frequency, default is 0 second.
1019+
* the frequency <= 0 is invalid.
1020+
*/
1021+
unsigned int frequency;
1022+
};
1023+
/** Definition of ContentInspectConfig.
1024+
*/
1025+
struct ContentInspectConfig {
1026+
/** jh on device.*/
1027+
bool DeviceWork;
1028+
1029+
/** jh on cloud.*/
1030+
bool CloudWork;
1031+
1032+
/**the type of jh on device.*/
1033+
CONTENT_INSPECT_DEVICE_TYPE DeviceworkType;
1034+
const char* extraInfo;
1035+
1036+
/**The content inspect modules, max length of modules is 32.
1037+
* the content(snapshot of send video stream, image) can be used to max of 32 types functions.
1038+
*/
1039+
ContentInspectModule modules[MAX_CONTENT_INSPECT_MODULE_COUNT];
1040+
/**The content inspect module count.
1041+
*/
1042+
int moduleCount;
1043+
ContentInspectConfig& operator=(ContentInspectConfig& rth)
1044+
{
1045+
DeviceWork = rth.DeviceWork;
1046+
CloudWork = rth.CloudWork;
1047+
DeviceworkType = rth.DeviceworkType;
1048+
extraInfo = rth.extraInfo;
1049+
moduleCount = rth.moduleCount;
1050+
memcpy(&modules, &rth.modules, MAX_CONTENT_INSPECT_MODULE_COUNT * sizeof(ContentInspectModule));
1051+
return *this;
1052+
}
1053+
ContentInspectConfig() :DeviceWork(false),CloudWork(true),DeviceworkType(CONTENT_INSPECT_DEVICE_INVALID),extraInfo(NULL), moduleCount(0){}
1054+
};
8661055

1056+
/**
1057+
* The external video source type.
1058+
*/
1059+
enum EXTERNAL_VIDEO_SOURCE_TYPE {
1060+
/**
1061+
* 0: non-encoded video frame.
1062+
*/
1063+
VIDEO_FRAME = 0,
1064+
/**
1065+
* 1: encoded video frame.
1066+
*/
1067+
ENCODED_VIDEO_FRAME,
1068+
};
8671069
} // namespace media
8681070
} // namespace agora

0 commit comments

Comments
 (0)