diff --git a/lib/src/agora_rtc_engine.dart b/lib/src/agora_rtc_engine.dart index 213556629..58b922c76 100644 --- a/lib/src/agora_rtc_engine.dart +++ b/lib/src/agora_rtc_engine.dart @@ -1779,7 +1779,7 @@ class RtcEngineEventHandler { /// * [height] The height (px) of the first local video frame. /// * [elapsed] Time elapsed (ms) from the local user calling joinChannel [2/2] until the SDK triggers this callback. If you call startPreview before calling joinChannel [2/2], then this parameter is the time elapsed from calling the startPreview method until the SDK triggers this callback. final void Function( - RtcConnection connection, int width, int height, int elapsed)? + VideoSourceType source, int width, int height, int elapsed)? onFirstLocalVideoFrame; /// Occurs when the first video frame is published. @@ -2403,7 +2403,7 @@ abstract class VideoDeviceManager { /// Video capture devices may support multiple video formats, and each format supports different combinations of video frame width, video frame height, and frame rate.You can call this method to get how many video formats the specified video capture device can support, and then call getCapability to get the specific video frame information in the specified video format. /// /// * [deviceIdUTF8] The ID of the video capture device. - Future numberOfCapabilities(String deviceIdUTF8); + Future numberOfCapabilities(String deviceIdUTF8); /// Gets the detailed video frame information of the video capture device in the specified video format. /// After calling numberOfCapabilities to get the number of video formats supported by the video capture device, you can call this method to get the specific video frame information supported by the specified index number. diff --git a/lib/src/binding/agora_rtc_engine_event_impl.dart b/lib/src/binding/agora_rtc_engine_event_impl.dart index 51f56532a..76a8769b5 100644 --- a/lib/src/binding/agora_rtc_engine_event_impl.dart +++ b/lib/src/binding/agora_rtc_engine_event_impl.dart @@ -365,7 +365,7 @@ class RtcEngineEventHandlerWrapper implements EventLoopEventHandler { rtcEngineEventHandler.onLastmileQuality!(quality); return true; - case 'onFirstLocalVideoFrameEx': + case 'onFirstLocalVideoFrame': if (rtcEngineEventHandler.onFirstLocalVideoFrame == null) { return true; } @@ -373,19 +373,18 @@ class RtcEngineEventHandlerWrapper implements EventLoopEventHandler { RtcEngineEventHandlerOnFirstLocalVideoFrameJson paramJson = RtcEngineEventHandlerOnFirstLocalVideoFrameJson.fromJson(jsonMap); paramJson = paramJson.fillBuffers(buffers); - RtcConnection? connection = paramJson.connection; + VideoSourceType? source = paramJson.source; int? width = paramJson.width; int? height = paramJson.height; int? elapsed = paramJson.elapsed; - if (connection == null || + if (source == null || width == null || height == null || elapsed == null) { return true; } - connection = connection.fillBuffers(buffers); rtcEngineEventHandler.onFirstLocalVideoFrame!( - connection, width, height, elapsed); + source, width, height, elapsed); return true; case 'onFirstLocalVideoFramePublishedEx': diff --git a/lib/src/binding/agora_rtc_engine_impl.dart b/lib/src/binding/agora_rtc_engine_impl.dart index 8c9be8f20..7dc847c8f 100644 --- a/lib/src/binding/agora_rtc_engine_impl.dart +++ b/lib/src/binding/agora_rtc_engine_impl.dart @@ -72,7 +72,7 @@ class VideoDeviceManagerImpl implements VideoDeviceManager { } @override - Future numberOfCapabilities(String deviceIdUTF8) async { + Future numberOfCapabilities(String deviceIdUTF8) async { final apiType = '${isOverrideClassName ? className : 'VideoDeviceManager'}_numberOfCapabilities'; final param = createParams({'deviceIdUTF8': deviceIdUTF8}); @@ -83,9 +83,7 @@ class VideoDeviceManagerImpl implements VideoDeviceManager { } final rm = callApiResult.data; final result = rm['result']; - if (result < 0) { - throw AgoraRtcException(code: result); - } + return result as int; } @override diff --git a/lib/src/binding/event_handler_param_json.dart b/lib/src/binding/event_handler_param_json.dart index dd4c54b71..74717fc46 100644 --- a/lib/src/binding/event_handler_param_json.dart +++ b/lib/src/binding/event_handler_param_json.dart @@ -573,10 +573,10 @@ extension RtcEngineEventHandlerOnLastmileQualityJsonBufferExt @JsonSerializable(explicitToJson: true) class RtcEngineEventHandlerOnFirstLocalVideoFrameJson { const RtcEngineEventHandlerOnFirstLocalVideoFrameJson( - {this.connection, this.width, this.height, this.elapsed}); + {this.source, this.width, this.height, this.elapsed}); - @JsonKey(name: 'connection') - final RtcConnection? connection; + @JsonKey(name: 'source') + final VideoSourceType? source; @JsonKey(name: 'width') final int? width; @JsonKey(name: 'height') diff --git a/lib/src/binding/event_handler_param_json.g.dart b/lib/src/binding/event_handler_param_json.g.dart index 5f3c6f2dc..80f04f050 100644 --- a/lib/src/binding/event_handler_param_json.g.dart +++ b/lib/src/binding/event_handler_param_json.g.dart @@ -452,10 +452,7 @@ RtcEngineEventHandlerOnFirstLocalVideoFrameJson _$RtcEngineEventHandlerOnFirstLocalVideoFrameJsonFromJson( Map json) => RtcEngineEventHandlerOnFirstLocalVideoFrameJson( - connection: json['connection'] == null - ? null - : RtcConnection.fromJson( - json['connection'] as Map), + source: $enumDecodeNullable(_$VideoSourceTypeEnumMap, json['source']), width: json['width'] as int?, height: json['height'] as int?, elapsed: json['elapsed'] as int?, @@ -464,12 +461,29 @@ RtcEngineEventHandlerOnFirstLocalVideoFrameJson Map _$RtcEngineEventHandlerOnFirstLocalVideoFrameJsonToJson( RtcEngineEventHandlerOnFirstLocalVideoFrameJson instance) => { - 'connection': instance.connection?.toJson(), + 'source': _$VideoSourceTypeEnumMap[instance.source], 'width': instance.width, 'height': instance.height, 'elapsed': instance.elapsed, }; +const _$VideoSourceTypeEnumMap = { + VideoSourceType.videoSourceCameraPrimary: 0, + VideoSourceType.videoSourceCamera: 0, + VideoSourceType.videoSourceCameraSecondary: 1, + VideoSourceType.videoSourceScreenPrimary: 2, + VideoSourceType.videoSourceScreen: 2, + VideoSourceType.videoSourceScreenSecondary: 3, + VideoSourceType.videoSourceCustom: 4, + VideoSourceType.videoSourceMediaPlayer: 5, + VideoSourceType.videoSourceRtcImagePng: 6, + VideoSourceType.videoSourceRtcImageJpeg: 7, + VideoSourceType.videoSourceRtcImageGif: 8, + VideoSourceType.videoSourceRemote: 9, + VideoSourceType.videoSourceTranscoded: 10, + VideoSourceType.videoSourceUnknown: 100, +}; + RtcEngineEventHandlerOnFirstLocalVideoFramePublishedJson _$RtcEngineEventHandlerOnFirstLocalVideoFramePublishedJsonFromJson( Map json) => @@ -540,23 +554,6 @@ Map _$RtcEngineEventHandlerOnVideoSizeChangedJsonToJson( 'rotation': instance.rotation, }; -const _$VideoSourceTypeEnumMap = { - VideoSourceType.videoSourceCameraPrimary: 0, - VideoSourceType.videoSourceCamera: 0, - VideoSourceType.videoSourceCameraSecondary: 1, - VideoSourceType.videoSourceScreenPrimary: 2, - VideoSourceType.videoSourceScreen: 2, - VideoSourceType.videoSourceScreenSecondary: 3, - VideoSourceType.videoSourceCustom: 4, - VideoSourceType.videoSourceMediaPlayer: 5, - VideoSourceType.videoSourceRtcImagePng: 6, - VideoSourceType.videoSourceRtcImageJpeg: 7, - VideoSourceType.videoSourceRtcImageGif: 8, - VideoSourceType.videoSourceRemote: 9, - VideoSourceType.videoSourceTranscoded: 10, - VideoSourceType.videoSourceUnknown: 100, -}; - RtcEngineEventHandlerOnLocalVideoStateChangedJson _$RtcEngineEventHandlerOnLocalVideoStateChangedJsonFromJson( Map json) => diff --git a/test_shard/fake_test_app/integration_test/generated/rtcengine_fake_test.generated.dart b/test_shard/fake_test_app/integration_test/generated/rtcengine_fake_test.generated.dart index 850ba605f..211fce3d8 100644 --- a/test_shard/fake_test_app/integration_test/generated/rtcengine_fake_test.generated.dart +++ b/test_shard/fake_test_app/integration_test/generated/rtcengine_fake_test.generated.dart @@ -8469,7 +8469,7 @@ void rtcEngineSmokeTestCases() { onDownlinkNetworkInfoUpdated: (DownlinkNetworkInfo info) {}, onLastmileQuality: (QualityType quality) {}, onFirstLocalVideoFrame: - (RtcConnection connection, int width, int height, int elapsed) {}, + (VideoSourceType source, int width, int height, int elapsed) {}, onFirstLocalVideoFramePublished: (RtcConnection connection, int elapsed) {}, onFirstRemoteVideoDecoded: (RtcConnection connection, int remoteUid, @@ -8681,7 +8681,7 @@ void rtcEngineSmokeTestCases() { onDownlinkNetworkInfoUpdated: (DownlinkNetworkInfo info) {}, onLastmileQuality: (QualityType quality) {}, onFirstLocalVideoFrame: - (RtcConnection connection, int width, int height, int elapsed) {}, + (VideoSourceType source, int width, int height, int elapsed) {}, onFirstLocalVideoFramePublished: (RtcConnection connection, int elapsed) {}, onFirstRemoteVideoDecoded: (RtcConnection connection, int remoteUid, diff --git a/test_shard/fake_test_app/integration_test/generated/rtcengine_rtcengineeventhandler_testcases.generated.dart b/test_shard/fake_test_app/integration_test/generated/rtcengine_rtcengineeventhandler_testcases.generated.dart index e87583ac4..fffa151ca 100644 --- a/test_shard/fake_test_app/integration_test/generated/rtcengine_rtcengineeventhandler_testcases.generated.dart +++ b/test_shard/fake_test_app/integration_test/generated/rtcengine_rtcengineeventhandler_testcases.generated.dart @@ -1376,7 +1376,7 @@ void generatedTestCases() { final onFirstLocalVideoFrameCompleter = Completer(); final theRtcEngineEventHandler = RtcEngineEventHandler( onFirstLocalVideoFrame: - (RtcConnection connection, int width, int height, int elapsed) { + (VideoSourceType source, int width, int height, int elapsed) { onFirstLocalVideoFrameCompleter.complete(true); }, ); @@ -1389,18 +1389,13 @@ void generatedTestCases() { await Future.delayed(const Duration(milliseconds: 500)); { - const String connectionChannelId = "hello"; - const int connectionLocalUid = 10; - const RtcConnection connection = RtcConnection( - channelId: connectionChannelId, - localUid: connectionLocalUid, - ); + const VideoSourceType source = VideoSourceType.videoSourceCameraPrimary; const int width = 10; const int height = 10; const int elapsed = 10; final eventJson = { - 'connection': connection.toJson(), + 'source': source.value(), 'width': width, 'height': height, 'elapsed': elapsed, @@ -6225,3 +6220,4 @@ void generatedTestCases() { timeout: const Timeout(Duration(minutes: 1)), ); } + diff --git a/tool/terra/terra_config_main.yaml b/tool/terra/terra_config_main.yaml index c5cb30473..e19e7c42a 100644 --- a/tool/terra/terra_config_main.yaml +++ b/tool/terra/terra_config_main.yaml @@ -3,10 +3,8 @@ include: shared:rtc_4.1.0/shared_configs.yaml language: dart legacy_renders: - - DartSyntaxRender + - DartSyntaxRenderBeforeNative420 - DartEventHandlerParamJsonRender - # - DartCallApiRender - # - DartEventHandlerRender - DartCallApiIrisMethodChannelRender - DartEventHandlerIrisMethodChannelRender - DartStructToJsonSerializableRender