Skip to content

Commit

Permalink
fix some functions' signature
Browse files Browse the repository at this point in the history
  • Loading branch information
littleGnAl committed Apr 3, 2023
1 parent 216eb04 commit 0e904e1
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 49 deletions.
4 changes: 2 additions & 2 deletions lib/src/agora_rtc_engine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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<void> numberOfCapabilities(String deviceIdUTF8);
Future<int> 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.
Expand Down
9 changes: 4 additions & 5 deletions lib/src/binding/agora_rtc_engine_event_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -365,27 +365,26 @@ class RtcEngineEventHandlerWrapper implements EventLoopEventHandler {
rtcEngineEventHandler.onLastmileQuality!(quality);
return true;

case 'onFirstLocalVideoFrameEx':
case 'onFirstLocalVideoFrame':
if (rtcEngineEventHandler.onFirstLocalVideoFrame == null) {
return true;
}
final jsonMap = jsonDecode(eventData);
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':
Expand Down
6 changes: 2 additions & 4 deletions lib/src/binding/agora_rtc_engine_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class VideoDeviceManagerImpl implements VideoDeviceManager {
}

@override
Future<void> numberOfCapabilities(String deviceIdUTF8) async {
Future<int> numberOfCapabilities(String deviceIdUTF8) async {
final apiType =
'${isOverrideClassName ? className : 'VideoDeviceManager'}_numberOfCapabilities';
final param = createParams({'deviceIdUTF8': deviceIdUTF8});
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/src/binding/event_handler_param_json.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
41 changes: 19 additions & 22 deletions lib/src/binding/event_handler_param_json.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,7 @@ void generatedTestCases() {
final onFirstLocalVideoFrameCompleter = Completer<bool>();
final theRtcEngineEventHandler = RtcEngineEventHandler(
onFirstLocalVideoFrame:
(RtcConnection connection, int width, int height, int elapsed) {
(VideoSourceType source, int width, int height, int elapsed) {
onFirstLocalVideoFrameCompleter.complete(true);
},
);
Expand All @@ -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,
Expand Down Expand Up @@ -6225,3 +6220,4 @@ void generatedTestCases() {
timeout: const Timeout(Duration(minutes: 1)),
);
}

4 changes: 1 addition & 3 deletions tool/terra/terra_config_main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0e904e1

Please sign in to comment.