livekit / client-sdk-flutter

Flutter Client SDK for LiveKit
https://docs.livekit.io
Apache License 2.0
261 stars 132 forks source link

[Question] Why my screen sharing is distorted when resize? #526

Open thaidmfinnick opened 5 months ago

thaidmfinnick commented 5 months ago

Hi, I have use screen share function recently in my project, but when I share, thumbnail preview and video sharing are distorted, although Livekit Client example is totally fine. I copy same room configuration from example to my project. Below is description video:

https://github.com/livekit/client-sdk-flutter/assets/83997264/43c52d0e-98fc-41ca-a3a6-a6a8a05c36c1

I think it's not from my server side because I test with example is fine. I don't know why it's happened. Below is my configuration:

    RoomOptions(
        adaptiveStream: false,
        dynacast: false,
        defaultAudioPublishOptions: const AudioPublishOptions(
          name: 'custom_audio_track_name',
        ),
        defaultVideoPublishOptions: VideoPublishOptions(
          simulcast: false,
          videoCodec: 'VP8',
          backupVideoCodec: BackupVideoCodec(
            enabled: false,
          ),
        ),
        defaultScreenShareCaptureOptions: const ScreenShareCaptureOptions(
            useiOSBroadcastExtension: true,
            params: VideoParameters(
                dimensions: VideoDimensions(1280, 720),
                encoding: VideoEncoding(
                  maxBitrate: 3 * 1000 * 1000,
                  maxFramerate: 15,
                ))),
        defaultCameraCaptureOptions: CameraCaptureOptions(maxFrameRate: 30),
    ),
        final source = await showDialog<DesktopCapturerSource>(
          context: context,
          builder: (context) => ScreenSelectDialog(),
        );
        if (source == null) {
          setState(() => _isSharingScreen = false);
          context.read<CallProvider>().unhideViewCall();
          return;
        }
        var track = await LocalVideoTrack.createScreenShareTrack(
          ScreenShareCaptureOptions(
            sourceId: source.id,
            maxFrameRate: 15,
          ),
        );

Livekit Client: 2.1.0 Flutter SDK: Flutter 3.16.9

Thank you!

thaidmfinnick commented 4 months ago

@cloudwebrtc why did you react without replying me 😭

cloudwebrtc commented 4 months ago

hey @thaidmfinnick , Sorry for the late reply, this should be caused by libwebrtc aligning the height x width to 4 times when collecting the change window. I will check it.

thaidmfinnick commented 4 months ago

thanks for your response! I will wait.

thaidmfinnick commented 3 months ago

Hi @cloudwebrtc, any update on this issue? I have updated to Livekit v2.2.0, issue still exists on MacOS.

cloudwebrtc commented 1 month ago

Quick question, are you using an Intel or Apple silicon Mac? I remember there was a bug in early Intel computers where the capture width/height didn't align, but it seems to have been fixed if I remember correctly.

thaidmfinnick commented 1 month ago

I'm using Apple silicon Mac (m1 pro 2020). It is still an error (I have updated to livekit 2.2.4)