Skip to content

Commit

Permalink
feat: support 3.4.+
Browse files Browse the repository at this point in the history
  • Loading branch information
LichKing-2234 committed Aug 30, 2021
1 parent 6fc1662 commit 79ff77a
Show file tree
Hide file tree
Showing 42 changed files with 2,993 additions and 1,092 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## [3.4.6](https://github.com/AgoraIO/Flutter-SDK/compare/v3.3.3...v3.4.6) (2021-08-25)


### Bug Fixes

* Android build error ([3af4476](https://github.com/AgoraIO/Flutter-SDK/commit/3af44762ad765cde99024e2b080d4c88f34cfc09))
* enum type cast bug ([9ff389d](https://github.com/AgoraIO/Flutter-SDK/commit/9ff389d55ec096e111e48c94ec74945277501179))
* function.parameters may cause error ([927f8d6](https://github.com/AgoraIO/Flutter-SDK/commit/927f8d61962c486c33bb5dfad7ca5a369aa94199))
* **uid compatible:** int to uint ([ddaa354](https://github.com/AgoraIO/Flutter-SDK/commit/ddaa3544a126d39f58184e8ed98e7031fa2d3991))


### Features

* support 3.4.5 ([9329b67](https://github.com/AgoraIO/Flutter-SDK/commit/9329b6709a4e1ff4a04969dd3c1b96fac131a8ce))
* support 3.4.6 ([77f8abd](https://github.com/AgoraIO/Flutter-SDK/commit/77f8abdcffd34d5c20779415c6ac65ca74aea641))
* support native 3.4.2 ([e792d26](https://github.com/AgoraIO/Flutter-SDK/commit/e792d263f271b2ec1aae2c7970471527d7dc5c1b))
* support native 3.4.2 ([ca658b2](https://github.com/AgoraIO/Flutter-SDK/commit/ca658b2893174f9b71a6a6b704da55d6e4617267))
* **upgrade:** 3.4.1 ([11cef0f](https://github.com/AgoraIO/Flutter-SDK/commit/11cef0f052783e0a8eec0e5da8b461588f03a78d))

## [3.3.3](https://github.com/AgoraIO/Flutter-SDK/compare/v3.3.2...v3.3.3) (2021-04-13)


Expand Down
8 changes: 5 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ buildscript {
def kotlin_version = rootProject.ext.has('kotlin_version') ? rootProject.ext.get('kotlin_version') : '1.3.72'

repositories {
mavenCentral()
google()
jcenter()
}

dependencies {
Expand All @@ -20,8 +20,9 @@ buildscript {

rootProject.allprojects {
repositories {
mavenCentral()
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}

Expand Down Expand Up @@ -49,6 +50,7 @@ android {
}

dependencies {
api 'com.github.agorabuilder:native-full-sdk:3.4.6'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${safeExtGet('kotlin_version', '1.3.72')}"
implementation "io.agora.rtc:full-sdk:3.3.2"
}
31 changes: 26 additions & 5 deletions android/src/main/java/io/agora/rtc/base/Annotations.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public class Annotations {
Constants.LOCAL_AUDIO_STREAM_ERROR_DEVICE_BUSY,
Constants.LOCAL_AUDIO_STREAM_ERROR_CAPTURE_FAILURE,
Constants.LOCAL_AUDIO_STREAM_ERROR_ENCODE_FAILURE,
Constants.LOCAL_AUDIO_STREAM_ERROR_INTERRUPTED,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraAudioLocalError {
Expand All @@ -98,19 +99,27 @@ public class Annotations {
}

@IntDef({
Constants.MEDIA_ENGINE_AUDIO_ERROR_MIXING_OPEN,
Constants.MEDIA_ENGINE_AUDIO_ERROR_MIXING_TOO_FREQUENT,
Constants.MEDIA_ENGINE_AUDIO_EVENT_MIXING_INTERRUPTED_EOF,
AgoraAudioMixingErrorCode.MEDIA_ENGINE_AUDIO_ERROR_OK,
Constants.AUDIO_MIXING_REASON_CAN_NOT_OPEN,
Constants.AUDIO_MIXING_REASON_TOO_FREQUENT_CALL,
Constants.AUDIO_MIXING_REASON_INTERRUPTED_EOF,
Constants.AUDIO_MIXING_REASON_STARTED_BY_USER,
Constants.AUDIO_MIXING_REASON_ONE_LOOP_COMPLETED,
Constants.AUDIO_MIXING_REASON_START_NEW_LOOP,
Constants.AUDIO_MIXING_REASON_ALL_LOOPS_COMPLETED,
Constants.AUDIO_MIXING_REASON_STOPPED_BY_USER,
Constants.AUDIO_MIXING_REASON_PAUSED_BY_USER,
Constants.AUDIO_MIXING_REASON_RESUMED_BY_USER,
AgoraAudioMixingReason.MEDIA_ENGINE_AUDIO_ERROR_OK,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraAudioMixingErrorCode {
public @interface AgoraAudioMixingReason {
int MEDIA_ENGINE_AUDIO_ERROR_OK = 0;
}

@IntDef({
Constants.MEDIA_ENGINE_AUDIO_EVENT_MIXING_PLAY,
Constants.MEDIA_ENGINE_AUDIO_EVENT_MIXING_PAUSED,
Constants.MEDIA_ENGINE_AUDIO_EVENT_MIXING_RESTART,
Constants.MEDIA_ENGINE_AUDIO_EVENT_MIXING_STOPPED,
Constants.MEDIA_ENGINE_AUDIO_EVENT_MIXING_ERROR,
})
Expand Down Expand Up @@ -317,6 +326,10 @@ public class Annotations {
Constants.RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE,
Constants.RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_IS_NULL,
Constants.RELAY_EVENT_VIDEO_PROFILE_UPDATE,
Constants.RELAY_EVENT_PAUSE_SEND_PACKET_TO_DEST_CHANNEL_SUCCESS,
Constants.RELAY_EVENT_PAUSE_SEND_PACKET_TO_DEST_CHANNEL_FAILED,
Constants.RELAY_EVENT_RESUME_SEND_PACKET_TO_DEST_CHANNEL_SUCCESS,
Constants.RELAY_EVENT_RESUME_SEND_PACKET_TO_DEST_CHANNEL_FAILED,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraChannelMediaRelayEvent {
Expand Down Expand Up @@ -402,6 +415,8 @@ public class Annotations {
AgoraEncryptionMode.SM4128ECB,
AgoraEncryptionMode.AES128GCM,
AgoraEncryptionMode.AES256GCM,
AgoraEncryptionMode.AES128GCM2,
AgoraEncryptionMode.AES256GCM2,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraEncryptionMode {
Expand All @@ -412,6 +427,8 @@ public class Annotations {
int SM4128ECB = 4;
int AES128GCM = 5;
int AES256GCM = 6;
int AES128GCM2 = 7;
int AES256GCM2 = 8;
}

@IntDef({
Expand Down Expand Up @@ -461,6 +478,7 @@ public class Annotations {
Constants.ERR_PUBLISH_STREAM_NOT_FOUND,
Constants.ERR_PUBLISH_STREAM_FORMAT_NOT_SUPPORTED,
Constants.ERR_MODULE_NOT_FOUND,
Constants.ERR_ALREADY_IN_RECORDING,
Constants.ERR_LOAD_MEDIA_ENGINE,
Constants.ERR_START_CALL,
Constants.ERR_START_CAMERA,
Expand Down Expand Up @@ -534,6 +552,7 @@ public class Annotations {
Constants.LOCAL_VIDEO_STREAM_ERROR_DEVICE_BUSY,
Constants.LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE,
Constants.LOCAL_VIDEO_STREAM_ERROR_ENCODE_FAILURE,
Constants.LOCAL_VIDEO_STREAM_ERROR_DEVICE_NOT_FOUND
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraLocalVideoStreamError {
Expand Down Expand Up @@ -601,6 +620,7 @@ public class Annotations {
Constants.RTMP_STREAM_PUBLISH_ERROR_NOT_AUTHORIZED,
Constants.RTMP_STREAM_PUBLISH_ERROR_STREAM_NOT_FOUND,
Constants.RTMP_STREAM_PUBLISH_ERROR_FORMAT_NOT_SUPPORTED,
Constants.RTMP_STREAM_UNPUBLISH_ERROR_OK,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraRtmpStreamingErrorCode {
Expand Down Expand Up @@ -818,6 +838,7 @@ public class Annotations {

@IntDef({
Constants.RTMP_STREAMING_EVENT_FAILED_LOAD_IMAGE,
Constants.RTMP_STREAMING_EVENT_URL_ALREADY_IN_USE,
})
@Retention(RetentionPolicy.SOURCE)
public @interface AgoraRtmpStreamingEvent {
Expand Down
60 changes: 51 additions & 9 deletions android/src/main/java/io/agora/rtc/base/BeanCovertor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package io.agora.rtc.base

import android.graphics.Color
import io.agora.rtc.RtcEngineConfig
import io.agora.rtc.audio.AgoraRhythmPlayerConfig
import io.agora.rtc.audio.AudioRecordingConfiguration
import io.agora.rtc.internal.EncryptionConfig
import io.agora.rtc.internal.LastmileProbeConfig
import io.agora.rtc.live.LiveInjectStreamConfig
Expand All @@ -27,7 +29,9 @@ fun mapToVideoEncoderConfiguration(map: Map<*, *>): VideoEncoderConfiguration {
(map["bitrate"] as? Number)?.let { bitrate = it.toInt() }
(map["minBitrate"] as? Number)?.let { minBitrate = it.toInt() }
(map["orientationMode"] as? Number)?.let { orientationMode = intToOrientationMode(it.toInt()) }
(map["degradationPrefer"] as? Number)?.let { degradationPrefer = intToDegradationPreference(it.toInt()) }
(map["degradationPrefer"] as? Number)?.let {
degradationPrefer = intToDegradationPreference(it.toInt())
}
(map["mirrorMode"] as? Number)?.let { mirrorMode = it.toInt() }
}
}
Expand All @@ -53,7 +57,7 @@ fun mapToAgoraImage(map: Map<*, *>): AgoraImage {

fun mapToTranscodingUser(map: Map<*, *>): TranscodingUser {
return TranscodingUser().apply {
(map["uid"] as? Number)?.let { uid = it.toInt() }
(map["uid"] as? Number)?.let { uid = it.toNativeUInt() }
(map["x"] as? Number)?.let { x = it.toInt() }
(map["y"] as? Number)?.let { y = it.toInt() }
(map["width"] as? Number)?.let { width = it.toInt() }
Expand Down Expand Up @@ -82,11 +86,17 @@ fun mapToLiveTranscoding(map: Map<*, *>): LiveTranscoding {
(map["videoGop"] as? Number)?.let { videoGop = it.toInt() }
(map["watermark"] as? Map<*, *>)?.let { watermark = mapToAgoraImage(it) }
(map["backgroundImage"] as? Map<*, *>)?.let { backgroundImage = mapToAgoraImage(it) }
(map["audioSampleRate"] as? Number)?.let { audioSampleRate = intToLiveTranscodingAudioSampleRate(it.toInt()) }
(map["audioSampleRate"] as? Number)?.let {
audioSampleRate = intToLiveTranscodingAudioSampleRate(it.toInt())
}
(map["audioBitrate"] as? Number)?.let { audioBitrate = it.toInt() }
(map["audioChannels"] as? Number)?.let { audioChannels = it.toInt() }
(map["audioCodecProfile"] as? Number)?.let { audioCodecProfile = intToAudioCodecProfile(it.toInt()) }
(map["videoCodecProfile"] as? Number)?.let { videoCodecProfile = intToVideoCodecProfile(it.toInt()) }
(map["audioCodecProfile"] as? Number)?.let {
audioCodecProfile = intToAudioCodecProfile(it.toInt())
}
(map["videoCodecProfile"] as? Number)?.let {
videoCodecProfile = intToVideoCodecProfile(it.toInt())
}
(map["backgroundColor"] as? Map<*, *>)?.let { backgroundColor = mapToColor(it) }
(map["userConfigExtraInfo"] as? String)?.let { userConfigExtraInfo = it }
(map["transcodingUsers"] as? List<*>)?.let { list ->
Expand All @@ -103,7 +113,7 @@ fun mapToChannelMediaInfo(map: Map<*, *>): ChannelMediaInfo {
return ChannelMediaInfo(
map["channelName"] as? String,
map["token"] as? String,
(map["uid"] as Number).toInt()
(map["uid"] as Number).toNativeUInt()
)
}

Expand Down Expand Up @@ -142,8 +152,12 @@ fun mapToRectangle(map: Map<*, *>): WatermarkOptions.Rectangle {
fun mapToWatermarkOptions(map: Map<*, *>): WatermarkOptions {
return WatermarkOptions().apply {
(map["visibleInPreview"] as? Boolean)?.let { visibleInPreview = it }
(map["positionInLandscapeMode"] as? Map<*, *>)?.let { positionInLandscapeMode = mapToRectangle(it) }
(map["positionInPortraitMode"] as? Map<*, *>)?.let { positionInPortraitMode = mapToRectangle(it) }
(map["positionInLandscapeMode"] as? Map<*, *>)?.let {
positionInLandscapeMode = mapToRectangle(it)
}
(map["positionInPortraitMode"] as? Map<*, *>)?.let {
positionInPortraitMode = mapToRectangle(it)
}
}
}

Expand All @@ -154,12 +168,22 @@ fun mapToLiveInjectStreamConfig(map: Map<*, *>): LiveInjectStreamConfig {
(map["videoGop"] as? Number)?.let { videoGop = it.toInt() }
(map["videoFramerate"] as? Number)?.let { videoFramerate = it.toInt() }
(map["videoBitrate"] as? Number)?.let { videoBitrate = it.toInt() }
(map["audioSampleRate"] as? Number)?.let { audioSampleRate = intToLiveInjectStreamConfigAudioSampleRate(it.toInt()) }
(map["audioSampleRate"] as? Number)?.let {
audioSampleRate = intToLiveInjectStreamConfigAudioSampleRate(it.toInt())
}
(map["audioBitrate"] as? Number)?.let { audioBitrate = it.toInt() }
(map["audioChannels"] as? Number)?.let { audioChannels = it.toInt() }
}
}

fun mapToRhythmPlayerConfig(map: Map<*, *>): AgoraRhythmPlayerConfig {
return AgoraRhythmPlayerConfig().apply {
(map["beatsPerMeasure"] as? Number)?.let { beatsPerMeasure = it.toInt() }
(map["beatsPerMinute"] as? Number)?.let { beatsPerMinute = it.toInt() }
(map["publish"] as? Boolean)?.let { publish = it }
}
}

fun mapToCameraCapturerConfiguration(map: Map<*, *>): CameraCapturerConfiguration {
return CameraCapturerConfiguration(
intToCapturerOutputPreference((map["preference"] as Number).toInt()),
Expand All @@ -175,6 +199,8 @@ fun mapToChannelMediaOptions(map: Map<*, *>): ChannelMediaOptions {
return ChannelMediaOptions().apply {
(map["autoSubscribeAudio"] as? Boolean)?.let { autoSubscribeAudio = it }
(map["autoSubscribeVideo"] as? Boolean)?.let { autoSubscribeVideo = it }
(map["publishLocalAudio"] as? Boolean)?.let { publishLocalAudio = it }
(map["publishLocalVideo"] as? Boolean)?.let { publishLocalVideo = it }
}
}

Expand All @@ -186,10 +212,26 @@ fun mapToRtcEngineConfig(map: Map<*, *>): RtcEngineConfig {
}
}

fun mapToAudioRecordingConfiguration(map: Map<*, *>): AudioRecordingConfiguration {
return AudioRecordingConfiguration().apply {
(map["filePath"] as? String)?.let { filePath = it }
(map["recordingQuality"] as? Number)?.let { recordingQuality = it.toInt() }
(map["recordingPosition"] as? Number)?.let { recordingPosition = it.toInt() }
(map["recordingSampleRate"] as? Number)?.let { recordingSampleRate = it.toInt() }
}
}

fun mapToEncryptionConfig(map: Map<*, *>): EncryptionConfig {
return EncryptionConfig().apply {
(map["encryptionMode"] as? Number)?.let { encryptionMode = intToEncryptionMode(it.toInt()) }
(map["encryptionKey"] as? String)?.let { encryptionKey = it }
(map["encryptionKdfSalt"] as? List<*>)?.let { list ->
for (i in list.indices) {
(list[i] as? Number)?.let {
encryptionKdfSalt[i] = it.toByte()
}
}
}
}
}

Expand Down
17 changes: 11 additions & 6 deletions android/src/main/java/io/agora/rtc/base/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import io.agora.rtc.models.UserInfo

fun UserInfo.toMap(): Map<String, Any?> {
return hashMapOf(
"uid" to uid,
"uid" to uid.toUInt().toLong(),
"userAccount" to userAccount
)
}
Expand All @@ -22,7 +22,7 @@ fun LocalAudioStats.toMap(): Map<String, Any?> {

fun RtcStats.toMap(): Map<String, Any?> {
return hashMapOf(
"totalDuration" to totalDuration,
"duration" to totalDuration,
"txBytes" to txBytes,
"rxBytes" to rxBytes,
"txAudioBytes" to txAudioBytes,
Expand All @@ -35,7 +35,7 @@ fun RtcStats.toMap(): Map<String, Any?> {
"rxAudioKBitRate" to rxAudioKBitRate,
"txVideoKBitRate" to txVideoKBitRate,
"rxVideoKBitRate" to rxVideoKBitRate,
"users" to users,
"userCount" to users,
"lastmileDelay" to lastmileDelay,
"txPacketLossRate" to txPacketLossRate,
"rxPacketLossRate" to rxPacketLossRate,
Expand All @@ -59,7 +59,7 @@ fun Rect.toMap(): Map<String, Any?> {

fun RemoteAudioStats.toMap(): Map<String, Any?> {
return hashMapOf(
"uid" to uid,
"uid" to uid.toUInt().toLong(),
"quality" to quality,
"networkTransportDelay" to networkTransportDelay,
"jitterBufferDelay" to jitterBufferDelay,
Expand Down Expand Up @@ -99,7 +99,7 @@ fun LocalVideoStats.toMap(): Map<String, Any?> {

fun RemoteVideoStats.toMap(): Map<String, Any?> {
return hashMapOf(
"uid" to uid,
"uid" to uid.toUInt().toLong(),
"delay" to delay,
"width" to width,
"height" to height,
Expand All @@ -117,7 +117,7 @@ fun RemoteVideoStats.toMap(): Map<String, Any?> {

fun AudioVolumeInfo.toMap(): Map<String, Any?> {
return hashMapOf(
"uid" to uid,
"uid" to uid.toUInt().toLong(),
"volume" to volume,
"vad" to vad,
"channelId" to channelId
Expand Down Expand Up @@ -158,3 +158,8 @@ fun AgoraFacePositionInfo.toMap(): Map<String, Any?> {
fun Array<out AgoraFacePositionInfo>.toMapList(): List<Map<String, Any?>> {
return List(size) { this[it].toMap() }
}

@ExperimentalUnsignedTypes
internal fun Number.toNativeUInt(): Int {
return toLong().toUInt().toInt()
}
8 changes: 5 additions & 3 deletions android/src/main/java/io/agora/rtc/base/MediaObserver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ class MediaObserver(
}

override fun onMetadataReceived(buffer: ByteArray, uid: Int, timeStampMs: Long) {
emit(hashMapOf(
"data" to arrayListOf(String(buffer), uid, timeStampMs)
))
emit(
hashMapOf(
"data" to arrayListOf(String(buffer), uid.toUInt().toLong(), timeStampMs)
)
)
}
}
Loading

0 comments on commit 79ff77a

Please sign in to comment.