Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade native sdk 6.2.6-sp.426142.b.2 #2002

Merged
19 changes: 9 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ jobs:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ci:skip') }}
strategy:
matrix:
version: ["2.10.5", "3.x"]
runs-on: macos-12
version: ["3.7.0", "3.x"]
runs-on: ubuntu-latest
timeout-minutes: 120
env:
TEST_APP_ID: ${{ secrets.MY_APP_ID }}
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ci:skip') }}
strategy:
matrix:
version: ["2.10.5", "3.x"]
version: ["3.7.0", "3.16"]
runs-on: macos-12
timeout-minutes: 120
env:
Expand All @@ -136,7 +136,7 @@ jobs:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ci:skip') }}
strategy:
matrix:
version: ["2.10.5", "3.x"]
version: ["3.7.0", "3.x"]
runs-on: macos-12
timeout-minutes: 120
env:
Expand All @@ -155,8 +155,7 @@ jobs:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ci:skip') }}
strategy:
matrix:
# Pin Flutter SDK version to 3.19, since there's issue with 3.22.x, see https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/actions/runs/9186647960/job/25262717666
version: ["2.10.5", "3.19"]
version: ["3.7.0", "3.x"]
runs-on: windows-2019
timeout-minutes: 120
env:
Expand Down Expand Up @@ -201,7 +200,7 @@ jobs:
needs: flutter_codestyle_check
strategy:
matrix:
version: ["2.10.5", "3.x"]
version: ["3.7.0", "3.x"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -221,7 +220,7 @@ jobs:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ci:skip') }}
strategy:
matrix:
version: ["2.10.5", "3.x"]
version: ["3.7.0", "3.x"]
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
Expand All @@ -242,7 +241,7 @@ jobs:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ci:skip') }}
strategy:
matrix:
version: ["2.10.5", "3.x"]
version: ["3.7.0", "3.x"]
runs-on: macos-12
timeout-minutes: 120
steps:
Expand Down Expand Up @@ -287,7 +286,7 @@ jobs:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ci:skip') }}
strategy:
matrix:
version: ["2.10.5", "3.x"]
version: ["3.7.0", "3.x"]
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/cpp/iris_rtc_rendering_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ class NativeTextureRenderer final
}
}

~NativeTextureRenderer() final { Dispose(); }
~NativeTextureRenderer() final {}

