You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I passed the frame into Dart through the FFI callback function, but the rendering speed of Dart is very slow. I use the Dart technique:
ui: StatefulWidget+CustomPainter+ChangeNotifierProvider
data: decodeImageFromPixels=>ui.Image canvas.drawImage(_image, Offset.zero, Paint());
Did I choose the wrong technology? Window app
static Uint8List fillPixelsWithRGBFrame(
Pointer<Pointer> data, int width, int height) {
int frameSize = width * height * 3;
Uint8List pixels = Uint8List(width * height * 4);
for (int i = 0; i < frameSize; i += 3) {
int r = data.value[i];
int g = data.value[i + 1];
int b = data.value[i + 2];
int pixelIndex = i ~/ 3 * 4;
pixels[pixelIndex] = r;
pixels[pixelIndex + 1] = g;
pixels[pixelIndex + 2] = b;
pixels[pixelIndex + 3] = 255;
}
return pixels;
PS C:\Users\mcs\Downloads\sdk-3.4.0\samples\ffi\http> flutter -v doctorFlutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source![√] Flutter (Channel stable, 3.22.0, on Microsoft Windows [版本 10.0.19045.4412], locale zh-CN) • Flutter version 3.22.0 on channel stable at D:\mysoftware\flutterSDK\flutter_windows_3.19.6-stable\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 5dcb86f68f (8 days ago), 2024-05-09 07:39:20 -0500 • Engine revision f6344b75dc • Dart version 3.4.0 • DevTools version 2.34.3 • Pub download mirror https://pub.flutter-io.cn • Flutter download mirror https://storage.flutter-io.cn[√] Windows Version (Installed version of Windows is version 10 or higher)[X] Android toolchain - develop for Android devices X Unable to locate Android SDK. Install Android Studio from: https://developer.android.com/studio/index.html On first launch it will assist you in installing the Android SDK components. (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions). If the Android SDK has been installed to a custom location, please use `flutter config --android-sdk` to update to that location.[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe[√] Visual Studio - develop Windows apps (Visual Studio Professional 2022 17.9.7) • Visual Studio at D:\mysoftware\VisaualStudio2022 • Visual Studio Professional 2022 version 17.9.34902.65 • Windows 10 SDK version 10.0.22621.0[√] Android Studio (version 2022.3) • Android Studio at D:\mysoftware\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)[√] IntelliJ IDEA Ultimate Edition (version 2021.2) • IntelliJ at D:\mysoftware\IntelliJ IDEA 2021.2.4 • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart[√] Connected device (3 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.19045.4412] • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.202 • Edge (web) • edge • web-javascript • Microsoft Edge 124.0.2478.105[√] Network resources • All expected network resources are available.! Doctor found issues in 1 category.PS C:\Users\mcs\Downloads\sdk-3.4.0\samples\ffi\http>
The text was updated successfully, but these errors were encountered:
Steps to reproduce
I passed the frame into Dart through the FFI callback function, but the rendering speed of Dart is very slow. I use the Dart technique:
ui: StatefulWidget+CustomPainter+ChangeNotifierProvider
data: decodeImageFromPixels=>ui.Image canvas.drawImage(_image, Offset.zero, Paint());
Did I choose the wrong technology? Window app
MCSLOG_INFO("m_callBack(ctx->frame->data)..."); m_callBack(ctx->frame->data);
static void callBackFromCxx(Pointer<Pointer> data) {
_instance!.update(
fillPixelsWithRGBFrame(data, _instance!._width, _instance!._height));
}
static Uint8List fillPixelsWithRGBFrame(
Pointer<Pointer> data, int width, int height) {
int frameSize = width * height * 3;
Uint8List pixels = Uint8List(width * height * 4);
}
void update(Uint8List byte) async {
printWithTime("update...1");
Completer<ui.Image> c = Completer<ui.Image>();
ui.decodeImageFromPixels(
byte, _width, _height, ui.PixelFormat.rgba8888, (a) => c.complete(a));
ui.Image image = await c.future;
printWithTime("update...2");
_imageQueue.addLast(image);
// 一次更新两次,太慢了
notifyListeners();
printWithTime("update...3");
}
class _ImagetWidgetSate extends State {
@OverRide
Widget build(BuildContext context) {
return Consumer(builder: (context, model, child) {
printWithTime('build......: ${model._imageQueue.length}');
return CustomPaint(
painter: ImagePainter(model._imageQueue.length > 1
? model._imageQueue.removeFirst()
: model._imageQueue.first),
);
});
}
}
Code sample
Code sample
Performance profiling on master channel
Timeline Traces
Timeline Traces JSON
[Paste the Timeline Traces here]
dart_devtools_2024-05-18_10_47_18.039.json
Video demonstration
Video demonstration
[Upload media here]
What target platforms are you seeing this bug on?
Windows
OS/Browser name and version | Device information
Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.19045.4412]
Does the problem occur on emulator/simulator as well as on physical devices?
Unknown
Is the problem only reproducible with Impeller?
N/A
Logs
Logs
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: