repo
stringlengths
5
53
pr_number
int32
1
321k
task_type
stringclasses
2 values
issue_text
stringlengths
0
81.2k
pr_title
stringlengths
1
319
pr_body
stringlengths
0
105k
base_sha
stringlengths
40
40
head_sha
stringlengths
40
40
gold_diff
stringlengths
0
202M
changed_files
listlengths
0
100
review_threads
listlengths
0
100
test_patch
stringlengths
0
23.4M
merged
bool
1 class
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
```suggestion int virtualDisplayId = vd.getDisplay().getDisplayId(); ``` And remove its previous declaration L201.
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java index e0ec2141fb..c1038c9302 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java +++ b/server/src/main/java/com/genymobile/scrcp...
[ "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java" ]
[ { "comment": "```suggestion\n int virtualDisplayId = vd.getDisplay().getDisplayId();\n```\nAnd remove its previous declaration L201.", "path": "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java", "hunk": "@@ -192,16 +221,28 @@ public void startNew(Surface surface) {\n ...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
This triggers a warning for me because the setter is synchronized, yet you access `virtualDisplay` without synchronization at some places. Could you elaborate a bit more why and when you need synchronized access to `virtualDisplay`, or rather, why you don't?
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java index e0ec2141fb..c1038c9302 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java +++ b/server/src/main/java/com/genymobile/scrcp...
[ "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java" ]
[ { "comment": "This triggers a warning for me because the setter is synchronized, yet you access `virtualDisplay` without synchronization at some places. Could you elaborate a bit more why and when you need synchronized access to `virtualDisplay`, or rather, why you don't?", "path": "server/src/main/java/com...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
Notice that `triggerResize()` is already synchronized and is the only caller of the getter. However, I'm wondering if `triggerResize()` really needs to be synchronized? As far as I can tell it's only called from the same thread in `DisplayResizeDebouncer.debounce()` and doesn't seem to use other shared data that would ...
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java index e0ec2141fb..c1038c9302 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java +++ b/server/src/main/java/com/genymobile/scrcp...
[ "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java" ]
[ { "comment": "Notice that `triggerResize()` is already synchronized and is the only caller of the getter. However, I'm wondering if `triggerResize()` really needs to be synchronized? As far as I can tell it's only called from the same thread in `DisplayResizeDebouncer.debounce()` and doesn't seem to use other s...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
Just asking: Don't size-related variables (e.g. `displaySize`, `videoSize`, `positionMapper`) require to be updated when the virtual display is resized?
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java index e0ec2141fb..c1038c9302 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java +++ b/server/src/main/java/com/genymobile/scrcp...
[ "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java" ]
[ { "comment": "Just asking: Don't size-related variables (e.g. `displaySize`, `videoSize`, `positionMapper`) require to be updated when the virtual display is resized?", "path": "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java", "hunk": "", "resolving_sha": "1db8da559fd5b412b0...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
I understand that daemon threads don't prevent the JVM from shutting down. However, don't you think it would be cleaner to terminate the thread properly? It doesn't seem too difficult to do, e.g. from `NewDisplayCapture.reset()`. Or is there a special reason for it to be a daemon thread?
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/display/DisplayResizeDebouncer.java b/server/src/main/java/com/genymobile/scrcpy/display/DisplayResizeDebouncer.java new file mode 100644 index 0000000000..0b961c6947 --- /dev/null +++ b/server/src/main/java/com/genymobile/scrcpy/display/DisplayResizeDebouncer.jav...
[ "server/src/main/java/com/genymobile/scrcpy/display/DisplayResizeDebouncer.java" ]
[ { "comment": "I understand that daemon threads don't prevent the JVM from shutting down. However, don't you think it would be cleaner to terminate the thread properly? It doesn't seem too difficult to do, e.g. from `NewDisplayCapture.reset()`. Or is there a special reason for it to be a daemon thread?", "pa...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
```suggestion && last_req + SC_TICK_FROM_MS(500) >= sc_tick_now()) { ```
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
[ "app/src/screen.c" ]
[ { "comment": "```suggestion\n && last_req + SC_TICK_FROM_MS(500) >= sc_tick_now()) {\n```", "path": "app/src/screen.c", "hunk": "@@ -311,7 +318,20 @@ sc_screen_on_resize(struct sc_screen *screen, const SDL_WindowEvent *event) {\n assert(!(event->data2 & ~0xFFFF));\n ...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
```suggestion ```bash ```
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/doc/virtual_display.md b/doc/virtual_display.md index 9f962127fd..4dec3e4607 100644 --- a/doc/virtual_display.md +++ b/doc/virtual_display.md @@ -13,6 +13,43 @@ scrcpy --new-display=/240 # use the main display size and 240 dpi The new virtual display is destroyed on exit. + +## Flex display + +To c...
[ "doc/virtual_display.md" ]
[ { "comment": "```suggestion\n```bash\n```", "path": "doc/virtual_display.md", "hunk": "@@ -13,6 +13,43 @@ scrcpy --new-display=/240 # use the main display size and 240 dpi\n \n The new virtual display is destroyed on exit.\n \n+\n+## Flex display\n+\n+To continuously resize the virtual display to mat...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
Now for flex display the call to `displaySize.align()` is redundant since you already called `displaySize.constrain()`.
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java index e0ec2141fb..c1038c9302 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java +++ b/server/src/main/java/com/genymobile/scrcp...
[ "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java" ]
[ { "comment": "Now for flex display the call to `displaySize.align()` is redundant since you already called `displaySize.constrain()`.", "path": "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java", "hunk": "@@ -103,29 +130,35 @@ protected void init() {\n \n @Override\n publi...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
```suggestion if (maxWidth > maxSize) { maxWidth = maxSize; } if (maxHeight > maxSize) { maxHeight = maxSize; } ``` I must admit I usually find it easier to read when the condition is reversed, i.e.: ```java if (val > max) { ...
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/model/Size.java b/server/src/main/java/com/genymobile/scrcpy/model/Size.java index 385597a8a2..63648a9e8f 100644 --- a/server/src/main/java/com/genymobile/scrcpy/model/Size.java +++ b/server/src/main/java/com/genymobile/scrcpy/model/Size.java @@ -32,6 +32,10 @@ pu...
[ "server/src/main/java/com/genymobile/scrcpy/model/Size.java" ]
[ { "comment": "```suggestion\r\n if (maxWidth > maxSize) {\r\n maxWidth = maxSize;\r\n }\r\n if (maxHeight > maxSize) {\r\n maxHeight = maxSize;\r\n }\r\n```\r\nI must admit I usually find it easier to read when the condition is reversed, ...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
Should you add a log (similar to "Resized to optimal size") even when you return early in these two cases?
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
[ "app/src/screen.c" ]
[ { "comment": "Should you add a log (similar to \"Resized to optimal size\") even when you return early in these two cases?", "path": "app/src/screen.c", "hunk": "@@ -872,6 +997,19 @@ sc_screen_resize_to_fit(struct sc_screen *screen) {\n return;\n }\n \n+ if (screen->render_fit == SC_RENDE...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
```suggestion set_aspect_ratio(screen, content_size); ```
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
[ "app/src/screen.c" ]
[ { "comment": "```suggestion\n set_aspect_ratio(screen, content_size);\n```", "path": "app/src/screen.c", "hunk": "@@ -872,6 +997,22 @@ sc_screen_resize_to_fit(struct sc_screen *screen) {\n return;\n }\n \n+ if (screen->render_fit == SC_RENDER_FIT_STRETCHED) {\n+ // nothing t...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
```suggestion displaySize = displaySize.constrain(constraints, false); ```
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java index e0ec2141fb..c1038c9302 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java +++ b/server/src/main/java/com/genymobile/scrcp...
[ "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java" ]
[ { "comment": "```suggestion\n displaySize = displaySize.constrain(constraints, false);\n```", "path": "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java", "hunk": "@@ -103,29 +130,43 @@ protected void init() {\n \n @Override\n public void prepare() {\n+ ...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
```suggestion ```
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java index e0ec2141fb..c1038c9302 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java +++ b/server/src/main/java/com/genymobile/scrcp...
[ "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java" ]
[ { "comment": "```suggestion\n```", "path": "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java", "hunk": "@@ -103,29 +130,43 @@ protected void init() {\n \n @Override\n public void prepare() {\n+ VideoConstraints constraints = getVideoConstraints();\n+\n int d...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
`--max-size` can be useful with `--flex-display`, for instance: - If you know that you can't stream with a too big display size because you would have too much delay or performance issues (but you still want to keep high resolution etc. for smaller sizes). - If like with my emulator the limits provided by the encode...
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/cli.c b/app/src/cli.c index 2cb0d3e23d..dbe264fcba 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -107,6 +107,7 @@ enum { OPT_NO_WINDOW_ASPECT_RATIO_LOCK, OPT_KEEP_ACTIVE, OPT_BACKGROUND_COLOR, + OPT_RENDER_FIT, }; struct sc_option { @@ -501,9 +502,12 @@ static const struct...
[ "app/src/cli.c" ]
[ { "comment": "`--max-size` can be useful with `--flex-display`, for instance:\r\n- If you know that you can't stream with a too big display size because you would have too much delay or performance issues (but you still want to keep high resolution etc. for smaller sizes).\r\n- If like with my emulator the lim...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
`--crop=w:h:x:y` could also be used with `--flex-display` with small modifications, but I admit it's a bit far-fetched: - By keeping the current syntax, we could say that `x` & `y` are fixed offsets while `w` & `h` are set for the initial dislay size, then they are automatically recomputed when the flex display is resi...
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/cli.c b/app/src/cli.c index 2cb0d3e23d..dbe264fcba 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -107,6 +107,7 @@ enum { OPT_NO_WINDOW_ASPECT_RATIO_LOCK, OPT_KEEP_ACTIVE, OPT_BACKGROUND_COLOR, + OPT_RENDER_FIT, }; struct sc_option { @@ -501,9 +502,12 @@ static const struct...
[ "app/src/cli.c" ]
[ { "comment": "`--crop=w:h:x:y` could also be used with `--flex-display` with small modifications, but I admit it's a bit far-fetched:\n- By keeping the current syntax, we could say that `x` & `y` are fixed offsets while `w` & `h` are set for the initial dislay size, then they are automatically recomputed when t...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
```suggestion Size outputSize = filter.getOutputSize(); Size filteredSize = outputSize.constrain(constraints); ``` - Preserve aspect ratio for non-flex display. - `outputSize` can be local (moved from L177).
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java index e0ec2141fb..c1038c9302 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java +++ b/server/src/main/java/com/genymobile/scrcp...
[ "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java" ]
[ { "comment": "```suggestion\n Size outputSize = filter.getOutputSize();\n Size filteredSize = outputSize.constrain(constraints);\n```\n- Preserve aspect ratio for non-flex display.\n- `outputSize` can be local (moved from L177).", "path": "server/src/main/java/com/genymobile/scrcpy/vid...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
Notice that `ok` could be declared a few lines below (not needed at this point), but again I'm nitpicking.
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
[ "app/src/screen.c" ]
[ { "comment": "Notice that `ok` could be declared a few lines below (not needed at this point), but again I'm nitpicking.", "path": "app/src/screen.c", "hunk": "@@ -245,42 +244,55 @@ sc_screen_render(struct sc_screen *screen, bool update_content_rect) {\n SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
What happens if the colored square is larger than the window size (or offset outside it)? Would it fail? Should you downscale it with the window in this case?
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
[ "app/src/screen.c" ]
[ { "comment": "What happens if the colored square is larger than the window size (or offset outside it)? Would it fail? Should you downscale it with the window in this case?", "path": "app/src/screen.c", "hunk": "@@ -221,42 +244,55 @@ sc_screen_render(struct sc_screen *screen, bool update_content_rect) {...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
`scale` (and `ok`) can be declared later now that you removed the dark square.
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
[ "app/src/screen.c" ]
[ { "comment": "`scale` (and `ok`) can be declared later now that you removed the dark square.", "path": "app/src/screen.c", "hunk": "@@ -218,45 +243,48 @@ sc_screen_render(struct sc_screen *screen, bool update_content_rect) {\n }\n \n SDL_Renderer *renderer = screen->renderer;\n- SDL_SetRender...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
Push to the `tracker` before rotating the `size`: ```suggestion tracker.pushClientRequest(new DisplayProperties(size, displayRotation)); if (captureOrientation.isSwap() ^ (displayRotation % 2) != 0) { size = size.rotate(); } ```
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java index e0ec2141fb..c1038c9302 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java +++ b/server/src/main/java/com/genymobile/scrcp...
[ "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java" ]
[ { "comment": "Push to the `tracker` before rotating the `size`:\r\n```suggestion\r\n tracker.pushClientRequest(new DisplayProperties(size, displayRotation));\r\n if (captureOrientation.isSwap() ^ (displayRotation % 2) != 0) {\r\n size = size.rotate();\r\n }\r\n```...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
I'm just noticing a tiny discrepancy in the sense that: - if icon, you center with offsets in `float`; - if unscaled, you center with offsets in `int32_t`. I was expecting either only floats or only ints, but it doesn't really matter in practice.
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
[ "app/src/screen.c" ]
[ { "comment": "I'm just noticing a tiny discrepancy in the sense that:\n\n- if icon, you center with offsets in `float`;\n- if unscaled, you center with offsets in `int32_t`.\n\nI was expecting either only floats or only ints, but it doesn't really matter in practice.", "path": "app/src/screen.c", "hunk"...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
This case is missing `sc_sdl_set_window_position()` to keep the content at a fixed position, now that the content is centered in the window instead of being placed at the top-left corner. Otherwise this would be equivalent to `sc_screen_resize_to_pixel_perfect()`.
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
[ "app/src/screen.c" ]
[ { "comment": "This case is missing `sc_sdl_set_window_position()` to keep the content at a fixed position, now that the content is centered in the window instead of being placed at the top-left corner. Otherwise this would be equivalent to `sc_screen_resize_to_pixel_perfect()`.", "path": "app/src/screen.c",...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
`window_size` could be moved inside the scope of `if (!screen->flex_display)` to avoid a useless SDL call.
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
[ "app/src/screen.c" ]
[ { "comment": "`window_size` could be moved inside the scope of `if (!screen->flex_display)` to avoid a useless SDL call.", "path": "app/src/screen.c", "hunk": "@@ -696,11 +828,13 @@ resize_for_content(struct sc_screen *screen, struct sc_size old_content_size,\n assert(screen->video);\n \n struct...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
```suggestion } ``` Superfluous semicolon.
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
[ "app/src/screen.c" ]
[ { "comment": "```suggestion\n }\n```\nSuperfluous semicolon.", "path": "app/src/screen.c", "hunk": "@@ -696,11 +828,13 @@ resize_for_content(struct sc_screen *screen, struct sc_size old_content_size,\n assert(screen->video);\n \n struct sc_size window_size = sc_sdl_get_window_size(screen->win...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
```suggestion virtualDisplay.resize(vdSize.getWidth(), vdSize.getHeight(), displayInfo.getDpi()); ``` The problem is that `dpi` is not a final field, in particular it is retrieved again in `prepare()`, thus `triggerResize()` might possibly not see the updated value in theory. Since this method already fetch...
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java index e0ec2141fb..c1038c9302 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java +++ b/server/src/main/java/com/genymobile/scrcp...
[ "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java" ]
[ { "comment": "```suggestion\n virtualDisplay.resize(vdSize.getWidth(), vdSize.getHeight(), displayInfo.getDpi());\n```\nThe problem is that `dpi` is not a final field, in particular it is retrieved again in `prepare()`, thus `triggerResize()` might possibly not see the updated value in theory. Since ...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
Only a matter of personal taste, I would prefer this order: - `getVideoConstraints()` - `setVideoConstraints()` - `setCurrentVirtualDisplay()` because - `videoConstraints` is declared before `virtualDisplay` - `requestResize()` calls `getVideoConstraints()` so they would be next to each other - `triggerResize()` uses ...
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java index e0ec2141fb..c1038c9302 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java +++ b/server/src/main/java/com/genymobile/scrcp...
[ "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java" ]
[ { "comment": "Only a matter of personal taste, I would prefer this order:\n- `getVideoConstraints()`\n- `setVideoConstraints()`\n- `setCurrentVirtualDisplay()`\n\nbecause\n- `videoConstraints` is declared before `virtualDisplay`\n- `requestResize()` calls `getVideoConstraints()` so they would be next to each ot...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
```suggestion // 10000000 00000000 00000000 0000000C ``` In the media packet header, packet flags each have a distinct letter as identifier (instead of whatever bit value `.`), thus maybe the session packet header should use letters to identify flags too (and this would be also in preparation for future flags). `C`...
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/demuxer.c b/app/src/demuxer.c index 634b010fc9..f0709424d6 100644 --- a/app/src/demuxer.c +++ b/app/src/demuxer.c @@ -76,10 +76,10 @@ sc_demuxer_recv_header(struct sc_demuxer *demuxer, // which only contains a 12-byte header: // // byte 0 byte 1 byte 2 byte 3 - // 10000000 ...
[ "app/src/demuxer.c" ]
[ { "comment": "```suggestion\n // 10000000 00000000 00000000 0000000C\n```\nIn the media packet header, packet flags each have a distinct letter as identifier (instead of whatever bit value `.`), thus maybe the session packet header should use letters to identify flags too (and this would be also in preparati...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
```suggestion // [. . . . . . . .|. . . .]. . . . . . . . . . . . . . . ... // <-------------> <-----> <-----------------------------... // PTS packet raw packet // size // <---------------------> // frame header ``` The frame header part is present in the doc, thus it w...
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/demuxer.c b/app/src/demuxer.c index 634b010fc9..f0709424d6 100644 --- a/app/src/demuxer.c +++ b/app/src/demuxer.c @@ -76,10 +76,10 @@ sc_demuxer_recv_header(struct sc_demuxer *demuxer, // which only contains a 12-byte header: // // byte 0 byte 1 byte 2 byte 3 - // 10000000 ...
[ "app/src/demuxer.c" ]
[ { "comment": "```suggestion\n// [. . . . . . . .|. . . .]. . . . . . . . . . . . . . . ...\n// <-------------> <-----> <-----------------------------...\n// PTS packet raw packet\n// size\n// <--------------------->\n// frame header\n```\nThe frame header part is...
true
Genymobile/scrcpy
6,772
comment_to_fix
Add flex display support (resizable virtual display)
```suggestion ``` Superfluous blank line.
32d2f06f84ef7e423103f7653979554d3e85d44b
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/doc/virtual_display.md b/doc/virtual_display.md index 9f962127fd..4dec3e4607 100644 --- a/doc/virtual_display.md +++ b/doc/virtual_display.md @@ -13,6 +13,43 @@ scrcpy --new-display=/240 # use the main display size and 240 dpi The new virtual display is destroyed on exit. + +## Flex display + +To c...
[ "doc/virtual_display.md" ]
[ { "comment": "```suggestion\n```\nSuperfluous blank line.", "path": "doc/virtual_display.md", "hunk": "@@ -13,6 +13,43 @@ scrcpy --new-display=/240 # use the main display size and 240 dpi\n \n The new virtual display is destroyed on exit.\n \n+\n+## Flex display\n+\n+To continuously resize the virtua...
true
Genymobile/scrcpy
6,822
issue_to_patch
Restore retry-on-error mechanism
First, restore retry on spurious error. MediaCodec may fail spuriously, typically when stopping an encoding and starting a new one immediately (for example on device rotation). This was initially fixed by 07806ba9159b1f4dbd2ede77b110e254af1fd7f6 (#3693), but the fix was removed by 4f97e2e30b9b02ff43d64e94...
3fcb0108230686a52fc1da2c53026c181f3aa8df
5830dedbe4d71ba06d725f3013ce7d34cea6a5a8
diff --git a/app/data/bash-completion/scrcpy b/app/data/bash-completion/scrcpy index f55db26f10..80551d7765 100644 --- a/app/data/bash-completion/scrcpy +++ b/app/data/bash-completion/scrcpy @@ -58,6 +58,7 @@ _scrcpy() { --no-audio-playback --no-cleanup --no-clipboard-autosync + --no-d...
[ "app/data/bash-completion/scrcpy", "app/data/zsh-completion/_scrcpy", "app/scrcpy.1", "app/src/cli.c", "app/src/options.c", "app/src/options.h", "app/src/scrcpy.c", "app/src/server.c", "app/src/server.h", "doc/video.md", "server/src/main/java/com/genymobile/scrcpy/Options.java", "server/src/ma...
[ { "comment": "It would be nice if this was moved right below `getSize()` like previously.", "path": "server/src/main/java/com/genymobile/scrcpy/video/ScreenCapture.java", "hunk": "@@ -209,4 +209,10 @@ private static void setDisplaySurface(IBinder display, Surface surface, Rect dev\n SurfaceC...
true
Genymobile/scrcpy
6,822
comment_to_fix
Restore retry-on-error mechanism
It would be nice if this was moved right below `getSize()` like previously.
3fcb0108230686a52fc1da2c53026c181f3aa8df
5830dedbe4d71ba06d725f3013ce7d34cea6a5a8
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/ScreenCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/ScreenCapture.java index 68bddab360..2278beeca3 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/ScreenCapture.java +++ b/server/src/main/java/com/genymobile/scrcpy/video/Scre...
[ "server/src/main/java/com/genymobile/scrcpy/video/ScreenCapture.java" ]
[ { "comment": "It would be nice if this was moved right below `getSize()` like previously.", "path": "server/src/main/java/com/genymobile/scrcpy/video/ScreenCapture.java", "hunk": "@@ -209,4 +209,10 @@ private static void setDisplaySurface(IBinder display, Surface surface, Rect dev\n SurfaceC...
true
Genymobile/scrcpy
6,822
comment_to_fix
Restore retry-on-error mechanism
```suggestion * @return the new video constraints ```
3fcb0108230686a52fc1da2c53026c181f3aa8df
5830dedbe4d71ba06d725f3013ce7d34cea6a5a8
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/VideoConstraints.java b/server/src/main/java/com/genymobile/scrcpy/video/VideoConstraints.java index eb3b8887ea..39b28682cf 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/VideoConstraints.java +++ b/server/src/main/java/com/genymobile/scrcpy/v...
[ "server/src/main/java/com/genymobile/scrcpy/video/VideoConstraints.java" ]
[ { "comment": "```suggestion\n * @return the new video constraints\n```", "path": "server/src/main/java/com/genymobile/scrcpy/video/VideoConstraints.java", "hunk": "@@ -73,4 +73,14 @@ public Size getMaxCodecPortraitSize() {\n public int getMinCodecSize() {\n return minCodecSize;\n }\n...
true
Genymobile/scrcpy
6,822
comment_to_fix
Restore retry-on-error mechanism
I'm not sure this is always true but as usual I may be mistaken. For instance, if the user resizes the window of a flex display to a new valid size, this starts a new encoding session with the `CLIENT_RESIZED` flag as reset reason. Then if the user manually resets the video capture (with <kbd>MOD</kbd>+<kbd>Shift</kbd>...
3fcb0108230686a52fc1da2c53026c181f3aa8df
5830dedbe4d71ba06d725f3013ce7d34cea6a5a8
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java b/server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java index be022fc97b..1ccb775abc 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java +++ b/server/src/main/java/com/genymobile/scrcpy/video/S...
[ "server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java" ]
[ { "comment": "I'm not sure this is always true but as usual I may be mistaken. For instance, if the user resizes the window of a flex display to a new valid size, this starts a new encoding session with the `CLIENT_RESIZED` flag as reset reason. Then if the user manually resets the video capture (with <kbd>MOD<...
true
Genymobile/scrcpy
6,822
comment_to_fix
Restore retry-on-error mechanism
So the retry-on-error stuff will apply if the user resizes a flex dispay to a too big size? That's great as it avoids the explicit `--max-size` workaround in case of incorrect video encoder capabilities.
3fcb0108230686a52fc1da2c53026c181f3aa8df
5830dedbe4d71ba06d725f3013ce7d34cea6a5a8
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java b/server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java index be022fc97b..1ccb775abc 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java +++ b/server/src/main/java/com/genymobile/scrcpy/video/S...
[ "server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java" ]
[ { "comment": "So the retry-on-error stuff will apply if the user resizes a flex dispay to a too big size? That's great as it avoids the explicit `--max-size` workaround in case of incorrect video encoder capabilities.", "path": "server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java", "hun...
true
Genymobile/scrcpy
6,854
issue_to_patch
Include LICENSE file in release archives
2892d4095a4b7a72542c7531e68d47c2425a1ca5
09a5c17b070b0395730464639c7f04060c3e5d06
diff --git a/release/build_linux.sh b/release/build_linux.sh index 37dc763bf5..7810c80381 100755 --- a/release/build_linux.sh +++ b/release/build_linux.sh @@ -44,4 +44,5 @@ cp "$LINUX_BUILD_DIR"/app/scrcpy "$LINUX_BUILD_DIR/dist/" cp app/data/scrcpy.png "$LINUX_BUILD_DIR/dist/" cp app/data/disconnected.png "$LINUX_BU...
[ "release/build_linux.sh", "release/build_macos.sh", "release/build_windows.sh" ]
[]
true
Genymobile/scrcpy
6,853
issue_to_patch
Fix gamepad
In SDL2, the `which` field in `SDL_ControllerDeviceEvent` contained the device index. In SDL3, the `which` field in `SDL_GamepadDeviceEvent` is the joystick instance id directly. This was not properly migrated from SDL2 to SDL3 in commit 02989249f6a992090a70c4d61e0834a990f004fa. Refs #6216 Refs https://githu...
610eff34140bead565cbd5aa8f72d4cd9ea917ae
2892d4095a4b7a72542c7531e68d47c2425a1ca5
diff --git a/app/src/input_manager.c b/app/src/input_manager.c index 103067a7bc..3b123842b0 100644 --- a/app/src/input_manager.c +++ b/app/src/input_manager.c @@ -1048,13 +1048,13 @@ sc_input_manager_process_gamepad_device(struct sc_input_manager *im, if (event->type == SDL_EVENT_GAMEPAD_ADDED) { SDL_Game...
[ "app/src/input_manager.c", "app/src/scrcpy.c" ]
[]
true
Genymobile/scrcpy
6,807
issue_to_patch
Add option to change the background color
Introduce a `--background-color` option that accepts hexadecimal color codes (3-digit or 6-digit formats): ```bash scrcpy --background-color=#234567 scrcpy --background-color=234567 # leading '#' is optional scrcpy --background-color=#567 # equivalent to #556677 ``` Fixes #5855 Refs https://github.co...
3de3325b984ff5b83b22b94fd9c8adba901c7136
198cc19afb23f5d119318c88084451307faa143a
diff --git a/app/data/bash-completion/scrcpy b/app/data/bash-completion/scrcpy index 0cae593a45..e8cae851af 100644 --- a/app/data/bash-completion/scrcpy +++ b/app/data/bash-completion/scrcpy @@ -12,6 +12,7 @@ _scrcpy() { --audio-source= --audio-output-buffer= -b --video-bit-rate= + --b...
[ "app/data/bash-completion/scrcpy", "app/data/zsh-completion/_scrcpy", "app/scrcpy.1", "app/src/cli.c", "app/src/options.c", "app/src/options.h", "app/src/scrcpy.c", "app/src/screen.c", "app/src/screen.h", "doc/window.md" ]
[ { "comment": "```suggestion\n .text = \"Set the background color, encoded as hexadecimal color code \"\n```", "path": "app/src/cli.c", "hunk": "@@ -253,6 +254,14 @@ static const struct sc_option options[] = {\n \"Unit suffixes are supported: 'K' (x1000) and 'M' (x1000000).\\n\"\n ...
true
Genymobile/scrcpy
6,807
comment_to_fix
Add option to change the background color
```suggestion .text = "Set the background color, encoded as hexadecimal color code " ```
3de3325b984ff5b83b22b94fd9c8adba901c7136
198cc19afb23f5d119318c88084451307faa143a
diff --git a/app/src/cli.c b/app/src/cli.c index 39576d8d20..2cb0d3e23d 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -106,6 +106,7 @@ enum { OPT_MIN_SIZE_ALIGNMENT, OPT_NO_WINDOW_ASPECT_RATIO_LOCK, OPT_KEEP_ACTIVE, + OPT_BACKGROUND_COLOR, }; struct sc_option { @@ -253,6 +254,14 @@ static cons...
[ "app/src/cli.c" ]
[ { "comment": "```suggestion\n .text = \"Set the background color, encoded as hexadecimal color code \"\n```", "path": "app/src/cli.c", "hunk": "@@ -253,6 +254,14 @@ static const struct sc_option options[] = {\n \"Unit suffixes are supported: 'K' (x1000) and 'M' (x1000000).\\n\"\n ...
true
Genymobile/scrcpy
6,807
comment_to_fix
Add option to change the background color
Do you want to allow transparency? It's a feature request from https://github.com/Genymobile/scrcpy/issues/5855.
3de3325b984ff5b83b22b94fd9c8adba901c7136
198cc19afb23f5d119318c88084451307faa143a
diff --git a/app/src/cli.c b/app/src/cli.c index 39576d8d20..2cb0d3e23d 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -106,6 +106,7 @@ enum { OPT_MIN_SIZE_ALIGNMENT, OPT_NO_WINDOW_ASPECT_RATIO_LOCK, OPT_KEEP_ACTIVE, + OPT_BACKGROUND_COLOR, }; struct sc_option { @@ -253,6 +254,14 @@ static cons...
[ "app/src/cli.c" ]
[ { "comment": "Do you want to allow transparency? It's a feature request from https://github.com/Genymobile/scrcpy/issues/5855.", "path": "app/src/cli.c", "hunk": "@@ -253,6 +254,14 @@ static const struct sc_option options[] = {\n \"Unit suffixes are supported: 'K' (x1000) and 'M' (x10000...
true
Genymobile/scrcpy
6,662
issue_to_patch
Display disconnected icon before closing
When the connection to the device is lost while mirroring, the window closed immediately, suggesting scrcpy had crashed. To make it clear that a disconnection occurred, display a disconnected icon for 2 seconds before closing the window. The icon replaces the screen content immediately: <img width="231" height...
bad2183087185c1ddd7cacf2fe68be1a7429499f
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/data/disconnected.png b/app/data/disconnected.png new file mode 100644 index 0000000000..37ff3d855e Binary files /dev/null and b/app/data/disconnected.png differ diff --git a/app/data/icon.png b/app/data/scrcpy.png similarity index 100% rename from app/data/icon.png rename to app/data/scrcpy.png diff -...
[ "app/data/disconnected.png", "app/data/scrcpy.png", "app/data/scrcpy.svg", "app/meson.build", "app/scrcpy.1", "app/src/cli.c", "app/src/disconnect.c", "app/src/disconnect.h", "app/src/events.c", "app/src/events.h", "app/src/icon.c", "app/src/icon.h", "app/src/input_manager.c", "app/src/inp...
[ { "comment": "I think there is an issue here in case `sc_disconnect_start()` failed to initialize the mutex/cond/thread. I would add a check like this above the while-loop:\r\n```c\r\n if (!screen->disconnect_started) {\r\n // If sc_disconnect_start() failed, quit immediately\r\n return;\r\n ...
true
Genymobile/scrcpy
6,662
comment_to_fix
Display disconnected icon before closing
I think there is an issue here in case `sc_disconnect_start()` failed to initialize the mutex/cond/thread. I would add a check like this above the while-loop: ```c if (!screen->disconnect_started) { // If sc_disconnect_start() failed, quit immediately return; } ```
bad2183087185c1ddd7cacf2fe68be1a7429499f
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/screen.c b/app/src/screen.c index d50b670f89..9f1876ed86 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -184,7 +184,7 @@ compute_content_rect(struct sc_size render_size, struct sc_size content_size, static void sc_screen_update_content_rect(struct sc_screen *screen) { // Only upscal...
[ "app/src/screen.c" ]
[ { "comment": "I think there is an issue here in case `sc_disconnect_start()` failed to initialize the mutex/cond/thread. I would add a check like this above the while-loop:\r\n```c\r\n if (!screen->disconnect_started) {\r\n // If sc_disconnect_start() failed, quit immediately\r\n return;\r\n ...
true
Genymobile/scrcpy
6,662
comment_to_fix
Display disconnected icon before closing
`d->interrupted` is guarded by the mutex in `sc_disconnect_interrupt()` thus I would copy its value while the mutex is still locked in order to avoid a data race: ```suggestion bool interrupted = d->interrupted; sc_mutex_unlock(&d->mutex); if (!interrupted) { ``` But maybe you can simp...
bad2183087185c1ddd7cacf2fe68be1a7429499f
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/disconnect.c b/app/src/disconnect.c new file mode 100644 index 0000000000..d494091b03 --- /dev/null +++ b/app/src/disconnect.c @@ -0,0 +1,88 @@ +#include "disconnect.h" + +#include <assert.h> + +#include "icon.h" +#include "util/log.h" + +static int +run(void *userdata) { + struct sc_disconnect ...
[ "app/src/disconnect.c" ]
[ { "comment": "`d->interrupted` is guarded by the mutex in `sc_disconnect_interrupt()` thus I would copy its value while the mutex is still locked in order to avoid a data race:\r\n```suggestion\r\n bool interrupted = d->interrupted;\r\n sc_mutex_unlock(&d->mutex);\r\n\r\n if (!interrupted) ...
true
Genymobile/scrcpy
6,662
comment_to_fix
Display disconnected icon before closing
I assume `SC_TICK_NONE` means immediate timeout, not infinite, right? So there is a missing `else` branch for the timeout callback: ```c if (d->deadline != SC_TICK_NONE) { ... } else { d->cbs->on_timeout(d, d->cbs_userdata); } ``` Otherwise `sc_screen_handle_disconnection()` would ...
bad2183087185c1ddd7cacf2fe68be1a7429499f
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/disconnect.c b/app/src/disconnect.c new file mode 100644 index 0000000000..d494091b03 --- /dev/null +++ b/app/src/disconnect.c @@ -0,0 +1,88 @@ +#include "disconnect.h" + +#include <assert.h> + +#include "icon.h" +#include "util/log.h" + +static int +run(void *userdata) { + struct sc_disconnect ...
[ "app/src/disconnect.c" ]
[ { "comment": "I assume `SC_TICK_NONE` means immediate timeout, not infinite, right? So there is a missing `else` branch for the timeout callback:\r\n```c\r\n if (d->deadline != SC_TICK_NONE) {\r\n ...\r\n } else {\r\n d->cbs->on_timeout(d, d->cbs_userdata);\r\n }\r\n```\r\n\r\nOtherwise `...
true
Genymobile/scrcpy
6,662
comment_to_fix
Display disconnected icon before closing
Then it should be possible to rearrange the code slightly such as to have a single occurrence of `d->cbs->on_timeout()`. Assuming my previous comments are correct, something along these lines perhaps: ```suggestion bool timed_out; if (d->deadline == SC_TICK_NONE) { timed_out = true; } else { ...
bad2183087185c1ddd7cacf2fe68be1a7429499f
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/disconnect.c b/app/src/disconnect.c new file mode 100644 index 0000000000..d494091b03 --- /dev/null +++ b/app/src/disconnect.c @@ -0,0 +1,88 @@ +#include "disconnect.h" + +#include <assert.h> + +#include "icon.h" +#include "util/log.h" + +static int +run(void *userdata) { + struct sc_disconnect ...
[ "app/src/disconnect.c" ]
[ { "comment": "Then it should be possible to rearrange the code slightly such as to have a single occurrence of `d->cbs->on_timeout()`. Assuming my previous comments are correct, something along these lines perhaps:\r\n```suggestion\r\n bool timed_out;\r\n\r\n if (d->deadline == SC_TICK_NONE) {\r\n ...
true
Genymobile/scrcpy
6,662
comment_to_fix
Display disconnected icon before closing
What would you think of treating `sc_mutex_init()` failure like `sc_cond_init()` failure with a `goto` statement? ```suggestion goto error_return; ``` And adding the `error_return` label before the final return of this function.
bad2183087185c1ddd7cacf2fe68be1a7429499f
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/disconnect.c b/app/src/disconnect.c new file mode 100644 index 0000000000..d494091b03 --- /dev/null +++ b/app/src/disconnect.c @@ -0,0 +1,88 @@ +#include "disconnect.h" + +#include <assert.h> + +#include "icon.h" +#include "util/log.h" + +static int +run(void *userdata) { + struct sc_disconnect ...
[ "app/src/disconnect.c" ]
[ { "comment": "What would you think of treating `sc_mutex_init()` failure like `sc_cond_init()` failure with a `goto` statement?\n```suggestion\n goto error_return;\n```\nAnd adding the `error_return` label before the final return of this function.", "path": "app/src/disconnect.c", "hunk": "@@ -0,...
true
Genymobile/scrcpy
6,662
comment_to_fix
Display disconnected icon before closing
```suggestion case SC_EVENT_DISCONNECTED_TIMEOUT: LOGD("Closing after device disconnection"); return; case SDL_EVENT_QUIT: LOGD("User requested to quit"); sc_screen_interrupt_disconnect(screen); return; ...
bad2183087185c1ddd7cacf2fe68be1a7429499f
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/screen.c b/app/src/screen.c index d50b670f89..9f1876ed86 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -184,7 +184,7 @@ compute_content_rect(struct sc_size render_size, struct sc_size content_size, static void sc_screen_update_content_rect(struct sc_screen *screen) { // Only upscal...
[ "app/src/screen.c" ]
[ { "comment": "```suggestion\r\n case SC_EVENT_DISCONNECTED_TIMEOUT:\r\n LOGD(\"Closing after device disconnection\");\r\n return;\r\n case SDL_EVENT_QUIT:\r\n LOGD(\"User requested to quit\");\r\n sc_screen_interrupt_disconnect(sc...
true
Genymobile/scrcpy
6,662
comment_to_fix
Display disconnected icon before closing
This is your convention in the `events` module: ```suggestion sc_push_event_impl(uint32_t type, void *ptr, const char *name); ```
bad2183087185c1ddd7cacf2fe68be1a7429499f
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/events.h b/app/src/events.h index 567268ab7f..c82741afe6 100644 --- a/app/src/events.h +++ b/app/src/events.h @@ -14,18 +14,20 @@ enum { SC_EVENT_DEVICE_DISCONNECTED, SC_EVENT_SERVER_CONNECTION_FAILED, SC_EVENT_SERVER_CONNECTED, - SC_EVENT_USB_DEVICE_DISCONNECTED, SC_EVENT_DE...
[ "app/src/events.h" ]
[ { "comment": "This is your convention in the `events` module:\n```suggestion\nsc_push_event_impl(uint32_t type, void *ptr, const char *name);\n```", "path": "app/src/events.h", "hunk": "@@ -14,18 +14,20 @@ enum {\n SC_EVENT_DEVICE_DISCONNECTED,\n SC_EVENT_SERVER_CONNECTION_FAILED,\n SC_EVENT...
true
Genymobile/scrcpy
6,662
comment_to_fix
Display disconnected icon before closing
```suggestion sc_push_event_impl(uint32_t type, void *ptr, const char *name) { ```
bad2183087185c1ddd7cacf2fe68be1a7429499f
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/events.c b/app/src/events.c index ca7e4008a6..5269bdbcf8 100644 --- a/app/src/events.c +++ b/app/src/events.c @@ -6,9 +6,13 @@ #include "util/thread.h" bool -sc_push_event_impl(uint32_t type, const char *name) { - SDL_Event event; - event.type = type; +sc_push_event_impl(uint32_t type, vo...
[ "app/src/events.c" ]
[ { "comment": "```suggestion\nsc_push_event_impl(uint32_t type, void *ptr, const char *name) {\n```", "path": "app/src/events.c", "hunk": "@@ -6,9 +6,13 @@\n #include \"util/thread.h\"\n \n bool\n-sc_push_event_impl(uint32_t type, const char *name) {\n- SDL_Event event;\n- event.type = type;\n+sc_p...
true
Genymobile/scrcpy
6,662
comment_to_fix
Display disconnected icon before closing
In `terminate_runnables_on_event_loop()` (`scrcpy.c`) you're doing it in a while-loop without temporary `nevents` variable, thus here even though it's an if-condition maybe `nevents` could be removed just for symmetry? But maybe it's just less readable after all. ```suggestion if (SDL_PeepEvents(&event, 1, SDL_GETE...
bad2183087185c1ddd7cacf2fe68be1a7429499f
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/screen.c b/app/src/screen.c index d50b670f89..9f1876ed86 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -184,7 +184,7 @@ compute_content_rect(struct sc_size render_size, struct sc_size content_size, static void sc_screen_update_content_rect(struct sc_screen *screen) { // Only upscal...
[ "app/src/screen.c" ]
[ { "comment": "In `terminate_runnables_on_event_loop()` (`scrcpy.c`) you're doing it in a while-loop without temporary `nevents` variable, thus here even though it's an if-condition maybe `nevents` could be removed just for symmetry? But maybe it's just less readable after all.\n```suggestion\n if (SDL_PeepEv...
true
Genymobile/scrcpy
6,662
comment_to_fix
Display disconnected icon before closing
I think this line goes beyond your line length limit, but I don't know where to cut it. ```suggestion bool ok = sc_texture_set_from_surface(&screen->tex, icon_disconnected); ```
bad2183087185c1ddd7cacf2fe68be1a7429499f
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/screen.c b/app/src/screen.c index d50b670f89..9f1876ed86 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -184,7 +184,7 @@ compute_content_rect(struct sc_size render_size, struct sc_size content_size, static void sc_screen_update_content_rect(struct sc_screen *screen) { // Only upscal...
[ "app/src/screen.c" ]
[ { "comment": "I think this line goes beyond your line length limit, but I don't know where to cut it.\n```suggestion\n bool ok =\n sc_texture_set_from_surface(&screen->tex, icon_disconnected);\n```", "path": "app/src/screen.c", "hunk": "@@ -915,6 +987,54 @@ sc_screen_hand...
true
Genymobile/scrcpy
6,662
comment_to_fix
Display disconnected icon before closing
What do you think about moving this case up at the top of the switch? Then you would have the two `DISCONNECTED` events one after the other.
bad2183087185c1ddd7cacf2fe68be1a7429499f
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/screen.c b/app/src/screen.c index d50b670f89..9f1876ed86 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -184,7 +184,7 @@ compute_content_rect(struct sc_size render_size, struct sc_size content_size, static void sc_screen_update_content_rect(struct sc_screen *screen) { // Only upscal...
[ "app/src/screen.c" ]
[ { "comment": "What do you think about moving this case up at the top of the switch? Then you would have the two `DISCONNECTED` events one after the other.", "path": "app/src/screen.c", "hunk": "@@ -915,6 +987,54 @@ sc_screen_handle_event(struct sc_screen *screen, const SDL_Event *event) {\n sc_input...
true
Genymobile/scrcpy
6,216
issue_to_patch
Migrate from SDL2 to SDL3
First, this PR contains some fixes that could be merged directly into `dev`. Then, there are some refactors to make the transition easier, especially the handling of integer scrolling (https://github.com/Genymobile/scrcpy/issues/6156#issuecomment-3016836940) and the configuration of the color space at texture creati...
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2bb5a38c88..138ad821e0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -72,16 +72,30 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + # Same as build-linux-x86_64 ...
[ ".github/workflows/release.yml", "README.md", "app/deps/sdl.sh", "app/meson.build", "app/src/audio_player.c", "app/src/audio_player.h", "app/src/compat.h", "app/src/display.c", "app/src/display.h", "app/src/events.c", "app/src/events.h", "app/src/hid/hid_keyboard.h", "app/src/hid/hid_mouse.c...
[ { "comment": "You probably mean SDL_WAYLAND?", "path": "app/deps/sdl.sh", "hunk": "@@ -35,45 +35,48 @@ else\n cd \"$DIRNAME\"\n \n conf=(\n- --prefix=\"$INSTALL_DIR/$DIRNAME\"\n+ -DCMAKE_INSTALL_PREFIX=\"$INSTALL_DIR/$DIRNAME\"\n )\n \n if [[ \"$HOST\" == linux ]]\n the...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
You probably mean SDL_WAYLAND?
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/deps/sdl.sh b/app/deps/sdl.sh index f74ccf4124..2219d5c8e5 100755 --- a/app/deps/sdl.sh +++ b/app/deps/sdl.sh @@ -3,9 +3,9 @@ set -ex . $(dirname ${BASH_SOURCE[0]})/_init process_args "$@" -VERSION=2.32.8 +VERSION=3.4.0 URL="https://github.com/libsdl-org/SDL/archive/refs/tags/release-$VERSION.tar....
[ "app/deps/sdl.sh" ]
[ { "comment": "You probably mean SDL_WAYLAND?", "path": "app/deps/sdl.sh", "hunk": "@@ -35,45 +35,48 @@ else\n cd \"$DIRNAME\"\n \n conf=(\n- --prefix=\"$INSTALL_DIR/$DIRNAME\"\n+ -DCMAKE_INSTALL_PREFIX=\"$INSTALL_DIR/$DIRNAME\"\n )\n \n if [[ \"$HOST\" == linux ]]\n the...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
```suggestion gl->GenerateMipmap(GL_TEXTURE_2D); ```
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/display.c b/app/src/display.c index 15f9a1f19e..3050966cfb 100644 --- a/app/src/display.c +++ b/app/src/display.c @@ -6,14 +6,18 @@ #include <libavutil/pixfmt.h> #include "util/log.h" +#include "util/sdl.h" static bool sc_display_init_novideo_icon(struct sc_display *display, ...
[ "app/src/display.c" ]
[ { "comment": "```suggestion\r\n gl->GenerateMipmap(GL_TEXTURE_2D);\r\n```", "path": "app/src/display.c", "hunk": "@@ -282,19 +334,22 @@ sc_display_prepare_texture(struct sc_display *display, struct sc_size size,\n static bool\n sc_display_update_texture_internal(struct sc_display *display,\n ...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
```suggestion LOGE("Could not set pointer property: %s", SDL_GetError()); ```
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/icon.c b/app/src/icon.c index 797afc75b3..a1e82a5aea 100644 --- a/app/src/icon.c +++ b/app/src/icon.c @@ -10,7 +10,7 @@ #include <libavutil/avutil.h> #include <libavutil/pixdesc.h> #include <libavutil/pixfmt.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "config.h" #include "util/...
[ "app/src/icon.c" ]
[ { "comment": "```suggestion\r\n LOGE(\"Could not set pointer property: %s\", SDL_GetError());\r\n```", "path": "app/src/icon.c", "hunk": "@@ -248,17 +236,35 @@ load_from_path(const char *path) {\n #endif\n }\n \n- SDL_Palette *palette = surface->format->palette;\n- assert(pa...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
```suggestion // Trigger a SDL_EVENT_GAMEPAD_ADDED event for all gamepads already ```
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index aedfdf9cf8..a16bf6a8f1 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -6,7 +6,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #ifdef _WIN32 // not needed here, but winsock2.h must never b...
[ "app/src/scrcpy.c" ]
[ { "comment": "```suggestion\r\n // Trigger a SDL_EVENT_GAMEPAD_ADDED event for all gamepads already\r\n```", "path": "app/src/scrcpy.c", "hunk": "@@ -366,12 +357,19 @@ static void\n init_sdl_gamepads(void) {\n // Trigger a SDL_CONTROLLERDEVICEADDED event for all gamepads already", "resolving_...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
```suggestion ```
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/screen.c b/app/src/screen.c index da17df0ed2..4209e22455 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -2,12 +2,13 @@ #include <assert.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "events.h" #include "icon.h" #include "options.h" #include "util/l...
[ "app/src/screen.c" ]
[ { "comment": "```suggestion\r\n```", "path": "app/src/screen.c", "hunk": "@@ -26,45 +27,27 @@ get_oriented_size(struct sc_size size, enum sc_orientation orientation) {\n return oriented_size;\n }\n \n-// get the window size in a struct sc_size\n-static struct sc_size\n-get_window_size(const struct s...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
```suggestion if (event->type == SDL_EVENT_WINDOW_RESIZED) { ``` Not sure if you really meant `EXPOSED`? (And is this `CONTINUOUS_RESIZING_WORKAROUND` still needed with SDL3?)
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/screen.c b/app/src/screen.c index da17df0ed2..4209e22455 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -2,12 +2,13 @@ #include <assert.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "events.h" #include "icon.h" #include "options.h" #include "util/l...
[ "app/src/screen.c" ]
[ { "comment": "```suggestion\r\n if (event->type == SDL_EVENT_WINDOW_RESIZED) {\r\n```\r\nNot sure if you really meant `EXPOSED`? (And is this `CONTINUOUS_RESIZING_WORKAROUND` still needed with SDL3?)", "path": "app/src/screen.c", "hunk": "@@ -236,18 +216,18 @@ sc_screen_render_novideo(struct sc_scree...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
It looks like both the log messages should use either `LOGW()` (since they are only "preferred" bounds) or `LOGE()`.
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/screen.c b/app/src/screen.c index da17df0ed2..4209e22455 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -2,12 +2,13 @@ #include <assert.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "events.h" #include "icon.h" #include "options.h" #include "util/l...
[ "app/src/screen.c" ]
[ { "comment": "It looks like both the log messages should use either `LOGW()` (since they are only \"preferred\" bounds) or `LOGE()`.", "path": "app/src/screen.c", "hunk": "@@ -26,45 +27,27 @@ get_oriented_size(struct sc_size size, enum sc_orientation orientation) {\n return oriented_size;\n }\n \n-/...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
According to the [migration guide](https://wiki.libsdl.org/SDL3/README-migration), near the bottom of the page: ``` The following window operations are now considered to be asynchronous requests and should not be assumed to succeed unless a corresponding event has been received: - SDL_SetWindowSize() (SDL_EVENT...
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/screen.c b/app/src/screen.c index da17df0ed2..4209e22455 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -2,12 +2,13 @@ #include <assert.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "events.h" #include "icon.h" #include "options.h" #include "util/l...
[ "app/src/screen.c" ]
[ { "comment": "According to the [migration guide](https://wiki.libsdl.org/SDL3/README-migration), near the bottom of the page:\r\n```\r\nThe following window operations are now considered to be asynchronous requests and should not be\r\nassumed to succeed unless a corresponding event has been received:\r\n\r\n ...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
By any chance, does it still apply to SDL3 or can it be removed?
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/screen.c b/app/src/screen.c index da17df0ed2..4209e22455 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -2,12 +2,13 @@ #include <assert.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "events.h" #include "icon.h" #include "options.h" #include "util/l...
[ "app/src/screen.c" ]
[ { "comment": "By any chance, does it still apply to SDL3 or can it be removed?", "path": "app/src/screen.c", "hunk": "@@ -783,46 +788,38 @@ sc_screen_handle_event(struct sc_screen *screen, const SDL_Event *event) {\n }\n return true;\n }\n- case SDL_WINDOWEVENT:\n-...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
```suggestion SDL_Gamepad *sdl_gamepad = ``` Two observations: - superfluous space after the asterisk, - switched from "game controller" to "gamepad" in SDL3. You already use `struct sc_gamepad_uhid *gamepad` in this function but I think `sdl_gamepad` here would be appropriate (I saw for instance the pa...
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/uhid/gamepad_uhid.c b/app/src/uhid/gamepad_uhid.c index c64feb1851..2ae9bb7d44 100644 --- a/app/src/uhid/gamepad_uhid.c +++ b/app/src/uhid/gamepad_uhid.c @@ -3,7 +3,7 @@ #include <assert.h> #include <inttypes.h> #include <string.h> -#include <SDL2/SDL_gamecontroller.h> +#include <SDL3/SDL_gamepa...
[ "app/src/uhid/gamepad_uhid.c" ]
[ { "comment": "```suggestion\r\n SDL_Gamepad *sdl_gamepad =\r\n```\r\nTwo observations:\r\n - superfluous space after the asterisk,\r\n - switched from \"game controller\" to \"gamepad\" in SDL3.\r\n\r\nYou already use `struct sc_gamepad_uhid *gamepad` in this function but I think `sdl_gamepad` here would b...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
```suggestion LOGW("Could not open gamepad"); ```
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/usb/screen_otg.c b/app/src/usb/screen_otg.c index 5c580df994..4fbccfb02a 100644 --- a/app/src/usb/screen_otg.c +++ b/app/src/usb/screen_otg.c @@ -7,14 +7,19 @@ #include "options.h" #include "util/acksync.h" #include "util/log.h" +#include "util/sdl.h" static void sc_screen_otg_render(struct ...
[ "app/src/usb/screen_otg.c" ]
[ { "comment": "```suggestion\r\n LOGW(\"Could not open gamepad\");\r\n```", "path": "app/src/usb/screen_otg.c", "hunk": "@@ -180,34 +187,34 @@ sc_screen_otg_process_mouse_wheel(struct sc_screen_otg *screen,\n \n static void\n sc_screen_otg_process_gamepad_device(struct sc_screen_otg *screen,\n...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
```suggestion LOGW("Could not get gamepad joystick"); ``` There might be more instances of "(game) controller" to be reworded, I didn't search. Probably better to do the renaming in an additional commit?
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/usb/screen_otg.c b/app/src/usb/screen_otg.c index 5c580df994..4fbccfb02a 100644 --- a/app/src/usb/screen_otg.c +++ b/app/src/usb/screen_otg.c @@ -7,14 +7,19 @@ #include "options.h" #include "util/acksync.h" #include "util/log.h" +#include "util/sdl.h" static void sc_screen_otg_render(struct ...
[ "app/src/usb/screen_otg.c" ]
[ { "comment": "```suggestion\r\n LOGW(\"Could not get gamepad joystick\");\r\n```\r\nThere might be more instances of \"(game) controller\" to be reworded, I didn't search. Probably better to do the renaming in an additional commit?", "path": "app/src/usb/screen_otg.c", "hunk": "@@ -180,34 +18...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
Now that SDL3 uses `Gamepad` we will wonder why variables are named `gc` (~~there are many~~ [EDIT: I found only four] such instances in the code base). Unfortunately `gp` is already used for `struct sc_gamepad_processor *gp`. You will certainly have better ideas, but maybe ~~use a single letter `g` or~~ go for t...
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/usb/screen_otg.c b/app/src/usb/screen_otg.c index 5c580df994..4fbccfb02a 100644 --- a/app/src/usb/screen_otg.c +++ b/app/src/usb/screen_otg.c @@ -7,14 +7,19 @@ #include "options.h" #include "util/acksync.h" #include "util/log.h" +#include "util/sdl.h" static void sc_screen_otg_render(struct ...
[ "app/src/usb/screen_otg.c" ]
[ { "comment": "Now that SDL3 uses `Gamepad` we will wonder why variables are named `gc` (~~there are many~~ [EDIT: I found only four] such instances in the code base).\r\n\r\nUnfortunately `gp` is already used for `struct sc_gamepad_processor *gp`.\r\n\r\nYou will certainly have better ideas, but maybe ~~use a s...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
These ones are swapped in `util/sdl.c`: ```suggestion struct sc_size sc_sdl_get_window_size_in_pixels(SDL_Window *window); void sc_sdl_set_window_size(SDL_Window *window, struct sc_size size); ```
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/util/sdl.h b/app/src/util/sdl.h new file mode 100644 index 0000000000..78b8319e7e --- /dev/null +++ b/app/src/util/sdl.h @@ -0,0 +1,43 @@ +#ifndef SC_SDL_H +#define SC_SDL_H + +#include "common.h" + +#include <stdint.h> +#include <SDL3/SDL_render.h> +#include <SDL3/SDL_video.h> + +#include "coords....
[ "app/src/util/sdl.h" ]
[ { "comment": "These ones are swapped in `util/sdl.c`:\r\n```suggestion\r\nstruct sc_size\r\nsc_sdl_get_window_size_in_pixels(SDL_Window *window);\r\n\r\nvoid\r\nsc_sdl_set_window_size(SDL_Window *window, struct sc_size size);\r\n```", "path": "app/src/util/sdl.h", "hunk": "@@ -0,0 +1,46 @@\n+#ifndef SC_...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
Same things as in previous comments: - reword "game controller" and "controller" to "gamepad" (and search for those throughout the code base), - find a better name for the `gc` pointer (everywhere there is a `SDL_Gamepad *`).
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/input_manager.c b/app/src/input_manager.c index 3e4dd0f32f..70adf59fbc 100644 --- a/app/src/input_manager.c +++ b/app/src/input_manager.c @@ -3,7 +3,7 @@ #include <assert.h> #include <stdlib.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "android/input.h" #incl...
[ "app/src/input_manager.c" ]
[ { "comment": "Same things as in previous comments:\r\n - reword \"game controller\" and \"controller\" to \"gamepad\" (and search for those throughout the code base),\r\n - find a better name for the `gc` pointer (everywhere there is a `SDL_Gamepad *`).", "path": "app/src/input_manager.c", "hunk": "@@...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
```suggestion LOGW("Could not open gamepad"); ```
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/input_manager.c b/app/src/input_manager.c index 3e4dd0f32f..70adf59fbc 100644 --- a/app/src/input_manager.c +++ b/app/src/input_manager.c @@ -3,7 +3,7 @@ #include <assert.h> #include <stdlib.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "android/input.h" #incl...
[ "app/src/input_manager.c" ]
[ { "comment": "```suggestion\r\n LOGW(\"Could not open gamepad\");\r\n```", "path": "app/src/input_manager.c", "hunk": "@@ -911,31 +906,31 @@ sc_input_manager_process_mouse_wheel(struct sc_input_manager *im,\n \n static void\n sc_input_manager_process_gamepad_device(struct sc_input_manager *im...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
```suggestion LOGW("Could not get gamepad joystick"); ```
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/input_manager.c b/app/src/input_manager.c index 3e4dd0f32f..70adf59fbc 100644 --- a/app/src/input_manager.c +++ b/app/src/input_manager.c @@ -3,7 +3,7 @@ #include <assert.h> #include <stdlib.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "android/input.h" #incl...
[ "app/src/input_manager.c" ]
[ { "comment": "```suggestion\r\n LOGW(\"Could not get gamepad joystick\");\r\n```", "path": "app/src/input_manager.c", "hunk": "@@ -911,31 +906,31 @@ sc_input_manager_process_mouse_wheel(struct sc_input_manager *im,\n \n static void\n sc_input_manager_process_gamepad_device(struct sc_input_man...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
```suggestion // As documented in <https://wiki.libsdl.org/SDL3/SDL_JoystickID>: ```
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/input_events.h b/app/src/input_events.h index 5cf9f12db9..57ef9b85fc 100644 --- a/app/src/input_events.h +++ b/app/src/input_events.h @@ -6,7 +6,7 @@ #include <assert.h> #include <stdbool.h> #include <stdint.h> -#include <SDL2/SDL_events.h> +#include <SDL3/SDL_events.h> #include "coords.h" ...
[ "app/src/input_events.h" ]
[ { "comment": "```suggestion\r\n// As documented in <https://wiki.libsdl.org/SDL3/SDL_JoystickID>:\r\n```", "path": "app/src/input_events.h", "hunk": "@@ -412,10 +409,9 @@ struct sc_touch_event {\n float pressure;\n };\n \n-// As documented in <https://wiki.libsdl.org/SDL2/SDL_JoystickID>:\n-// The I...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
```suggestion ``` I scratched my head when reading https://wiki.libsdl.org/SDL3/README-main-functions#the-main-entry-point-in-sdl3 but now I think I understand the global picture. In SDL2: - `SDL.h` includes `SDL_main.h` [here](https://github.com/libsdl-org/SDL/blob/SDL2/include/SDL.h#L31). - `SDL_main.h` chec...
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/main.c b/app/src/main.c index b4897456f6..7b728d7301 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -5,8 +5,7 @@ #ifdef HAVE_V4L2 # include <libavdevice/avdevice.h> #endif -#define SDL_MAIN_HANDLED // avoid link error on Linux Windows Subsystem -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> ...
[ "app/src/main.c" ]
[ { "comment": "```suggestion\r\n```\r\n\r\nI scratched my head when reading https://wiki.libsdl.org/SDL3/README-main-functions#the-main-entry-point-in-sdl3 but now I think I understand the global picture.\r\n\r\nIn SDL2:\r\n- `SDL.h` includes `SDL_main.h` [here](https://github.com/libsdl-org/SDL/blob/SDL2/includ...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
```suggestion LOGE("Could not initialize SDL gamepad: %s", SDL_GetError()); ``` So this will be the same log message as in `src/scrcpy.c`.
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/usb/scrcpy_otg.c b/app/src/usb/scrcpy_otg.c index 1a9cc46ee1..483720f853 100644 --- a/app/src/usb/scrcpy_otg.c +++ b/app/src/usb/scrcpy_otg.c @@ -3,7 +3,7 @@ #include <assert.h> #include <stdbool.h> #include <stdlib.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #ifdef _WIN32 # include "ad...
[ "app/src/usb/scrcpy_otg.c" ]
[ { "comment": "```suggestion\r\n LOGE(\"Could not initialize SDL gamepad: %s\", SDL_GetError());\r\n```\r\nSo this will be the same log message as in `src/scrcpy.c`.", "path": "app/src/usb/scrcpy_otg.c", "hunk": "@@ -63,22 +63,18 @@ scrcpy_otg(struct scrcpy_options *options) {\n \n const c...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
Just to be sure everything is correct: - On `RESTORED` you resize only if it is a video window, but on `LEAVE_FULLSCREEN` you resize even if there is no video, is it because you allow fullscreen only if `assert(screen->video)`? - You removed `sc_screen_render(screen, true)`, is it because it will be done on `PIXEL_SI...
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/screen.c b/app/src/screen.c index da17df0ed2..4209e22455 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -2,12 +2,13 @@ #include <assert.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "events.h" #include "icon.h" #include "options.h" #include "util/l...
[ "app/src/screen.c" ]
[ { "comment": "Just to be sure everything is correct:\r\n- On `RESTORED` you resize only if it is a video window, but on `LEAVE_FULLSCREEN` you resize even if there is no video, is it because you allow fullscreen only if `assert(screen->video)`?\r\n- You removed `sc_screen_render(screen, true)`, is it because it...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
Since you removed this restore request I think you can remove `sc_sdl_restore_window()` in `app/src/util/sdl.{c,h}`, correct?
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/screen.c b/app/src/screen.c index da17df0ed2..4209e22455 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -2,12 +2,13 @@ #include <assert.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "events.h" #include "icon.h" #include "options.h" #include "util/l...
[ "app/src/screen.c" ]
[ { "comment": "Since you removed this restore request I think you can remove `sc_sdl_restore_window()` in `app/src/util/sdl.{c,h}`, correct?", "path": "app/src/screen.c", "hunk": "@@ -759,15 +750,10 @@ void\n sc_screen_resize_to_pixel_perfect(struct sc_screen *screen) {\n assert(screen->video);\n \n-...
true
Genymobile/scrcpy
6,216
comment_to_fix
Migrate from SDL2 to SDL3
There are still some references to SDL2 in this file: https://github.com/Genymobile/scrcpy/blob/e3fa95387483635182962fc1fbdda207bfea5cb7/doc/build.md?plain=1#L33 https://github.com/Genymobile/scrcpy/blob/e3fa95387483635182962fc1fbdda207bfea5cb7/doc/build.md?plain=1#L39 https://github.com/Genymobile/scrcpy/blob/e3fa9538...
09eed565fc6aae4c554c7536f7964fbee8f1d06a
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/doc/build.md b/doc/build.md index 07efa6b730..d4f18473d2 100644 --- a/doc/build.md +++ b/doc/build.md @@ -30,13 +30,13 @@ the following files to a directory accessible from your `PATH`: It is also available in scrcpy releases. -The client requires [FFmpeg] and [LibSDL2]. Just follow the instructions. ...
[ "doc/build.md" ]
[ { "comment": "There are still some references to SDL2 in this file: https://github.com/Genymobile/scrcpy/blob/e3fa95387483635182962fc1fbdda207bfea5cb7/doc/build.md?plain=1#L33 https://github.com/Genymobile/scrcpy/blob/e3fa95387483635182962fc1fbdda207bfea5cb7/doc/build.md?plain=1#L39 https://github.com/Genymobil...
true
Genymobile/scrcpy
6,816
issue_to_patch
Replace run-on-main-thread implementation
Use `SDL_RunOnMainThread()` introduced in SDL3.
1db8da559fd5b412b02b564e9ad40c2580bb9b34
3fcb0108230686a52fc1da2c53026c181f3aa8df
diff --git a/app/src/events.c b/app/src/events.c index 5269bdbcf8..b7a3a7a34a 100644 --- a/app/src/events.c +++ b/app/src/events.c @@ -5,6 +5,9 @@ #include "util/log.h" #include "util/thread.h" +static sc_mutex mutex; +static bool stopped; + bool sc_push_event_impl(uint32_t type, void *ptr, const char *name) { ...
[ "app/src/events.c", "app/src/events.h", "app/src/main.c", "app/src/receiver.c", "app/src/scrcpy.c", "app/src/uhid/keyboard_uhid.c", "app/src/util/thread.c", "app/src/util/thread.h" ]
[ { "comment": "Can this include be removed in the previous-to-last commit already?", "path": "app/src/main.c", "hunk": "@@ -13,9 +13,9 @@\n #ifdef HAVE_USB\n # include \"usb/scrcpy_otg.h\"\n #endif\n+#include \"events.h\"\n #include \"util/log.h\"\n #include \"util/net.h\"\n-#include \"util/thread.h\"", ...
true
Genymobile/scrcpy
6,816
comment_to_fix
Replace run-on-main-thread implementation
Can this include be removed in the previous-to-last commit already?
1db8da559fd5b412b02b564e9ad40c2580bb9b34
3fcb0108230686a52fc1da2c53026c181f3aa8df
diff --git a/app/src/main.c b/app/src/main.c index 3ab03243f7..7327e07d3e 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -8,6 +8,7 @@ #include <SDL3/SDL.h> #include "cli.h" +#include "events.h" #include "options.h" #include "scrcpy.h" #ifdef HAVE_USB @@ -15,7 +16,6 @@ #endif #include "util/log.h" #includ...
[ "app/src/main.c" ]
[ { "comment": "Can this include be removed in the previous-to-last commit already?", "path": "app/src/main.c", "hunk": "@@ -13,9 +13,9 @@\n #ifdef HAVE_USB\n # include \"usb/scrcpy_otg.h\"\n #endif\n+#include \"events.h\"\n #include \"util/log.h\"\n #include \"util/net.h\"\n-#include \"util/thread.h\"", ...
true
Genymobile/scrcpy
6,816
comment_to_fix
Replace run-on-main-thread implementation
Is it possible now to remove this user event and also in `scrcpy.c` L143 `case SC_EVENT_RUN_ON_MAIN_THREAD`?
1db8da559fd5b412b02b564e9ad40c2580bb9b34
3fcb0108230686a52fc1da2c53026c181f3aa8df
diff --git a/app/src/events.h b/app/src/events.h index c82741afe6..0c7b4c3718 100644 --- a/app/src/events.h +++ b/app/src/events.h @@ -6,11 +6,11 @@ #include <stdbool.h> #include <stdint.h> #include <SDL3/SDL_events.h> +#include <SDL3/SDL_init.h> enum { SC_EVENT_NEW_FRAME = SDL_EVENT_USER, SC_EVENT_OPEN...
[ "app/src/events.h" ]
[ { "comment": "Is it possible now to remove this user event and also in `scrcpy.c` L143 `case SC_EVENT_RUN_ON_MAIN_THREAD`?", "path": "app/src/events.h", "hunk": "", "resolving_sha": "3fcb0108230686a52fc1da2c53026c181f3aa8df", "resolving_diff": "diff --git a/app/src/events.h b/app/src/events.h\ni...
true
Genymobile/scrcpy
6,816
comment_to_fix
Replace run-on-main-thread implementation
I'm not sure but it looks like `SDL_PumpEvents()` doesn't run the pending events, it just places them on the queue, right? And you already returned from `event_loop()` when you call `sc_main_thread_stop()` so they won't be caught and executed. But I may be mistaken.
1db8da559fd5b412b02b564e9ad40c2580bb9b34
3fcb0108230686a52fc1da2c53026c181f3aa8df
diff --git a/app/src/events.c b/app/src/events.c index 5269bdbcf8..b7a3a7a34a 100644 --- a/app/src/events.c +++ b/app/src/events.c @@ -5,6 +5,9 @@ #include "util/log.h" #include "util/thread.h" +static sc_mutex mutex; +static bool stopped; + bool sc_push_event_impl(uint32_t type, void *ptr, const char *name) { ...
[ "app/src/events.c" ]
[ { "comment": "I'm not sure but it looks like `SDL_PumpEvents()` doesn't run the pending events, it just places them on the queue, right? And you already returned from `event_loop()` when you call `sc_main_thread_stop()` so they won't be caught and executed. But I may be mistaken.", "path": "app/src/events.c...
true
Genymobile/scrcpy
6,816
comment_to_fix
Replace run-on-main-thread implementation
This is not in alphabetical order, should be at L11.
1db8da559fd5b412b02b564e9ad40c2580bb9b34
3fcb0108230686a52fc1da2c53026c181f3aa8df
diff --git a/app/src/main.c b/app/src/main.c index 3ab03243f7..7327e07d3e 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -8,6 +8,7 @@ #include <SDL3/SDL.h> #include "cli.h" +#include "events.h" #include "options.h" #include "scrcpy.h" #ifdef HAVE_USB @@ -15,7 +16,6 @@ #endif #include "util/log.h" #includ...
[ "app/src/main.c" ]
[ { "comment": "This is not in alphabetical order, should be at L11.", "path": "app/src/main.c", "hunk": "@@ -13,6 +13,7 @@\n #ifdef HAVE_USB\n # include \"usb/scrcpy_otg.h\"\n #endif\n+#include \"events.h\"", "resolving_sha": "3fcb0108230686a52fc1da2c53026c181f3aa8df", "resolving_diff": "diff --g...
true
Genymobile/scrcpy
6,809
issue_to_patch
Share SDL hints between normal and OTG modes
Some hints were missing for OTG. Fixes #6808
198cc19afb23f5d119318c88084451307faa143a
32d2f06f84ef7e423103f7653979554d3e85d44b
diff --git a/app/meson.build b/app/meson.build index d3336daae7..fd58098eb5 100644 --- a/app/meson.build +++ b/app/meson.build @@ -32,6 +32,7 @@ src = [ 'src/recorder.c', 'src/scrcpy.c', 'src/screen.c', + 'src/sdl_hints.c', 'src/server.c', 'src/texture.c', 'src/version.c', diff --git a/...
[ "app/meson.build", "app/src/scrcpy.c", "app/src/sdl_hints.c", "app/src/sdl_hints.h", "app/src/usb/scrcpy_otg.c" ]
[]
true
Genymobile/scrcpy
6,802
issue_to_patch
Allow window position or size setting to fail
Setting the window position can be denied, as observed in logs from https://github.com/Genymobile/scrcpy/pull/6772#issuecomment-4344753479: ERROR: Could not set window position: wayland cannot position non-popup windows Also do not assume window size setting succeeds. Refs <https://github.com/Genymobile/sc...
9d5e6d1c20130d5dd81f7ef2a2bff7e0e83d1695
dc5dba515b306b8095abc217f830daa5229dc0ee
diff --git a/app/src/util/sdl.c b/app/src/util/sdl.c index 84ce357d6d..858a2563af 100644 --- a/app/src/util/sdl.c +++ b/app/src/util/sdl.c @@ -79,8 +79,7 @@ void sc_sdl_set_window_size(SDL_Window *window, struct sc_size size) { bool ok = SDL_SetWindowSize(window, size.width, size.height); if (!ok) { - ...
[ "app/src/util/sdl.c" ]
[]
true
Genymobile/scrcpy
6,801
issue_to_patch
Where is the developer's public PGP key located? Dear Rom1v, Under each scrcpy release, there is an asc file for the checksums (SHA256SUMS.txt). Where is the public PGP key for verifying the asc file? Thank you!
Document release signature verification
Fixes #6800 Rendered: https://github.com/Genymobile/scrcpy/blob/doc-gpg/doc/verify-release.md
bf8bff430fc3dce9a443720b114544f297ea75ff
19c4d0b4e9d23d998a3aa6850066894c2f336f12
diff --git a/README.md b/README.md index 3eef095141..d784e746c2 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,7 @@ documented in the following pages: - [Translations][wiki] (not necessarily up to date) - [Build instructions](doc/build.md) - [Developers](doc/develop.md) + - [Verify release signatures](doc/...
[ "README.md", "doc/verify-release.md" ]
[]
true
Genymobile/scrcpy
6,794
issue_to_patch
Fix OpenGL runner shutdown deadlock
`OpenGLRunner.stopAndRelease()` posts work to its internal `HandlerThread`, so the thread must remain alive until the task completes. Otherwise, the method may never terminate. However, `OpenGLRunner.quit()` was called before `asyncProcessor.join()` (in particular before `SurfaceEncoder.join()`), allowing the runner...
a0057ef134bce474ffbd61b2176e769ee2584b44
5b220515c6b6c41a8ee676411b773f0f19481bb3
diff --git a/server/src/main/java/com/genymobile/scrcpy/Server.java b/server/src/main/java/com/genymobile/scrcpy/Server.java index e3f1680de8..d7d1a76ba8 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Server.java +++ b/server/src/main/java/com/genymobile/scrcpy/Server.java @@ -175,8 +175,6 @@ private static vo...
[ "server/src/main/java/com/genymobile/scrcpy/Server.java", "server/src/main/java/com/genymobile/scrcpy/opengl/OpenGLRunner.java" ]
[]
true
Genymobile/scrcpy
6,792
issue_to_patch
Add --keep-active
An an option to simulate user activity to prevent the screen from turning off due to inactivity. Fixes #6787 Supersedes #6789 --- Contrary to what I proposed here: https://github.com/Genymobile/scrcpy/pull/6789#issuecomment-4319038666 I didn't add a parameter to specify the interval duration. I think 4 secon...
b48feed0a024a3b24655de5e1532746fb526dd24
9b2498c852ad61bceb35a6c9b4a90b987b84ba56
diff --git a/app/data/bash-completion/scrcpy b/app/data/bash-completion/scrcpy index 3f4c649d37..0cae593a45 100644 --- a/app/data/bash-completion/scrcpy +++ b/app/data/bash-completion/scrcpy @@ -34,6 +34,7 @@ _scrcpy() { --gamepad= -h --help -K + --keep-active --keyboard= ...
[ "app/data/bash-completion/scrcpy", "app/data/zsh-completion/_scrcpy", "app/scrcpy.1", "app/src/cli.c", "app/src/options.c", "app/src/options.h", "app/src/scrcpy.c", "app/src/server.c", "app/src/server.h", "doc/device.md", "server/src/main/java/com/genymobile/scrcpy/Options.java", "server/src/m...
[ { "comment": "Should you also call `keepActiveThread.join()` in `Controller.join()`? Or you don't because it's a daemon thread?", "path": "server/src/main/java/com/genymobile/scrcpy/control/Controller.java", "hunk": "@@ -259,6 +293,9 @@ public void start(TerminationListener listener) {\n \n @Overrid...
true
Genymobile/scrcpy
6,792
comment_to_fix
Add --keep-active
Should you also call `keepActiveThread.join()` in `Controller.join()`? Or you don't because it's a daemon thread?
b48feed0a024a3b24655de5e1532746fb526dd24
9b2498c852ad61bceb35a6c9b4a90b987b84ba56
diff --git a/server/src/main/java/com/genymobile/scrcpy/control/Controller.java b/server/src/main/java/com/genymobile/scrcpy/control/Controller.java index e1d5387a0c..330eb0ff0f 100644 --- a/server/src/main/java/com/genymobile/scrcpy/control/Controller.java +++ b/server/src/main/java/com/genymobile/scrcpy/control/Contr...
[ "server/src/main/java/com/genymobile/scrcpy/control/Controller.java" ]
[ { "comment": "Should you also call `keepActiveThread.join()` in `Controller.join()`? Or you don't because it's a daemon thread?", "path": "server/src/main/java/com/genymobile/scrcpy/control/Controller.java", "hunk": "@@ -259,6 +293,9 @@ public void start(TerminationListener listener) {\n \n @Overrid...
true
Genymobile/scrcpy
6,788
issue_to_patch
Fix turning virtual display on via right-click
Since Android 14, it is possible to detect whether a virtual display is on. On right-click, turn the virtual display on if it is off (Android 14+ only).
242c7e9c298734e322b897b1c9ae6cdd258e3890
b48feed0a024a3b24655de5e1532746fb526dd24
diff --git a/server/src/main/java/com/genymobile/scrcpy/control/Controller.java b/server/src/main/java/com/genymobile/scrcpy/control/Controller.java index 38ead2cf1e..e1d5387a0c 100644 --- a/server/src/main/java/com/genymobile/scrcpy/control/Controller.java +++ b/server/src/main/java/com/genymobile/scrcpy/control/Contr...
[ "server/src/main/java/com/genymobile/scrcpy/control/Controller.java" ]
[]
true
Genymobile/scrcpy
6,771
issue_to_patch
Align the virtual display size
When the virtual display size is not aligned, a resize filter may be inserted to compensate for small dimension mismatches, increasing processing and resulting in a blurry image.
965d0e6856c63dbf474f89ec38e3dfa84a40ec44
266e2eaf149771682ddafe0f35c589ed47237a46
diff --git a/server/src/main/java/com/genymobile/scrcpy/model/Size.java b/server/src/main/java/com/genymobile/scrcpy/model/Size.java index 13c6c28856..385597a8a2 100644 --- a/server/src/main/java/com/genymobile/scrcpy/model/Size.java +++ b/server/src/main/java/com/genymobile/scrcpy/model/Size.java @@ -84,6 +84,15 @@ pu...
[ "server/src/main/java/com/genymobile/scrcpy/model/Size.java", "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java" ]
[ { "comment": "If I understand correctly, you want to avoid `filter.addResize(filteredSize)` below? If yes, then is there a reason not to do `displaySize = displayInfo.getSize().constrain(getVideoConstraints())` in order to match min/max constraints in addition to alignment?", "path": "server/src/main/java/c...
true
Genymobile/scrcpy
6,771
comment_to_fix
Align the virtual display size
If I understand correctly, you want to avoid `filter.addResize(filteredSize)` below? If yes, then is there a reason not to do `displaySize = displayInfo.getSize().constrain(getVideoConstraints())` in order to match min/max constraints in addition to alignment?
965d0e6856c63dbf474f89ec38e3dfa84a40ec44
266e2eaf149771682ddafe0f35c589ed47237a46
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java index 254eb9459e..e0ec2141fb 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java +++ b/server/src/main/java/com/genymobile/scrcp...
[ "server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java" ]
[ { "comment": "If I understand correctly, you want to avoid `filter.addResize(filteredSize)` below? If yes, then is there a reason not to do `displaySize = displayInfo.getSize().constrain(getVideoConstraints())` in order to match min/max constraints in addition to alignment?", "path": "server/src/main/java/c...
true
Genymobile/scrcpy
6,766
issue_to_patch
Replace retry-with-lower-resolution mechanism with video capabilities constraints
A mechanism was introduced to retry capture at a lower resolution to support devices unable to encode at the device screen resolution (#2947). While useful, this approach is inherently limited and will not be able to handle the dynamic resizing required for resizable virtual displays. Disable this mechanism e...
fd6536b34af024852b333fa28159cf743b8e245e
66005e88893f39dc995472def203f0c4bc9aa2b3
diff --git a/app/data/bash-completion/scrcpy b/app/data/bash-completion/scrcpy index eedbd5041e..3f4c649d37 100644 --- a/app/data/bash-completion/scrcpy +++ b/app/data/bash-completion/scrcpy @@ -56,7 +56,6 @@ _scrcpy() { --no-audio-playback --no-cleanup --no-clipboard-autosync - --no-d...
[ "app/data/bash-completion/scrcpy", "app/data/zsh-completion/_scrcpy", "app/scrcpy.1", "app/src/cli.c", "app/src/options.c", "app/src/options.h", "app/src/scrcpy.c", "app/src/server.c", "app/src/server.h", "doc/video.md", "server/src/main/java/com/genymobile/scrcpy/Options.java", "server/src/ma...
[ { "comment": "```suggestion\n```", "path": "server/src/main/java/com/genymobile/scrcpy/video/SurfaceCapture.java", "hunk": "@@ -83,13 +83,13 @@ public boolean isClosed() {\n }\n \n /**\n- * Return the video alignment\n+ * Return the video constraints.\n * <p>\n * This a power-o...
diff --git a/server/src/test/java/com/genymobile/scrcpy/device/SizeTest.java b/server/src/test/java/com/genymobile/scrcpy/device/SizeTest.java new file mode 100644 index 0000000000..954fcf9c83 --- /dev/null +++ b/server/src/test/java/com/genymobile/scrcpy/device/SizeTest.java @@ -0,0 +1,75 @@ +package com.genymobile.sc...
true
Genymobile/scrcpy
6,766
comment_to_fix
Replace retry-with-lower-resolution mechanism with video capabilities constraints
```suggestion ```
fd6536b34af024852b333fa28159cf743b8e245e
66005e88893f39dc995472def203f0c4bc9aa2b3
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/SurfaceCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/SurfaceCapture.java index 81da337b77..18633c84af 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/SurfaceCapture.java +++ b/server/src/main/java/com/genymobile/scrcpy/video/S...
[ "server/src/main/java/com/genymobile/scrcpy/video/SurfaceCapture.java" ]
[ { "comment": "```suggestion\n```", "path": "server/src/main/java/com/genymobile/scrcpy/video/SurfaceCapture.java", "hunk": "@@ -83,13 +83,13 @@ public boolean isClosed() {\n }\n \n /**\n- * Return the video alignment\n+ * Return the video constraints.\n * <p>\n * This a power-o...
true
Genymobile/scrcpy
6,766
comment_to_fix
Replace retry-with-lower-resolution mechanism with video capabilities constraints
```suggestion assert h <= maxHeight : "The height cannot exceed maxHeight"; ```
fd6536b34af024852b333fa28159cf743b8e245e
66005e88893f39dc995472def203f0c4bc9aa2b3
diff --git a/server/src/main/java/com/genymobile/scrcpy/device/Size.java b/server/src/main/java/com/genymobile/scrcpy/device/Size.java index b684a54e60..36161758ad 100644 --- a/server/src/main/java/com/genymobile/scrcpy/device/Size.java +++ b/server/src/main/java/com/genymobile/scrcpy/device/Size.java @@ -1,5 +1,7 @@ ...
[ "server/src/main/java/com/genymobile/scrcpy/device/Size.java" ]
[ { "comment": "```suggestion\n assert h <= maxHeight : \"The height cannot exceed maxHeight\";\n```", "path": "server/src/main/java/com/genymobile/scrcpy/device/Size.java", "hunk": "@@ -39,24 +39,38 @@ public Size constrain(VideoConstraints constraints) {\n assert alignment > 0 : \"Alignme...
true
Genymobile/scrcpy
6,766
comment_to_fix
Replace retry-with-lower-resolution mechanism with video capabilities constraints
This breaks the aspect ratio, is it desired?
fd6536b34af024852b333fa28159cf743b8e245e
66005e88893f39dc995472def203f0c4bc9aa2b3
diff --git a/server/src/main/java/com/genymobile/scrcpy/device/Size.java b/server/src/main/java/com/genymobile/scrcpy/device/Size.java index b684a54e60..36161758ad 100644 --- a/server/src/main/java/com/genymobile/scrcpy/device/Size.java +++ b/server/src/main/java/com/genymobile/scrcpy/device/Size.java @@ -1,5 +1,7 @@ ...
[ "server/src/main/java/com/genymobile/scrcpy/device/Size.java" ]
[ { "comment": "This breaks the aspect ratio, is it desired?", "path": "server/src/main/java/com/genymobile/scrcpy/device/Size.java", "hunk": "@@ -72,6 +72,15 @@ public Size constrain(VideoConstraints constraints) {\n assert w <= maxWidth : \"The width cannot exceed maxWidth\";\n assert h ...
true
Genymobile/scrcpy
6,766
comment_to_fix
Replace retry-with-lower-resolution mechanism with video capabilities constraints
There is an issue: `minCodecSize` must also be a multiple of `alignment`. However, while the max must be floored, the min must be ceiled (not just rounded). Of course this is assuming that the final `minSize` is not greater than `maxCodecSize.width` and `maxCodecSize.height`; maybe it would be good to assert it? It wou...
fd6536b34af024852b333fa28159cf743b8e245e
66005e88893f39dc995472def203f0c4bc9aa2b3
diff --git a/server/src/main/java/com/genymobile/scrcpy/device/Size.java b/server/src/main/java/com/genymobile/scrcpy/device/Size.java index b684a54e60..36161758ad 100644 --- a/server/src/main/java/com/genymobile/scrcpy/device/Size.java +++ b/server/src/main/java/com/genymobile/scrcpy/device/Size.java @@ -1,5 +1,7 @@ ...
[ "server/src/main/java/com/genymobile/scrcpy/device/Size.java" ]
[ { "comment": "There is an issue: `minCodecSize` must also be a multiple of `alignment`. However, while the max must be floored, the min must be ceiled (not just rounded). Of course this is assuming that the final `minSize` is not greater than `maxCodecSize.width` and `maxCodecSize.height`; maybe it would be goo...
true
Genymobile/scrcpy
6,776
issue_to_patch
Update protocol documentation
The protocol changed in commit 78cba1b7c29fe45057d180a183ce7efcd7044106. Update the documentation accordingly. Refs #6159
4bf8d14be7e6cb921b4d5717e5e7c870146a1bd0
6235289e77411d0a0a4bf67dfdad8ef7adedf5e8
diff --git a/doc/develop.md b/doc/develop.md index 002ec4b9ef..3bf69caa98 100644 --- a/doc/develop.md +++ b/doc/develop.md @@ -29,7 +29,7 @@ Similarly, if audio is enabled, then the server sends a raw audio stream (OPUS by default) of the device audio output (or the microphone if `--audio-source=mic` is specified), w...
[ "doc/develop.md" ]
[ { "comment": "If you want to be pedantic, maybe you should also change `scrcpy v2.0` to `scrcpy 2.0` at line 32?\n(The blog post writes it \"scrcpy 2.0\" so this would match.)", "path": "doc/develop.md", "hunk": "@@ -303,7 +303,7 @@ number of sockets, the order in which the sockets must be opened, the d...
true
Genymobile/scrcpy
6,776
comment_to_fix
Update protocol documentation
If you want to be pedantic, maybe you should also change `scrcpy v2.0` to `scrcpy 2.0` at line 32? (The blog post writes it "scrcpy 2.0" so this would match.)
4bf8d14be7e6cb921b4d5717e5e7c870146a1bd0
6235289e77411d0a0a4bf67dfdad8ef7adedf5e8
diff --git a/doc/develop.md b/doc/develop.md index 002ec4b9ef..3bf69caa98 100644 --- a/doc/develop.md +++ b/doc/develop.md @@ -29,7 +29,7 @@ Similarly, if audio is enabled, then the server sends a raw audio stream (OPUS by default) of the device audio output (or the microphone if `--audio-source=mic` is specified), w...
[ "doc/develop.md" ]
[ { "comment": "If you want to be pedantic, maybe you should also change `scrcpy v2.0` to `scrcpy 2.0` at line 32?\n(The blog post writes it \"scrcpy 2.0\" so this would match.)", "path": "doc/develop.md", "hunk": "@@ -303,7 +303,7 @@ number of sockets, the order in which the sockets must be opened, the d...
true
Genymobile/scrcpy
6,776
comment_to_fix
Update protocol documentation
```suggestion ``` `[codec metadata]` isn't referred to anymore but I don't know if you'd like to reinstate it somehow?
4bf8d14be7e6cb921b4d5717e5e7c870146a1bd0
6235289e77411d0a0a4bf67dfdad8ef7adedf5e8
diff --git a/doc/develop.md b/doc/develop.md index 002ec4b9ef..3bf69caa98 100644 --- a/doc/develop.md +++ b/doc/develop.md @@ -29,7 +29,7 @@ Similarly, if audio is enabled, then the server sends a raw audio stream (OPUS by default) of the device audio output (or the microphone if `--audio-source=mic` is specified), w...
[ "doc/develop.md" ]
[ { "comment": "```suggestion\n```\n`[codec metadata]` isn't referred to anymore but I don't know if you'd like to reinstate it somehow?", "path": "doc/develop.md", "hunk": "@@ -352,19 +352,41 @@ Then each socket is used for its intended purpose.\n \n ### Video and audio\n \n-On the _video_ and _audio_ so...
true
Genymobile/scrcpy
6,776
comment_to_fix
Update protocol documentation
```suggestion - media packet flag (`u1`) - config packet flag (`u1`) - key frame flag (`u1`) - PTS (`u61`) ``` New session/media packet flag and thus PTS is only 61 bits.
4bf8d14be7e6cb921b4d5717e5e7c870146a1bd0
6235289e77411d0a0a4bf67dfdad8ef7adedf5e8
diff --git a/doc/develop.md b/doc/develop.md index 002ec4b9ef..3bf69caa98 100644 --- a/doc/develop.md +++ b/doc/develop.md @@ -29,7 +29,7 @@ Similarly, if audio is enabled, then the server sends a raw audio stream (OPUS by default) of the device audio output (or the microphone if `--audio-source=mic` is specified), w...
[ "doc/develop.md" ]
[ { "comment": "```suggestion\n- media packet flag (`u1`)\n- config packet flag (`u1`)\n- key frame flag (`u1`)\n- PTS (`u61`)\n```\nNew session/media packet flag and thus PTS is only 61 bits.", "path": "doc/develop.md", "hunk": "@@ -352,19 +352,41 @@ Then each socket is used for its intended purpose.\n \...
true
Genymobile/scrcpy
6,782
issue_to_patch
Move feature-test macros to compiler flags
Feature test macros must be defined before any system header is included. Using `add_project_arguments()` guarantees this, and avoids redefinition warnings when they are already defined independently: In file included from ../app/src/compat.h:4, from ../app/src/compat.c:1: app/config.h...
12b129a17d5b2d575b6401c03ee4919393fd1e47
4bf8d14be7e6cb921b4d5717e5e7c870146a1bd0
diff --git a/app/meson.build b/app/meson.build index b0f6a37af6..adef66969b 100644 --- a/app/meson.build +++ b/app/meson.build @@ -67,11 +67,13 @@ src = [ 'src/util/timeout.c', ] -conf = configuration_data() +feature_test_macros = [ + '-D_GNU_SOURCE', + '-D_POSIX_C_SOURCE=200809L', + '-D_XOPEN_SOURCE=7...
[ "app/meson.build" ]
[]
true
Genymobile/scrcpy
6,780
issue_to_patch
Add MOD+q shortcut to quit
Fixes #6612
175134c0ca1d9018c14d10b467dbfcdff6d1c3be
12b129a17d5b2d575b6401c03ee4919393fd1e47
diff --git a/app/scrcpy.1 b/app/scrcpy.1 index a484de8487..8548646c31 100644 --- a/app/scrcpy.1 +++ b/app/scrcpy.1 @@ -695,6 +695,10 @@ device disconnects while a session is active, exit code 2 will be returned. In the following list, MOD is the shortcut modifier. By default, it's (left) Alt or (left) Super, but it c...
[ "app/scrcpy.1", "app/src/cli.c", "app/src/input_manager.c", "doc/shortcuts.md" ]
[]
true