void OnVideoFrameReceived(const void *videoFrame,
const IrisRtcVideoFrameConfig &config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ void releaseRef() {
class PlatformRenderPool {

private final Map<Integer, SimpleRef> renders = new HashMap<>();

SimpleRef createView(int platformViewId,
Context context,
AgoraPlatformViewFactory.PlatformViewProvider viewProvider) {
Expand Down Expand Up @@ -182,10 +183,8 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result
case "createTextureRender": {
final Map<?, ?> args = (Map<?, ?>) call.arguments;

@SuppressWarnings("ConstantConditions")
final long irisRtcRenderingHandle = getLong(args.get("irisRtcRenderingHandle"));
@SuppressWarnings("ConstantConditions")
final long uid = getLong(args.get("uid"));
@SuppressWarnings("ConstantConditions") final long irisRtcRenderingHandle = getLong(args.get("irisRtcRenderingHandle"));
@SuppressWarnings("ConstantConditions") final long uid = getLong(args.get("uid"));
final String channelId = (String) args.get("channelId");
final int videoSourceType = (int) args.get("videoSourceType");
final int videoViewSetupMode = (int) args.get("videoViewSetupMode");
Expand All @@ -205,13 +204,25 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result
result.success(success);
break;
}
case "dispose": {
disposeAllRenderers();
result.success(true);
break;
}
case "updateTextureRenderData":
default:
result.notImplemented();
break;
}
}

private void disposeAllRenderers() {
for (final TextureRenderer textureRenderer : textureRendererMap.values()) {
textureRenderer.dispose();
}
textureRendererMap.clear();
}

/**
* Flutter may convert a long to int type in java, we force parse a long value via this function
*/
Expand Down
62 changes: 54 additions & 8 deletions example/lib/examples/advanced/screen_sharing/screen_sharing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class ScreenSharing extends StatefulWidget {
class _State extends State<ScreenSharing> with KeepRemoteVideoViewsMixin {
late final RtcEngineEx _engine;
bool _isReadyPreview = false;
bool _isStartedPreview = false;
String channelId = config.channelId;
bool isJoined = false;
late TextEditingController _controller;
Expand Down Expand Up @@ -99,8 +100,9 @@ class _State extends State<ScreenSharing> with KeepRemoteVideoViewsMixin {
_engine.registerEventHandler(_rtcEngineEventHandler);

await _engine.enableVideo();
await _engine.startPreview();
await _engine.setClientRole(role: ClientRoleType.clientRoleBroadcaster);
await _engine
.setScreenCaptureScenario(ScreenScenarioType.screenScenarioGaming);

setState(() {
_isReadyPreview = true;
Expand Down Expand Up @@ -168,7 +170,11 @@ class _State extends State<ScreenSharing> with KeepRemoteVideoViewsMixin {
Widget build(BuildContext context) {
return ExampleActionsWidget(
displayContentBuilder: (context, isLayoutHorizontal) {
if (!_isReadyPreview) return Container();
if (!_isStartedPreview) {
return const Center(
child: Text('Press the "Start Preview" button to preview'),
);
}
final children = <Widget>[
Expanded(
flex: 1,
Expand All @@ -194,6 +200,7 @@ class _State extends State<ScreenSharing> with KeepRemoteVideoViewsMixin {
canvas: const VideoCanvas(
uid: 0,
sourceType: VideoSourceType.videoSourceScreen,
renderMode: RenderModeType.renderModeFit,
),
))
: Container(
Expand Down Expand Up @@ -274,6 +281,35 @@ class _State extends State<ScreenSharing> with KeepRemoteVideoViewsMixin {
const SizedBox(
height: 20,
),
Row(
children: [
Expanded(
flex: 1,
child: ElevatedButton(
onPressed: () {
if (_isStartedPreview) {
_engine.stopPreview();
_engine.stopPreview(
sourceType: VideoSourceType.videoSourceScreen);
} else {
_engine.startPreview();
_engine.startPreview(
sourceType: VideoSourceType.videoSourceScreen);
}

setState(() {
_isStartedPreview = !_isStartedPreview;
});
},
child:
Text('${_isStartedPreview ? 'Stop' : 'Start'} Preview'),
),
)
],
),
const SizedBox(
height: 20,
),
Row(
children: [
Expanded(
Expand Down Expand Up @@ -383,7 +419,6 @@ class _ScreenShareWebState extends State<ScreenShareWeb>

await rtcEngine.startScreenCapture(
const ScreenCaptureParameters2(captureAudio: true, captureVideo: true));
await rtcEngine.startPreview(sourceType: VideoSourceType.videoSourceScreen);
onStartScreenShared();
}

Expand Down Expand Up @@ -456,7 +491,6 @@ class _ScreenShareMobileState extends State<ScreenShareMobile>

await rtcEngine.startScreenCapture(
const ScreenCaptureParameters2(captureAudio: true, captureVideo: true));
await rtcEngine.startPreview(sourceType: VideoSourceType.videoSourceScreen);
_showRPSystemBroadcastPickerViewIfNeed();
onStartScreenShared();
}
Expand Down Expand Up @@ -502,6 +536,8 @@ class _ScreenShareDesktopState extends State<ScreenShareDesktop>
List<ScreenCaptureSourceInfo> _screenCaptureSourceInfos = [];
late ScreenCaptureSourceInfo _selectedScreenCaptureSourceInfo;

late final TextEditingController _screenShareFrameRateController;

@override
bool get isScreenShared => widget.isScreenShared;

Expand Down Expand Up @@ -586,6 +622,8 @@ class _ScreenShareDesktopState extends State<ScreenShareDesktop>
void initState() {
super.initState();

_screenShareFrameRateController = TextEditingController(text: '30');

_initScreenCaptureSourceInfos();
}

Expand All @@ -596,6 +634,14 @@ class _ScreenShareDesktopState extends State<ScreenShareDesktop>
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextField(
controller: _screenShareFrameRateController,
decoration:
const InputDecoration(hintText: 'Screen Sharing frame rate'),
),
const SizedBox(
height: 20,
),
_createDropdownButton(),
if (_screenCaptureSourceInfos.isNotEmpty)
Row(
Expand Down Expand Up @@ -626,18 +672,18 @@ class _ScreenShareDesktopState extends State<ScreenShareDesktop>
await rtcEngine.startScreenCaptureByDisplayId(
displayId: sourceId!,
regionRect: const Rectangle(x: 0, y: 0, width: 0, height: 0),
captureParams: const ScreenCaptureParameters(
captureParams: ScreenCaptureParameters(
captureMouseCursor: true,
frameRate: 30,
frameRate: int.parse(_screenShareFrameRateController.text),
));
} else if (_selectedScreenCaptureSourceInfo.type ==
ScreenCaptureSourceType.screencapturesourcetypeWindow) {
await rtcEngine.startScreenCaptureByWindowId(
windowId: sourceId!,
regionRect: const Rectangle(x: 0, y: 0, width: 0, height: 0),
captureParams: const ScreenCaptureParameters(
captureParams: ScreenCaptureParameters(
captureMouseCursor: true,
frameRate: 30,
frameRate: int.parse(_screenShareFrameRateController.text),
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Demonstrates how to use the agora_rtc_engine plugin.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

environment:
sdk: ">=2.16.1 <3.0.0"
sdk: ">=2.19.0 <4.0.0"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
Expand Down
7 changes: 6 additions & 1 deletion example/windows/flutter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake)
# https://github.com/flutter/flutter/issues/57146.
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")

# Set fallback configurations for older versions of the flutter tool.
if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
set(FLUTTER_TARGET_PLATFORM "windows-x64")
endif()

# === Flutter Library ===
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")

Expand Down Expand Up @@ -92,7 +97,7 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
windows-x64 $<CONFIG>
${FLUTTER_TARGET_PLATFORM} $<CONFIG>
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
Expand Down
10 changes: 5 additions & 5 deletions example/windows/runner/Runner.rc
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
// Version
//

#ifdef FLUTTER_BUILD_NUMBER
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
#else
#define VERSION_AS_NUMBER 1,0,0
#define VERSION_AS_NUMBER 1,0,0,0
#endif

#ifdef FLUTTER_BUILD_NAME
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
#if defined(FLUTTER_VERSION)
#define VERSION_AS_STRING FLUTTER_VERSION
#else
#define VERSION_AS_STRING "1.0.0"
#endif
Expand Down
Loading
Loading