Romain Vimont
1e085efcfc
Simplfy memcpy() parameters
...
Remove useless cast to `char *`, and use `SC_DEVICE_NAME_FIELD_LENGTH`
directly.
Refs #6744 <https://github.com/Genymobile/scrcpy/pull/6744 >
Refs #6875 <https://github.com/Genymobile/scrcpy/pull/6875 >
2026-05-29 08:45:12 +02:00
Romain Vimont
a351ff6669
Add static_assert for memcpy() size
...
This guarantees that the string resulting from `memcpy()` is safe:
- it copies to valid memory;
- it is null-terminated.
Refs #6744 <https://github.com/Genymobile/scrcpy/pull/6744 >
Refs #6875 <https://github.com/Genymobile/scrcpy/pull/6875 >
2026-05-29 08:38:15 +02:00
Romain Vimont
0bdd750447
Reject recording VP8 in MP4
...
Muxing VP8 into an MP4 container is not supported.
PR #6769 <https://github.com/Genymobile/scrcpy/pull/6769 >
2026-05-27 23:06:26 +02:00
Romain Vimont
58430b1c65
Fix VPx recording
...
Contrary to the other video codecs, a VP8 (and sometimes VP9) video
stream does not contain config packets.
PR #6769 <https://github.com/Genymobile/scrcpy/pull/6769 >
2026-05-27 23:06:26 +02:00
pngocthach
8ced132538
Add support for VP8 and VP9 video encoders
...
Fixes #6763 <https://github.com/Genymobile/scrcpy/issues/6763 >
PR #6769 <https://github.com/Genymobile/scrcpy/pull/6769 >
Signed-off-by: Romain Vimont <rom@rom1v.com >
2026-05-27 23:06:26 +02:00
Romain Vimont
f457fd4cf5
Apply encoder size constraints only after failure
...
The reported video encoder size constraints may be incorrect. Only apply
them if encoding fails at the requested size.
Refs #6829 <https://github.com/Genymobile/scrcpy/issues/6829 >
Fixes #6848 <https://github.com/Genymobile/scrcpy/issues/6848 >
PR 6859 <https://github.com/Genymobile/scrcpy/pull/6859 >
2026-05-27 21:31:35 +02:00
Romain Vimont
cf237f01c2
Inline video constraints creation
...
This will make the following commit easier to read.
PR #6859 <https://github.com/Genymobile/scrcpy/pull/6859 >
2026-05-27 21:31:35 +02:00
Romain Vimont
71c6bf4a87
Fix size constraints algorithm
...
The algorithm used to constrain a size according to the video
capabilities, implemented in #6766 , was too simplistic: it computed the
maximum landscape size by retrieving the maximum width and its
associated maximum height (and vice versa for the maximum portrait
size).
In addition to width and height, encoders are also constrained by a
maximum surface area (in blocks). As a result, it is possible for the
maximum width to be 4096 with an associated maximum height of 512, while
the encoder still supports 1600x1200.
In that case, the previous algorithm incorrectly considered 512 to be
the absolute maximum height in landscape mode.
Instead, determine the optimal supported size, defined as the largest
size with the same aspect ratio supported by the encoder. If preserving
the aspect ratio is not required (for virtual displays), then the
dimensions derived from this optimal size can be extended.
Refs #6849 comment <https://github.com/Genymobile/scrcpy/pull/6849#issuecomment-4502114417 >
Refs #6766 <https://github.com/Genymobile/scrcpy/pull/6766 >
Refs #6848 <https://github.com/Genymobile/scrcpy/issues/6848 >
Fixes #6829 <https://github.com/Genymobile/scrcpy/issues/6829 >
PR #6859 <https://github.com/Genymobile/scrcpy/pull/6859 >
2026-05-27 21:31:35 +02:00
Romain Vimont
4d79fb5b26
Improve protocol documentation schema
...
For consistency, name the "client resize" flag 'R' and add the "frame
header" arrow to make the schemas in `app/src/demuxer.c` and
`doc/develop.md` identical.
Refs #6772 comment <https://github.com/Genymobile/scrcpy/pull/6772#discussion_r3305729151 >
Refs #6772 comment <https://github.com/Genymobile/scrcpy/pull/6772#discussion_r3305729425 >
2026-05-27 21:30:51 +02:00
Romain Vimont
4954415cc3
Resize using the DPI from the local DisplayInfo
...
The `dpi` field is not synchronized, and the DPI to use is the one from
the latest `DisplayInfo`.
Refs #6772 comment <https://github.com/Genymobile/scrcpy/pull/6772#discussion_r3305727574 >
2026-05-27 19:09:05 +02:00
Romain Vimont
83c0e6a1a2
Fix call to size.constrain()
...
In flex display mode, constraining the size does not require preserving
the aspect ratio.
Refs #6822 comment <https://github.com/Genymobile/scrcpy/pull/6822#discussion_r3300069201 >
2026-05-26 08:01:26 +02:00
Romain Vimont
09a5c17b07
Include LICENSE file in release archives
...
PR #6854 <https://github.com/Genymobile/scrcpy/pull/6854 >
2026-05-22 21:07:47 +02:00
Romain Vimont
2892d4095a
Fix joystick list memory leak
...
In SDL3, listing the joysticks involves an allocation that must be
freed with `SDL_Free()`, which was missing during the migration to SDL3
from commit 02989249f6 .
PR #6853 <https://github.com/Genymobile/scrcpy/pull/6853 >
2026-05-19 20:13:38 +02:00
Romain Vimont
907aba2d79
Fix initial gamepad detection
...
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
02989249f6 .
Refs SDL/#15616 <https://github.com/libsdl-org/SDL/issues/15616 >
Fixes #6843 <https://github.com/Genymobile/scrcpy/issues/6843 >
PR #6853 <https://github.com/Genymobile/scrcpy/pull/6853 >
2026-05-19 20:13:38 +02:00
Romain Vimont
2c1f036b60
Log gamepad error
...
Call `SDL_GetError()` to know why opening a gamepad failed.
Refs #6843 <https://github.com/Genymobile/scrcpy/issues/6843 >
PR #6853 <https://github.com/Genymobile/scrcpy/pull/6853 >
2026-05-19 20:13:38 +02:00
Romain Vimont
610eff3414
Build SDL dependency in release mode
2026-05-17 12:37:19 +02:00
Romain Vimont
26d34e65e9
Build SDL dependency in parallel
...
Use parallel build jobs to sped up SDL dependency compilation.
2026-05-17 12:25:23 +02:00
Romain Vimont
95ae3bb17d
Fix SDL colorspace matching AVCOL_SPC_UNSPECIFIED
...
Use BT.709 color space when it is not specified.
Refs #6830 comment <https://github.com/Genymobile/scrcpy/issues/6830#issuecomment-4467327684 >
Fixes #6830 <https://github.com/Genymobile/scrcpy/issues/6830 >
2026-05-17 11:21:50 +02:00
Romain Vimont
2322868e9e
Update links to 4.0
v4.0
2026-05-12 21:35:47 +02:00
Romain Vimont
048c747cc1
Bump version to 4.0
2026-05-12 20:28:37 +02:00
Romain Vimont
a0917ad4cc
Upgrade SDL (3.4.8)
2026-05-12 20:14:06 +02:00
Romain Vimont
07a37bf98d
Upgrade FFmpeg (8.1.1)
2026-05-12 20:14:01 +02:00
Romain Vimont
5272360cd6
Add flex display usage example in README
2026-05-12 19:55:16 +02:00
Romain Vimont
2c3d5cbfd9
Remove experimental note for static builds
...
The static builds have been used for a long time, so the "experimental"
wording is no longer accurate.
2026-05-12 19:54:59 +02:00
Romain Vimont
fb54e442be
Add prominent download buttons in README
...
Make it easier for users to quickly find how to download the app.
2026-05-12 19:36:35 +02:00
Romain Vimont
d3ffab9d74
Add hacky workaround to fix Meta Quest flickering
...
Scrcpy captures the screen first using the `DisplayManager` API, and if
that fails, it falls back to the `SurfaceControl` API.
On the Meta Quest 3, `DisplayManager` initialization throws a
`RuntimeException` with the message:
createVirtualDisplay failed. See logcat for error
After this, scrcpy falls back to the `SurfaceControl` API, which starts
mirroring the screen.
The problem is that although `createVirtualDisplay()` throws a
`RuntimeException`, a mirroring session was started anyway.
Consequently, the fallback via `SurfaceControl` starts a second
mirroring session to the same Surface, causing flickering.
On Meta Quest, assume that the mirroring started successfully and create
a dummy virtual display instance that wraps the surface.
Refs #5913 comment <https://github.com/Genymobile/scrcpy/issues/5913#issuecomment-3677889916 >
Fixes #5913 <https://github.com/Genymobile/scrcpy/issues/5913 >
2026-05-12 18:54:42 +02:00
Romain Vimont
cd6343ee41
Fix manpage typos
...
Reported by:
mandoc -Tlint app/scrcpy.1
2026-05-12 09:43:30 +02:00
Romain Vimont
a34e121a2b
Update doc/develop.md links to latest version
...
Refs #6772 comment <https://github.com/Genymobile/scrcpy/pull/6772#issuecomment-4413041141 >
Refs #6776 comment <https://github.com/Genymobile/scrcpy/pull/6776#discussion_r3105677909 >
2026-05-12 00:12:26 +02:00
Jah-yee
19057b48af
Fix multiple issues in documentation
...
Fixes #6817 <https://github.com/Genymobile/scrcpy/issues/6817 >
PR #6819 <https://github.com/Genymobile/scrcpy/pull/6819 >
Signed-off-by: Romain Vimont <rom@rom1v.com >
2026-05-11 23:38:27 +02:00
Romain Vimont
d678988a5a
Merge branch 'master' into dev
2026-05-11 23:27:27 +02:00
Romain Vimont
5830dedbe4
Restore retry capture at lower resolution
...
The mechanism to retry capture at a lower resolution on error was
removed in favor of using video encoder capabilities instead.
However, an encoder configuration that is compatible with the declared
capabilities may still fail, either because the declared capabilities
are incorrect or because some resources are unavailable.
Restore the downsize-on-error behavior for such cases.
This reverts commit 4f97e2e30b .
Refs #2947 <https://github.com/Genymobile/scrcpy/pull/2947 >
Refs #6766 <https://github.com/Genymobile/scrcpy/pull/6766 >
PR #6822 <https://github.com/Genymobile/scrcpy/pull/6822 >
2026-05-11 23:06:57 +02:00
Romain Vimont
7ad637d991
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 [1], but the fix was removed by [2], along
with the removal of the mechanism to retry capture at a lower resolution
on error.
[1]: commit 07806ba915
[2]: commit 4f97e2e30b
Refs #3693 <https://github.com/Genymobile/scrcpy/issues/3693 >
Refs #6766 <https://github.com/Genymobile/scrcpy/pull/6766 >
PR #6822 <https://github.com/Genymobile/scrcpy/pull/6822 >
2026-05-11 23:05:31 +02:00
Romain Vimont
3fcb010823
Replace run-on-main-thread implementation
...
Use `SDL_RunOnMainThread()` introduced in SDL3.
PR #6816 <https://github.com/Genymobile/scrcpy/pull/6816 >
2026-05-10 16:17:38 +02:00
Romain Vimont
70e4078b02
Simplify main thread detection
...
Use `SDL_IsMainThread()` introduced in SDL3.
PR #6816 <https://github.com/Genymobile/scrcpy/pull/6816 >
2026-05-10 16:17:32 +02:00
Romain Vimont
91669808ed
Destroy objects after join()
...
This ensures that the objects are no longer used.
PR #6816 <https://github.com/Genymobile/scrcpy/pull/6816 >
2026-05-10 16:17:19 +02:00
Romain Vimont
f30bdeb1b9
Add missing call to net_cleanup()
...
The call was missing from 9b056f5091 .
PR #6816 <https://github.com/Genymobile/scrcpy/pull/6816 >
2026-05-10 16:16:25 +02:00
Romain Vimont
1db8da559f
Align the content rectangle to physical pixels
...
Centering unscaled content should not cause blurring due to pixel
misalignment.
PR #6772 <https://github.com/Genymobile/scrcpy/pull/6772 >
2026-05-09 17:28:52 +02:00
Romain Vimont
aecd902ea0
Fix physical vs logical size confusion
...
On a computer with a scale factor different from 1, physical and logical
sizes differ. For example, with a scale factor of 2, if the logical
(window) size is 800x600, the physical (renderer) size is 1600x1200.
They were not interpreted consistently in scrcpy.
To fix the confusion:
- resize the flex display according to the logical size
(SDL_EVENT_WINDOW_RESIZED);
- scale rendering to match the physical area defined by the logical
size;
- no longer convert input event coordinates.
This was not an issue before flex displays because rendering scaled the
content to fit the window (`--render-fit=letterbox`), so the difference
in physical size had no effect.
Refs #6772 comment <https://github.com/Genymobile/scrcpy/pull/6772#issuecomment-4360006349 >
PR #6772 <https://github.com/Genymobile/scrcpy/pull/6772 >
2026-05-09 17:28:52 +02:00
Romain Vimont
8691113682
Complete --max-size documentation
...
The `--max-size` option behaves slightly differently depending on the
mode.
Refs #6772 comment <https://github.com/Genymobile/scrcpy/pull/6772#issuecomment-4364562978 >
PR #6772 <https://github.com/Genymobile/scrcpy/pull/6772 >
2026-05-09 17:28:52 +02:00
Romain Vimont
9b4ede0919
Document render fit
...
PR #6772 <https://github.com/Genymobile/scrcpy/pull/6772 >
2026-05-09 17:28:52 +02:00
Romain Vimont
f9c9c25983
Add --render-fit=stretched
...
Add an option to fit the window without preserving the aspect ratio.
PR #6772 <https://github.com/Genymobile/scrcpy/pull/6772 >
2026-05-09 17:28:52 +02:00
Romain Vimont
f0b11a3d9e
Document flex display
...
PR #6772 <https://github.com/Genymobile/scrcpy/pull/6772 >
2026-05-09 17:28:52 +02:00
Romain Vimont
f2ee5b3d06
Skip aspect ratio preservation for flex displays
...
The size must be constrained by the video capabilities, but unlike
fixed displays, the aspect ratio should not be preserved in order to use
the maximum available area.
Refs #6772 comment <https://github.com/Genymobile/scrcpy/pull/6772#issuecomment-4321652487 >
PR #6772 <https://github.com/Genymobile/scrcpy/pull/6772 >
2026-05-09 17:28:52 +02:00
Romain Vimont
2dd31b814f
Ensure minimum codec size respects alignment
...
Make the minimum codec size respect the provided `--min-size-alignment`
value.
Refs #6766 comment <https://github.com/Genymobile/scrcpy/pull/6766#discussion_r3133194910 >
PR #6772 <https://github.com/Genymobile/scrcpy/pull/6772 >
2026-05-09 17:28:52 +02:00
Romain Vimont
0d73d84f84
Never increase dimensions when applying alignment
...
Previously, the minor dimension was rounded to the nearest multiple of
the alignment requirement when constraining size. This could result in
the dimension being increased.
Change the behavior to always round down instead, ensuring the
constrained size never grows.
This fixes a conflict with the client-side "optimal window size"
computation, which never increases dimensions. With flex displays, the
old behavior could lead to feedback loop between window and display
resizing with mismatched dimensions:
- window resized to 2341x1317
- display resized to 2340x1318
- window resized to 2338x1317
- display resized to 2336x1318
PR #6772 <https://github.com/Genymobile/scrcpy/pull/6772 >
2026-05-09 17:28:52 +02:00
Romain Vimont
01d49a24f8
Extract align() function
...
PR #6772 <https://github.com/Genymobile/scrcpy/pull/6772 >
2026-05-09 17:28:52 +02:00
Romain Vimont
3d78b5d8ed
Flip comparison operands for readability
...
Refs #6772 comment <https://github.com/Genymobile/scrcpy/pull/6772#discussion_r3171106432 >
PR #6772 <https://github.com/Genymobile/scrcpy/pull/6772 >
2026-05-09 17:28:52 +02:00
Romain Vimont
ca7130bb27
Ignore frame-triggered resize events
...
Track resize requests caused by frame-size changes to avoid sending
incorrect "resize display" requests to the server.
PR #6772 <https://github.com/Genymobile/scrcpy/pull/6772 >
2026-05-09 17:28:52 +02:00
Romain Vimont
4474d17807
Fix rotated virtual display size detection
...
The physical size of the virtual display does not change when the
display is rotated, although the reported display size does.
Refs #6772 comment <https://github.com/Genymobile/scrcpy/pull/6772#pullrequestreview-4238019023 >
PR #6772 <https://github.com/Genymobile/scrcpy/pull/6772 >
2026-05-09 17:28:52 +02:00
Romain Vimont
9c4d2bbfc2
Add resizable virtual display feature
...
Introduce `--flex-display` (or `-x`) to continuously resize the virtual
display to match the window.
Fixes #6632 <https://github.com/Genymobile/scrcpy/issues/6632 >
PR #6772 <https://github.com/Genymobile/scrcpy/pull/6772 >
2026-05-09 17:28:52 +02:00