Skip to content

Commit 486da94

Browse files
authored
Merge pull request #126 from AgoraIO-Community/dev/refactor4
Dev/refactor4
2 parents 03970eb + 77fbc41 commit 486da94

Some content is hidden

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

47 files changed

+1616
-236
lines changed

Agora.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@
290290
<Compile Include="Assets\AgoraEngine\Scripts\AgoraGamingSDK\videoRender\VideoSurface.cs" />
291291
<Compile Include="Assets\AgoraEngine\Scripts\AgoraWebGLEventHandler.cs" />
292292
<Compile Include="Assets\AgoraEngine\Scripts\InSurfaceRenderer.cs" />
293+
<Compile Include="Assets\AgoraEngine\Utils\AgoraUIUtils.cs" />
293294
<Compile Include="Assets\AgoraEngine\Utils\TokenClient.cs" />
294295
<Compile Include="Assets\AgoraEngine\Utils\TokenRequestHelper.cs" />
295296
<Compile Include="Assets\API-Example\app-screenshare-sample\AgoraScreenShare.cs" />
595 Bytes
Binary file not shown.
30 Bytes
Binary file not shown.
6.72 KB
Binary file not shown.

Assets/AgoraEngine/Demo/TestHelloUnityVideo.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -441,19 +441,9 @@ private void onUserJoined(uint uid, int elapsed)
441441

442442
remoteUserDisplays.Add(videoSurface.gameObject);
443443
UserVideoDict[uid] = videoSurface;
444-
445-
videoSurface.StartCoroutine(CoGetVideoStats());
446444
}
447445
}
448446

