Code Monkey home page Code Monkey logo

Comments (6)

rom1v avatar rom1v commented on July 18, 2024

Is there a way to set it to the correct resolution?

Use a resolution multiple of 8. It always rounds down to a multiple of 8 because it is a requirement of many encoders.

from scrcpy.

TuralTo avatar TuralTo commented on July 18, 2024

But then I would still not be able to go into fullscreen since the my display's resolution is 1366x768 and it looks really bad with any other resolution. If I change the encoder would that fix it?

Thank you a lot for replying so fast!

from scrcpy.

rom1v avatar rom1v commented on July 18, 2024

Try removing all roundings (& ~7):

options.maxSize = Integer.parseInt(value) & ~7; // multiple of 8

w &= ~7; // in case it's not a multiple of 8
h &= ~7;
if (maxSize > 0) {
if (BuildConfig.DEBUG && maxSize % 8 != 0) {
throw new AssertionError("Max size must be a multiple of 8");
}
boolean portrait = h > w;
int major = portrait ? h : w;
int minor = portrait ? w : h;
if (major > maxSize) {
int minorExact = minor * maxSize / major;
// +4 to round the value to the nearest multiple of 8
minor = (minorExact + 4) & ~7;

from scrcpy.

TuralTo avatar TuralTo commented on July 18, 2024

It did work! tysm!
Why not add the changes to main? Would be too dangerous? Or maybe an option to disable the rounding?

Anyway, thank you a lot.

from scrcpy.

rom1v avatar rom1v commented on July 18, 2024

Why not add the changes to main?

I think that many encoders fail with non-multiples of 8 (at least that was the case a few years ago).

Or maybe an option to disable the rounding?

Yes, an option --size-rounding= (or with a better name?) would be useful:

  • only accepts powers of two
  • the default would be 8
  • to avoid any rounding, use --size-rounding=1

Do you want to work on it?

from scrcpy.

TuralTo avatar TuralTo commented on July 18, 2024

Sure, I will try.

You can mark this issue as closed if you want.

from 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.