mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-05-11 10:26:19 +02:00
web only decode the latest image (#9689)
1. web only decode the latest image 2. web/ios remove relay server config when import Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
parent
defb3e6c73
commit
53d11e99d7
2 changed files with 24 additions and 0 deletions
|
@ -1225,6 +1225,27 @@ class ImageModel with ChangeNotifier {
|
|||
|
||||
clearImage() => _image = null;
|
||||
|
||||
bool _webDecodingRgba = false;
|
||||
final List<Uint8List> _webRgbaList = List.empty(growable: true);
|
||||
webOnRgba(int display, Uint8List rgba) async {
|
||||
// deep copy needed, otherwise "instantiateCodec failed: TypeError: Cannot perform Construct on a detached ArrayBuffer"
|
||||
_webRgbaList.add(Uint8List.fromList(rgba));
|
||||
if (_webDecodingRgba) {
|
||||
return;
|
||||
}
|
||||
_webDecodingRgba = true;
|
||||
try {
|
||||
while (_webRgbaList.isNotEmpty) {
|
||||
final rgba2 = _webRgbaList.last;
|
||||
_webRgbaList.clear();
|
||||
await decodeAndUpdate(display, rgba2);
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('onRgba error: $e');
|
||||
}
|
||||
_webDecodingRgba = false;
|
||||
}
|
||||
|
||||
onRgba(int display, Uint8List rgba) async {
|
||||
try {
|
||||
await decodeAndUpdate(display, rgba);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue