Skip to content

[bug] Crush on setScreenShareEnabled (Windows) #703

Closed
@AlexIndustrial

Description

@AlexIndustrial

bug
Application crashes when running screen share on Windows

To Reproduce
Get the sources of the video:

 final sources = await desktopCapturer.getSources(
        types: [
          SourceType.Screen,
          SourceType.Window,
        ],
      );

Start screen sharing:

Future<void> publishScreen(String source) async {
    room?.localParticipant?.setScreenShareEnabled(true,
        captureScreenAudio: true,
        screenShareCaptureOptions: ScreenShareCaptureOptions(
            sourceId: source,
            captureScreenAudio: true,
            params: VideoParameters(
              dimensions: VideoDimensions(1920, 1080),
              encoding: VideoEncoding(
                maxBitrate: 5000 * 1000,
                maxFramerate: 60,
              ),
            )));
  }

The application simply closes without any messages.

Expected behavior
Starting a screen sharing (works great on Mac)

Platform information

  • Flutter version: 3.27.4
  • Plugin version: 2.3.6
  • Flutter target OS: Windows 11
  • Flutter target OS version: 10.0.26100.2605
  • Flutter console log (After connection to Livekit):
[+1665 ms] [ERROR:flutter/shell/common/shell.cc(1053)] The 'FlutterWebRTC/peerConnectionEvent7C30E971-A39E-4858-9D7D-9955FF3E12BA' channel sent a message from native to Flutter on a non-platform thread. Platform channel
messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.
[   +1 ms] See https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading for more information.
[ +142 ms] [ERROR:flutter/shell/common/shell.cc(1053)] The 'FlutterWebRTC/peerConnectionEvent3D59BD6B-8506-45D1-A271-6B6D99A86C47' channel sent a message from native to Flutter on a non-platform thread. Platform channel
messages must be sent on the platform thread. Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.
[   +1 ms] See https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading for more information.
[+1541 ms] [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: FormatException: Missing extension byte (at offset 1)
[        ] #0      _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1846:7)
[        ] #1      Utf8Decoder.convert (dart:convert/utf.dart:349:37)
[        ] #2      StandardMessageCodec.readValueOfType (package:flutter/src/services/message_codecs.dart:500:29)
[        ] #3      StandardMessageCodec.readValue (package:flutter/src/services/message_codecs.dart:475:12)
[        ] #4      StandardMessageCodec.readValueOfType (package:flutter/src/services/message_codecs.dart:527:39)
[        ] #5      StandardMessageCodec.readValue (package:flutter/src/services/message_codecs.dart:475:12)
[   +1 ms] #6      StandardMessageCodec.readValueOfType (package:flutter/src/services/message_codecs.dart:527:39)
[        ] #7      StandardMessageCodec.readValue (package:flutter/src/services/message_codecs.dart:475:12)
[        ] #8      StandardMessageCodec.readValueOfType (package:flutter/src/services/message_codecs.dart:520:23)
[        ] #9      StandardMessageCodec.readValue (package:flutter/src/services/message_codecs.dart:475:12)
[        ] #10     StandardMessageCodec.readValueOfType (package:flutter/src/services/message_codecs.dart:527:39)
[        ] #11     StandardMessageCodec.readValue (package:flutter/src/services/message_codecs.dart:475:12)
[        ] #12     StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:639:27)
[        ] #13     MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18)
[        ] <asynchronous suspension>
[        ] #14     MediaDeviceNative.getUserMedia (package:flutter_webrtc/src/native/mediadevices_impl.dart:34:24)
[        ] <asynchronous suspension>
[        ] #15     LocalTrack.createStream (package:livekit_client/src/track/local/local.dart:235:16)
[        ] <asynchronous suspension>
[   +1 ms] #16     LocalAudioTrack.create (package:livekit_client/src/track/local/audio.dart:137:20)
[        ] <asynchronous suspension>
[        ] #17     _VoiceService.publishAudio (package:desertui/core/services/voice/voice.service.dart:120:19)
[        ] <asynchronous suspension>
[   +1 ms] #18     AsyncAction.run (package:mobx/src/api/async/async_action.dart:28:14)
[        ] <asynchronous suspension>
[        ] #19     _VoiceService.connect (package:desertui/core/services/voice/voice.service.dart:71:5)
[        ] <asynchronous suspension>
[        ] #20     AsyncAction.run (package:mobx/src/api/async/async_action.dart:28:14)
[        ] <asynchronous suspension>
[        ] #21     _VoiceService.callUser (package:desertui/core/services/voice/voice.service.dart:57:5)
[        ] <asynchronous suspension>
[        ] #22     AsyncAction.run (package:mobx/src/api/async/async_action.dart:28:14)
[        ] <asynchronous suspension>
[+3102 ms]  OnMediaSourceAdded: 0
[   +1 ms] [ERROR:flutter/shell/common/shell.cc(1053)] The 'FlutterWebRTC.Event' channel sent a message from native to Flutter on a non-platform thread. Platform channel messages must be sent on the platform thread.
Failure to do so may result in data loss or crashes, and must be fixed in the plugin or application code creating that channel.
[        ] See https://docs.flutter.dev/platform-integration/platform-channels#channels-and-platform-threading for more information.
[  +24 ms]  OnMediaSourceThumbnailChanged: 0
[  +33 ms]  OnMediaSourceThumbnailChanged: 0
[  +14 ms]  OnMediaSourceAdded: 1638948
[   +1 ms]  sources: 2
[  +64 ms]  OnMediaSourceThumbnailChanged: 1638948
[  +65 ms]  OnMediaSourceThumbnailChanged: 1638948
[+3975 ms] Service protocol connection closed.
[   +1 ms] Lost connection to device.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions