Giter VIP home page Giter VIP logo

Comments (8)

drauggres avatar drauggres commented on July 26, 2024

Does this problem appear in the original scrcpy?
If not, please attach a screenshot (or does it happen on the device?), I have never seen anything like what you describe.

from ws-scrcpy.

wangfuyangsau avatar wangfuyangsau commented on July 26, 2024

untitled

There was no problem with the original scrcpy, and some other phones did not have this problem.

from ws-scrcpy.

drauggres avatar drauggres commented on July 26, 2024

Does it happen on all included decoders? Also what is the screen resolution of this device?

from ws-scrcpy.

wangfuyangsau avatar wangfuyangsau commented on July 26, 2024

I will try different decoders and check the resolution of the screen later. Thank you very much for your answer. I will contact you again if there is any question.

from ws-scrcpy.

wangfuyangsau avatar wangfuyangsau commented on July 26, 2024

In my tests, only Msedecoder was able to get images, and the device's resolution was 1080x2340.

from ws-scrcpy.

drauggres avatar drauggres commented on July 26, 2024

It's possible that video tag size does not match actual video size (like than you watch 16:9 video on 4:3 screen you will see the same).

Can you open developer tools while streaming and run in the console this:

var {videoWidth, videoHeight, clientWidth, clientHeight} = document.getElementsByTagName('video')[0];
console.log({videoWidth, videoHeight, clientWidth, clientHeight})

I tried with android emulator (with 1080x2340 resolution), but wasn't able to reproduce: videoWidth and videoHeight were always the same as clientWidth and clientHeight respectively.

As for only MseDecoder working, can you try #25 (comment), and post your results there?

P.S. Also what browser are you testing on?

from ws-scrcpy.

wangfuyangsau avatar wangfuyangsau commented on July 26, 2024

无标题
In the native scrcpy screen.c, I found this function and wonder if you have the same treatment in your project.

from ws-scrcpy.

drauggres avatar drauggres commented on July 26, 2024

Not the same:

  1. This project doesn't handle window resizing, everyting below happens only after the start or after Change video settings button is pressed.
  2. Client receives ScreenInfo from the server:
    const screenInfo: ScreenInfo = ScreenInfo.fromBuffer(temp);
    temp = new Buffer(new Uint8Array(e.data, offset, VideoSettings.BUFFER_LENGTH));
    and applies it to Decoder
    3.1 For MseDecoder video tag size is not limited, but only size of its parent element:
    public setScreenInfo(screenInfo: ScreenInfo): void {
    this.pause();
    this.screenInfo = screenInfo;
    const { width, height } = screenInfo.videoSize;
    this.touchableCanvas.width = width;
    this.touchableCanvas.height = height;
    if (this.parentElement) {
    this.parentElement.style.height = `${height}px`;
    this.parentElement.style.width = `${width}px`;
    }
    const size = new Size(width, height);
    this.resizeListeners.forEach((listener) => {
    listener.onVideoResize(size);
    });
    }

    3.2 For other ("canvas based") decoders, the canvas is also resized:
    public setScreenInfo(screenInfo: ScreenInfo): void {
    super.setScreenInfo(screenInfo);
    this.clearState();
    const { width, height } = screenInfo.videoSize;
    this.initCanvas(width, height);
    this.framesList = [];
    }

The actual video size is never checked, as it is expected to match the value received in ScreenInfo earlier, that is why I asked you run:

var {videoWidth, videoHeight, clientWidth, clientHeight} = document.getElementsByTagName('video')[0];
console.log({videoWidth, videoHeight, clientWidth, clientHeight})

so we could compare them.

P.S. you can post multiline code by surrounding it with triple backtick (`), or include direct permalink to github, e.g.:
https://github.com/NetrisTV/ws-scrcpy/blob/79098c69773cded80b58a4f0e7528fc4cbc9cdcd/src/decoder/CanvasCommon.ts#L145-L151

from ws-scrcpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.