Genymobile / Genymobile/scrcpy

need help in making scrcpy-server.jar controler use real device size

Open
#6,435 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
150k
Forks
13.7k
Avg merge
4d 13h
Merged PRs (30d)
2

Description

i found where the scaling is done and i modifyed it

`package com.genymobile.scrcpy.control;

import com.genymobile.scrcpy.device.Point;
import com.genymobile.scrcpy.device.Position;
import com.genymobile.scrcpy.device.Size;
import com.genymobile.scrcpy.util.AffineMatrix;

public final class PositionMapper {

private final Size videoSize;
private final AffineMatrix videoToDeviceMatrix;

public PositionMapper(Size videoSize, AffineMatrix videoToDeviceMatrix) {
this.videoSize = videoSize;
this.videoToDeviceMatrix = videoToDeviceMatrix;
}

public static PositionMapper create(Size videoSize, AffineMatrix filterTransform, Size targetSize) {
boolean convertToPixels = !videoSize.equals(targetSize) || filterTransform != null;
AffineMatrix transform = filterTransform;
if (convertToPixels) {
AffineMatrix inputTransform = AffineMatrix.ndcFromPixels(videoSize);
AffineMatrix outputTransform = AffineMatrix.ndcToPixels(targetSize);
transform = outputTransform.multiply(transform).multiply(inputTransform);
}

return new PositionMapper(videoSize, transform);
}

public Size getVideoSize() {
return videoSize;
}

public Point map(Position position) {
Size clientVideoSize = position.getScreenSize();

// if (!videoSize.equals(clientVideoSize)) {
// // The client sends a click relative to a video with wrong dimensions,
// // the device may have been rotated since the event was generated, so ignore the event
// return null;
// }

Point point = position.getPoint();
// if (videoToDeviceMatrix != null) {
// point = videoToDeviceMatrix.apply(point);
// }
return point;
}
}
`

but now i want to send the real device screen size when first conecting to the video socket insted of the one set when starting scrcpy-server, please just tell me where in the code is it sending the resolution to the desktop client, please i need some help

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the scrcpy-server video-socket connection and the code that sends the initial video dimensions to the desktop client; the issue does not name the relevant file or entry point. Compare that value with PositionMapper's videoSize and targetSize, then verify that the client receives the real device screen size on first connection without breaking coordinate mapping.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
mobile-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.