livekit / client-sdk-flutter

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

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

Open thaidmfinnick opened 4 weeks ago

thaidmfinnick commented 4 weeks 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 3 weeks ago

@cloudwebrtc why did you react without replying me 😭

cloudwebrtc commented 3 weeks 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 3 weeks ago

thanks for your response! I will wait.