449-
IEnumerator CoGetVideoStats()
450-
{
451-
// give a little head time to allow Web engine gather enough stats
452-
// TODO: it could be faster, do more test with different value to find out
453-
yield return new WaitForSeconds(2);
454-
mRtcEngine.GetRemoteVideoStats();
455-
}
456-
457447
float EnforcingViewLength = 360f;
458448
void OnVideoSizeChangedHandler(uint uid, int width, int height, int rotation)
459449
{

Assets/AgoraEngine/Plugins/WebGL/AgoraWebGLSDK.jslib

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,12 +889,217 @@ var LibraryAgoraWebGLSDK = {
889889
complain: function (callId, desc) {},
890890
freeObject: function (obj) {},
891891
createAVideoDeviceManager: function () {},
892+
createMediaRecorder: function () {
893+
SendNotImplementedError()
894+
},
895+
enableContentInspect: function (enabled, extraInfo, modulesInfo, modulesCount) {
896+
SendNotImplementedError()
897+
},
898+
enableLocalVoicePitchCallback: function (interval) {
899+
SendNotImplementedError()
900+
},
901+
enableSpatialAudio: function (enabled) {
902+
SendNotImplementedError()
903+
},
904+
enableWirelessAccelerate: function (enabled) {
905+
SendNotImplementedError()
906+
},
907+
followSystemPlaybackDevice: function (enabled) {
908+
SendNotImplementedError()
909+
},
910+
followSystemRecordingDevice: function (enabled) {
911+
SendNotImplementedError()
912+
},
913+
getAudioFileInfo: function (filePath) {
914+
SendNotImplementedError()
915+
},
916+
getAudioPlaybackDefaultDevice: function (deviceName, deviceId) {
917+
SendNotImplementedError()
918+
},
919+
getAudioRecordingDefaultDevice: function (deviceName, deviceId) {
920+
SendNotImplementedError()
921+
},
922+
getAudioTrackCount: function () {
923+
SendNotImplementedError()
924+
},
925+
getCameraMaxZoomFactor: function () {
926+
SendNotImplementedError()
927+
},
928+
getScreenCaptureIconImage: function () {
929+
SendNotImplementedError()
930+
},
931+
getScreenCaptureIsPrimaryMonitor: function (index) {
932+
SendNotImplementedError()
933+
},
934+
getScreenCaptureSourceId : function (index) {
935+
SendNotImplementedError()
936+
},
937+
getScreenCaptureSourceName : function (index) {
938+
SendNotImplementedError()
939+
},
940+
getScreenCaptureSourceProcessPath : function (index) {
941+
SendNotImplementedError()
942+
},
943+
getScreenCaptureSourceTitle : function (index) {
944+
SendNotImplementedError()
945+
},
946+
getScreenCaptureSourceType : function (index) {
947+
SendNotImplementedError()
948+
},
949+
getScreenCaptureSources : function (thumbHeight, thumbWidth, iconHeight, iconWidth, includeScreen) {
950+
SendNotImplementedError()
951+
},
952+
getScreenCaptureSourcesCount: function () {
953+
SendNotImplementedError()
954+
},
955+
getScreenCaptureThumbImage: function (index, buffer) {
956+
SendNotImplementedError()
957+
},
958+
isCameraAutoFocusFaceModeSupported: function () {
959+
SendNotImplementedError()
960+
},
961+
isCameraExposurePositionSupported: function () {
962+
SendNotImplementedError()
963+
},
964+
isCameraFocusSupported: function () {
965+
SendNotImplementedError()
966+
},
967+
isCameraZoomSupported: function () {
968+
SendNotImplementedError()
969+
},
970+
pauseAllChannelMediaRelay: function () {
971+
SendNotImplementedError()
972+
},
973+
pauseAllChannelMediaRelay: function () {
974+
SendNotImplementedError()
975+
},
976+
pushAudioFrame3_: function (sourcePos, audioFrameType, samples, bytesPerSample, channels, samplesPerSec, buffer, renderTimeMs, avsync_type) {
977+
SendNotImplementedError()
978+
},
979+
pushVideoFrame2: function (type, format, bufferPtr, stride, height, cropLeft, cropTop, cropRight, cropBottom, rotation, timestamp) {
980+
SendNotImplementedError()
981+
},
982+
releaseMediaRecorder: function () {
983+
SendNotImplementedError()
984+
},
985+
resumeAllChannelMediaRelay: function () {
986+
SendNotImplementedError()
987+
},
988+
initEventOnMediaRecorderCallback: function (onRecorderStateChanged, onRecorderInfoUpdated) {
989+
SendNotImplementedError()
990+
},
991+
selectAudioTrack : function (index) {
992+
SendNotImplementedError()
993+
},
994+
setAVSyncSource : function (channelId, uid) {
995+
SendNotImplementedError()
996+
},
997+
setAVSyncSource2 : function (channel, channelId, uid) {
998+
SendNotImplementedError()
999+
},
1000+
setAudioMixingDualMonoMode : function (mode) {
1001+
SendNotImplementedError()
1002+
},
1003+
setAudioMixingDualMonoMode : function (speed) {
1004+
SendNotImplementedError()
1005+
},
1006+
setAudioMixingDualMonoMode : function (speed) {
1007+
SendNotImplementedError()
1008+
},
1009+
setCameraAutoFocusFaceModeEnabled : function (enabled) {
1010+
SendNotImplementedError()
1011+
},
1012+
setCameraExposurePosition : function (positionXinView, positionYinView) {
1013+
SendNotImplementedError()
1014+
},
1015+
setCameraExposurePosition : function (positionXinView, positionYinView) {
1016+
SendNotImplementedError()
1017+
},
1018+
setCameraFocusPositionInPreview : function (positionX, positionY) {
1019+
SendNotImplementedError()
1020+
},
1021+
setAudioMixingPlaybackSpeed : function (speed) {
1022+
SendNotImplementedError()
1023+
},
1024+
setAudioMixingPlaybackSpeed : function (speed) {
1025+
SendNotImplementedError()
1026+
},
1027+
setCameraZoomFactor : function (factor) {
1028+
SendNotImplementedError()
1029+
},
1030+
setColorEnhanceOptions : function (enabled, strengthLevel, skinProtectLevel) {
1031+
SendNotImplementedError()
1032+
},
1033+
setExternalAudioSourceVolume : function (sourcePos, volume) {
1034+
SendNotImplementedError()
1035+
},
1036+
setLowlightEnhanceOptions : function (enabled, mode, level) {
1037+
SendNotImplementedError()
1038+
},
1039+
setLowlightEnhanceOptions : function (enabled, mode, level) {
1040+
SendNotImplementedError()
1041+
},
1042+
setRemoteUserSpatialAudioParams : function (uid, speaker_azimuth, speaker_elevation, speaker_distance, speaker_orientation, enable_blur, enable_air_absorb) {
1043+
SendNotImplementedError()
1044+
},
1045+
setRemoteUserSpatialAudioParams2 : function (uid, speaker_azimuth, speaker_elevation, speaker_distance, speaker_orientation, enable_blur, enable_air_absorb) {
1046+
SendNotImplementedError()
1047+
},
1048+
setScreenCaptureScenario : function () {
1049+
SendNotImplementedError()
1050+
},
1051+
setVideoDenoiserOptions : function (enabled, mode, level) {
1052+
SendNotImplementedError()
1053+
},
1054+
startAudioDeviceLoopbackTest : function (indicationInterval) {
1055+
SendNotImplementedError()
1056+
},
1057+
startEchoTest3 : function (view, enableAudio, enableVideo, token, channelId) {
1058+
SendNotImplementedError()
1059+
},
1060+
startRecording : function () {
1061+
SendNotImplementedError()
1062+
},
1063+
startRtmpStreamWithTranscoding : function (url, width, height, videoBitrate, videoFramerate, lowLatency, videoGroup, video_codec_profile, backgroundColor, userCount, transcodingUserInfo, transcodingExtraInfo, metaData, watermarkRtcImageUrl, watermarkRtcImageX, watermarkRtcImageY, watermarkRtcImageWidth, watermarkRtcImageHeight, watermarkImageZorder, watermarkImageAlpha, watermarkCount, backgroundImageRtcImageUrl, backgroundImageRtcImageX, backgroundImageRtcImageY, backgroundImageRtcImageWidth, backgroundImageRtcImageHeight, backgroundImageRtcImageZorder, backgroundImageRtcImageAlpha, backgroundImageRtcImageCount, audioSampleRate, audioBitrate, audioChannels, audioCodecProfile, advancedFeatures, advancedFeatureCount) {
1064+
SendNotImplementedError()
1065+
},
1066+
startRtmpStreamWithTranscoding2 : function (channel, url, width, height, videoBitrate, videoFramerate, lowLatency, videoGroup, video_codec_profile, backgroundColor, userCount, transcodingUserInfo, transcodingExtraInfo, metaData, watermarkRtcImageUrl, watermarkRtcImageX, watermarkRtcImageY, watermarkRtcImageWidth, watermarkRtcImageHeight, watermarkImageZorder, watermarkImageAlpha, watermarkCount, backgroundImageRtcImageUrl, backgroundImageRtcImageX, backgroundImageRtcImageY, backgroundImageRtcImageWidth, backgroundImageRtcImageHeight, backgroundImageRtcImageZorder, backgroundImageRtcImageAlpha, backgroundImageRtcImageCount, audioSampleRate, audioBitrate, audioChannels, audioCodecProfile, advancedFeatures, advancedFeatureCount) {
1067+
SendNotImplementedError()
1068+
},
1069+
startRtmpStreamWithoutTranscoding : function (url) {
1070+
SendNotImplementedError()
1071+
},
1072+
startRtmpStreamWithoutTranscoding2 : function (channel, url) {
1073+
SendNotImplementedError()
1074+
},
1075+
stopAudioDeviceLoopbackTest : function () {
1076+
SendNotImplementedError()
1077+
},
1078+
stopRecording : function () {
1079+
SendNotImplementedError()
1080+
},
1081+
stopRtmpStream : function (url) {
1082+
SendNotImplementedError()
1083+
},
1084+
stopRtmpStream2 : function (channel, url) {
1085+
SendNotImplementedError()
1086+
},
1087+
takeSnapshot : function (channel, uid, filePath) {
1088+
SendNotImplementedError()
1089+
},
1090+
updateRtmpTranscoding : function (width, height, videoBitrate, videoFramerate, lowLatency, videoGroup, video_codec_profile, backgroundColor, userCount, transcodingUserInfo, transcodingExtraInfo, metaData, watermarkRtcImageUrl, watermarkRtcImageX, watermarkRtcImageY, watermarkRtcImageWidth, watermarkRtcImageHeight, watermarkImageZorder, watermarkImageAlpha, watermarkCount, backgroundImageRtcImageUrl, backgroundImageRtcImageX, backgroundImageRtcImageY, backgroundImageRtcImageWidth, backgroundImageRtcImageHeight, backgroundImageRtcImageZorder, backgroundImageRtcImageAlpha, backgroundImageRtcImageCount, audioSampleRate, audioBitrate, audioChannels, audioCodecProfile, advancedFeatures, advancedFeatureCount) {
1091+
SendNotImplementedError()
1092+
},
1093+
updateRtmpTranscoding2 : function (channel, width, height, videoBitrate, videoFramerate, lowLatency, videoGroup, video_codec_profile, backgroundColor, userCount, transcodingUserInfo, transcodingExtraInfo, metaData, watermarkRtcImageUrl, watermarkRtcImageX, watermarkRtcImageY, watermarkRtcImageWidth, watermarkRtcImageHeight, watermarkImageZorder, watermarkImageAlpha, watermarkCount, backgroundImageRtcImageUrl, backgroundImageRtcImageX, backgroundImageRtcImageY, backgroundImageRtcImageWidth, backgroundImageRtcImageHeight, backgroundImageRtcImageZorder, backgroundImageRtcImageAlpha, backgroundImageRtcImageCount, audioSampleRate, audioBitrate, audioChannels, audioCodecProfile, advancedFeatures, advancedFeatureCount) {
1094+
SendNotImplementedError()
1095+
},
8921096
adjustAudioMixingPlayoutVolume: function (volume) {
8931097
AdjustAudioMixingPlayoutVolume(volume);
8941098
},
8951099
adjustAudioMixingPublishVolume: function (volume) {
8961100
AdjustAudioMixingPublishVolume(volume);
8971101
},
1102+
8981103
creatAAudioPlaybackDeviceManager: function () {},
8991104
initEventOnPacketCallback: function (
9001105
onReceiveAudioPacket,
@@ -1518,6 +1723,9 @@ muteLocalAudioStream_channel: function(channel, mute) {
15181723
getRemoteVideoStats_WGL: function() {
15191724
getRemoteVideoStats();
15201725
},
1726+
getRemoteVideoStats_MC: function() {
1727+
getRemoteVideoStatsMC();
1728+
},
15211729
generateNativeTexture: function () {},
15221730
setLocalVoicePitch: function (pitch) {},
15231731
addInjectStreamUrl2: function (
@@ -1811,6 +2019,7 @@ muteLocalAudioStream_channel: function(channel, mute) {
18112019
startAudioRecordingWithConfig: function() {},
18122020
switchChannel2: function() {},
18132021
uploadLogFile: function() {},
2022+
setCameraCaptureRotation: function (rotation) {}
18142023
};
18152024

18162025
autoAddDeps(LibraryAgoraWebGLSDK, "$localVideo");

Assets/AgoraEngine/Scripts/AgoraGamingSDK/AgoraBase.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3303,6 +3303,9 @@ public enum SUPER_RESOLUTION_STATE_REASON
33033303
/** 3: The device does not support using super resolution.
33043304
*/
33053305
SR_STATE_REASON_DEVICE_NOT_SUPPORTED = 3,
3306+
/** 4: Insufficient device performance,It is recommended to turn off super resolution.
3307+
*/
3308+
SR_STATE_REASON_INSUFFICIENT_PERFORMANCE = 4,
33063309
};
33073310

33083311
/** The brightness level of the video image captured by the local camera.
@@ -3572,6 +3575,10 @@ public enum VIRTUAL_BACKGROUND_SOURCE_STATE_REASON {
35723575
* 3: The device does not support using the virtual background.
35733576
*/
35743577
VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_DEVICE_NOT_SUPPORTED = 3,
3578+
/**
3579+
* 4: Insufficient device performance,It is recommended to turn off virtual background.
3580+
*/
3581+
VIRTUAL_BACKGROUND_SOURCE_STATE_REASON_INSUFFICIENT_PERFORMANCE = 4,
35753582
};
35763583

35773584
/**
@@ -4263,5 +4270,13 @@ public struct ScreenCaptureInfo {
42634270
public EXCLUDE_WINDOW_ERROR errCode;
42644271
};
42654272

4273+
/** Super Resolution modes. */
4274+
public enum SR_MODE {
4275+
/** 0: manual select uid to do super resolution */
4276+
SR_MODE_MANUAL = 0,
4277+
/** 1: auto select.*/
4278+
SR_MODE_AUTO,
4279+
};
4280+
42664281
#endregion some enum and struct types
42674282
}

Assets/AgoraEngine/Scripts/AgoraGamingSDK/AgoraChannel.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,16 @@ public string GetCallId()
451451
return callIdString;
452452
}
453453

454+
/**
455+
* Gets remote video's stats to trigger OnVideoSizeChanged
456+
*/
457+
public void GetRemoteVideoStats()
458+
{
459+
#if UNITY_WEBGL && !UNITY_EDITOR
460+
IRtcEngineNative.getRemoteVideoStats_MC();
461+
#endif
462+
}
463+
454464
/** Gets a new token when the current token expires after a period of time.
455465
*
456466
* The `token` expires after a period of time once the token schema is enabled when:
@@ -1727,12 +1737,12 @@ public int MuteLocalAudioStream(bool mute)
17271737
* - < 0: Failure.
17281738
* - `-157 (ERR_MODULE_NOT_FOUND)`: The dynamic library for super resolution is not integrated.
17291739
*/
1730-
public int EnableRemoteSuperResolution(uint userId, bool enable)
1740+
public int EnableRemoteSuperResolution(bool enabled, SR_MODE mode, uint userId)
17311741
{
17321742
if (_rtcEngine == null)
17331743
return (int)ERROR_CODE.ERROR_NOT_INIT_ENGINE;
17341744

1735-
return IRtcEngineNative.enableRemoteSuperResolution2(_channelHandler, userId, enable);
1745+
return IRtcEngineNative.enableRemoteSuperResolution2(_channelHandler, enabled, (int)mode, userId);
17361746
}
17371747

17381748

Assets/AgoraEngine/Scripts/AgoraGamingSDK/AgoraGamingRtcEngine.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3862,9 +3862,9 @@ public int EnableEncryption(bool enabled, EncryptionConfig encryptionConfig)
38623862
* - 0: Success.
38633863
* - < 0: Failure.
38643864
*/
3865-
public int EnableRemoteSuperResolution(uint userId, bool enable)
3865+
public int EnableRemoteSuperResolution(bool enabled, SR_MODE mode, uint userId)
38663866
{
3867-
return IRtcEngineNative.enableRemoteSuperResolution(userId, enable);
3867+
return IRtcEngineNative.enableRemoteSuperResolution(enabled, (int)mode, userId);
38683868
}
38693869

38703870
/** Sets the role of a user in interactive live streaming.
@@ -5242,6 +5242,11 @@ public int SetCameraAutoFocusFaceModeEnabled(bool enabled)
52425242
return IRtcEngineNative.setCameraAutoFocusFaceModeEnabled(enabled);
52435243
}
52445244

5245+
public int SetCameraCaptureRotation(int rotation)
5246+
{
5247+
return IRtcEngineNative.setCameraCaptureRotation(rotation);
5248+
}
5249+
52455250
/** Initializes an IRtcEngine instance.
52465251
*
52475252
* Unless otherwise specified, all the methods provided by the IRtcEngine class are executed asynchronously. Agora recommends calling these methods in the same thread.
@@ -5399,7 +5404,6 @@ public static void Destroy()
53995404
}
54005405

54015406
instance = null;
5402-
GC.Collect();
54035407
}
54045408

54055409
// only query, do not create
@@ -5686,7 +5690,6 @@ private static void OnSDKWarningCallback(int warn, string msg)
56865690
if (warn == 8 || warn == 16)
56875691
return;
56885692
#endif
5689-
56905693
if (instance != null && instance.OnWarning != null && instance._AgoraCallbackObject != null)
56915694
{
56925695
AgoraCallbackQueue queue = instance._AgoraCallbackObject._CallbackQueue;

0 commit comments

Comments
 (0)