Commit graph

2813 commits

Author SHA1 Message Date
Romain Vimont
db9dc6ae83 Make the snap version as obsolete
The version of scrcpy packaged in snap is currently 1.25.

Refs <https://snapcraft.io/scrcpy>
2025-04-01 11:04:34 +02:00
Romain Vimont
e0f37f834b Update links to 3.2 2025-03-29 16:15:14 +01:00
Romain Vimont
89b624770c Bump version to 3.2 2025-03-29 15:45:28 +01:00
Romain Vimont
79227af89f Merge branch 'master' into release 2025-03-29 15:44:29 +01:00
Romain Vimont
5d12d9071d Upgrade FFmpeg (7.1.1) 2025-03-29 15:34:48 +01:00
Romain Vimont
b7add42154 Upgrade SDL (2.32.2)
Also apply this additional patch to fix the build:
<6be87ceb33>
2025-03-29 15:34:20 +01:00
Romain Vimont
dd1bfae4e0 Upgrade libusb (1.0.28) 2025-03-29 15:02:38 +01:00
Romain Vimont
bef2d8473b Add more audio sources
Expose more audio sources from MediaRecorder.AudioSource.

Refs <https://developer.android.com/reference/android/media/MediaRecorder.AudioSource>

Fixes #5412 <https://github.com/Genymobile/scrcpy/issues/5412>
Fixes #5670 <https://github.com/Genymobile/scrcpy/issues/5670>
PR #5870 <https://github.com/Genymobile/scrcpy/pull/5870>
2025-03-29 14:54:35 +01:00
Romain Vimont
609719bde0 Refactor audio sources
Store the target audio source integer (one of the constants from
android.media.MediaRecorder.AudioSource) in the AudioSource enum (or -1
if not relevant).

This will simplify adding new audio sources.

PR #5870 <https://github.com/Genymobile/scrcpy/pull/5870>
2025-03-29 14:54:35 +01:00
Romain Vimont
3a0703f428 Handle audio stream discontinuities
The audio regulator assumed a continuous audio stream. But some audio
sources (like the "voice call" audio source) do not produce any packets
on silence, breaking this assumption.

Use PTS to detect such discontinuities.

PR #5870 <https://github.com/Genymobile/scrcpy/pull/5870>
2025-03-29 14:54:35 +01:00
Romain Vimont
245981281e Fix PTS produced by the default opus/flac encoders
The default OPUS and FLAC encoders on Android rewrite the input PTS so
that they exactly match the number of samples.

As a consequence:
 - audio clock drift is not compensated
 - implicit silences (without packets) are ignored

To work around this behavior, generate new PTS based on the current time
(after encoding) and the packet duration.

PR #5870 <https://github.com/Genymobile/scrcpy/pull/5870>
2025-03-29 14:45:05 +01:00
Romain Vimont
1d25338119 Report underflow samples in verbose mode
Report the number of silence samples inserted due to underflow every
second, along with the other metrics.

PR #5870 <https://github.com/Genymobile/scrcpy/pull/5870>
2025-03-29 14:40:52 +01:00
Romain Vimont
457c7fe5cf Disable audio regulator underflow logs
Only enable them if SC_AUDIO_REGULATOR_DEBUG is set, as they may spam
the output.

PR #5870 <https://github.com/Genymobile/scrcpy/pull/5870>
2025-03-29 14:39:43 +01:00
Romain Vimont
7998811fa5 Mention that no Android app is required 2025-03-09 21:16:17 +01:00
Romain Vimont
7044122fc5 Simplify wording in README 2025-03-09 21:10:21 +01:00
Romain Vimont
c63d9e1803 Work around broken display listener on Android 15
A recent Android 15 upgrade broke the display listener (again). Use the
alternative method for Android >= 14.

Fixes #5908 <https://github.com/Genymobile/scrcpy/issues/5908>
2025-03-07 18:40:28 +01:00
Romain Vimont
d892a9aac5 Disable checkstyle line length warning
Checkstyle reports a warning because the line containing a long URL is
more than 150 characters. But we can't split the URL, so disable the
warning.
2025-02-22 12:22:45 +01:00
chengjian.scj
fd8bef68b7 Add --display-ime-policy option
Add an option to select where the IME should be displayed.

Possible values are "local", "fallback" and "hide".

PR #5703 <https://github.com/Genymobile/scrcpy/pull/5703>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2025-02-22 11:05:22 +01:00
Sam Listopad II
986328ff9e Allow controls with --no-window
Without a window, mouse and keyboard events may not be received, but
the control channel is still necessary for other features:

 * --turn-screen-off
 * --stay-awake
 * --show-touches
 * --power-off-on-close
 * --start-app

Fixes #5803 <https://github.com/Genymobile/scrcpy/issues/5803>
PR #5804 <https://github.com/Genymobile/scrcpy/pull/5804>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2025-01-31 10:11:17 +01:00
Romain Vimont
0ba9d35705 Mention virtual display destruction
The new virtual display does not persist after scrcpy exits.
2025-01-15 10:54:57 +01:00
Romain Vimont
cac8e9c821 Happy new year 2025! 2025-01-01 15:01:18 +01:00
Jaime J. Denizard
1c7680f689 Fix some grammatical issues in documentation
PR #5722 <https://github.com/Genymobile/scrcpy/pull/5722>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2025-01-01 14:59:11 +01:00
Simon Chan
c27d116a66 Fix AudioRecord package name for Android 16
Since commit 9f91a5eebb4520b9333576e946b3911d0f946a04 in frameworks/av
(AOSP), an AudioRecord can be created only if the declared package name
in the AttributionSource is "shell" (for the shell UID):
 - <7c4e6991ac/services/audiopolicy/permission/NativePermissionController.cpp (129)>
 - <7c4e6991ac/services/audiopolicy/permission/NativePermissionController.cpp (40)>

Refs <9f91a5eebb%5E%21/>
Fixes #5698 <https://github.com/Genymobile/scrcpy/issues/5698>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2024-12-23 19:41:25 +01:00
Romain Vimont
eac711ace6 Remove unused rotation and fold listeners
IRotationWatcher and IDisplayFoldListener are no longer used since
commit 39d51ff2cc.
2024-12-23 12:51:27 +01:00
Romain Vimont
af15c72f9c Cleanup includes
Improved manually with the help of neovim LSP warnings and iwyu:

    iwyu -Ibuilddir/app/ -Iapp/src/ app/src/XXX.c
2024-12-23 12:19:47 +01:00
Simon Chan
5b1229a55f Support older macOS versions in CI build
Fixes #5649 <https://github.com/Genymobile/scrcpy/issues/5649>
Fixes #5697<https://github.com/Genymobile/scrcpy/pull/5697>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2024-12-23 11:58:06 +01:00
Romain Vimont
69858c6f43 Build static linux binary on Ubuntu 20.04
Use the oldest Ubuntu version currently available in GitHub Actions to
ensure maximum compatibility with older systems.

Refs 95c4f03c1b
Refs #5689 <https://github.com/Genymobile/scrcpy/issues/5689>
2024-12-23 11:01:42 +01:00
Romain Vimont
e0423653c8 Remove useless null check
The method CameraManager.getCameraIdList() is annotated with @NonNull.

This fixes a warning reported by Android Studio.
2024-12-23 10:58:59 +01:00
Romain Vimont
5387644160 Ignore low-FPS ranges if not available
Do not report an error if the returned FPS ranges array is null.

Refs #5669 <https://github.com/Genymobile/scrcpy/pull/5669>
2024-12-22 21:17:51 +01:00
Simon Chan
2f44da76f4 Filter out non-backward-compatible cameras
PR #5669 <https://github.com/Genymobile/scrcpy/pull/5669>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2024-12-22 21:17:05 +01:00
Romain Vimont
95c4f03c1b Build static linux binary on Ubuntu 22.04
On Github Actions, ubuntu-latest now points to ubuntu-24.04, which uses
a newer version of glibc (2.39). As a result, the binaries fail to work
on systems with older versions of glibc, such as Debian Bookworm.

To ensure better compatibility, continue building the static Linux
binary on Ubuntu 22.04 (with glibc 2.35).

Fixes #5689 <https://github.com/Genymobile/scrcpy/issues/5689>
2024-12-22 15:49:46 +01:00
Romain Vimont
fb47b87eeb Fix pipe read return value
The function incorrectly returned false, whereas its return type is
ssize_t.
2024-12-20 20:57:20 +01:00
Markus
5ae01749bf Reintroduce WinGet install note
This semantically reverts c27ab46efb.

WinGet package has been fixed by:
<https://github.com/microsoft/winget-pkgs/pull/196442>

Refs #4027 <https://github.com/Genymobile/scrcpy/issues/4027>
PR #5686 <https://github.com/Genymobile/scrcpy/pull/5686>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2024-12-19 18:34:20 +01:00
Romain Vimont
1fd57ede1f Move "screen off timeout" section in documentation
Place the "screen off timeout" section right after "stay awake", as they
serve a similar purpose.
2024-12-17 13:09:24 +01:00
Romain Vimont
48fc18e380 Add must-know tips
All users should be aware of the main shortcuts and the most important
setting to improve performance.
2024-12-17 12:24:50 +01:00
Romain Vimont
ea6a94d355 Fix mouse documentation formatting
Make the format consistent with the shortcuts documentation.
2024-12-17 12:21:57 +01:00
Romain Vimont
dc2fcc46f5 Add workaround for Pico 4 Ultra
Make ActivityThread.isSystem() return true to avoid a
NullPointerException later.

Refs #5659 comment <https://github.com/Genymobile/scrcpy/issues/5659#issuecomment-2540963953>
Fixes #5659 <https://github.com/Genymobile/scrcpy/issues/5659>
2024-12-14 10:27:38 +01:00
Romain Vimont
69264703b1 Add missing comments in workarounds
The implementation of workarounds uses a lot of reflection code. For
better readability, always write the equivalent using direct Java code.
2024-12-14 10:27:38 +01:00
Colin Kinloch
ec4e826976 Set icon and server env paths for meson devenv
This allows users to compile and run the project in a dev environment.

    meson setup x
    meson compile -C x
    meson devenv -C x
    scrcpy

This is an alternative to `./run x`.

PR #5658 <https://github.com/Genymobile/scrcpy/pull/5658>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2024-12-12 18:15:26 +01:00
Romain Vimont
17e205e54f Replace meson join_paths() by '/'
A new '/' operator was introduced in Meson 0.49 to replace join_paths():
 - <https://mesonbuild.com/Reference-manual_functions.html#join_paths>
 - <https://mesonbuild.com/Syntax.html#string-path-building>

Refs #5658 <https://github.com/Genymobile/scrcpy/pull/5658>
2024-12-12 18:15:26 +01:00
Romain Vimont
f751274b17 Define both pkg-config and pkgconfig for meson
In Meson cross-files, "pkgconfig" was deprecated in favor of
"pkg-config" in meson 1.3.0.

The new name is used since 85a94dd4b5 to
avoid a warning, but then it fails with older versions of meson.

To avoid the problem, define both pkg-config and pkgconfig.

> For backward compatibility it is still allowed to define both with the
> same value, in that case no deprecation warning is printed.

<https://mesonbuild.com/Release-notes-for-1-3-0.html#machine-files-pkgconfig-field-deprecated-and-replaced-by-pkgconfig>
2024-12-12 18:09:31 +01:00
Romain Vimont
6469054b15 Revert "Remove apt update on GitHub Actions"
This reverts commit 678025b316.

This avoids spurious errors on the CI:

    E: Unable to fetch some archives, maybe run apt-get update or try
    with --fix-missing?
2024-12-12 18:09:31 +01:00
Romain Vimont
0e2d084751 Update links to 3.1 2024-12-09 22:42:34 +01:00
Romain Vimont
754f4fc6fe Bump version to 3.1 2024-12-09 22:29:51 +01:00
Romain Vimont
aca6d30af5 Include dav1d in releases
Scrcpy supports AV1, but no decoder was provided in binary releases.

Include dav1d:
 - <https://www.videolan.org/projects/dav1d.html>
 - <https://code.videolan.org/videolan/dav1d>

Fixes #4744 <https://github.com/Genymobile/scrcpy/issues/4744>
PR #5644 <https://github.com/Genymobile/scrcpy/pull/5644>
2024-12-09 19:07:18 +01:00
Romain Vimont
f2018e026c Remove broken macOS flags
Due to a typo (a space was missing before the second '-L'), the
resulting LDFLAGS value was broken:

    "-L/opt/homebrew/opt/zlib/lib-L/opt/homebrew/opt/libiconv/lib"

This proves that the flag was useless. Remove it.

Refs #5517 comment <https://github.com/Genymobile/scrcpy/pull/5517#issuecomment-2495522201>
PR #5644 <https://github.com/Genymobile/scrcpy/pull/5644>
2024-12-09 19:07:03 +01:00
Simon Chan
a507b4f559 Fix DisplayControl classpath
Use the full system server classpath to load DisplayControl, so that
turning the screen off on Android 14+ does not crash on certain devices.

Refs #4544 comment <https://github.com/Genymobile/scrcpy/issues/4544#issuecomment-2526999714>
Fixes #4544 <https://github.com/Genymobile/scrcpy/issues/4544>
Fixes #5274 <https://github.com/Genymobile/scrcpy/issues/5274>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2024-12-09 10:29:20 +01:00
Romain Vimont
a9aadc95df Start cleanup process with setsid()
Reimplement c59a3c3169 using Os.setsid().

Refs #5613 comment <https://github.com/Genymobile/scrcpy/pull/5613#issuecomment-2527045669>

Suggested-by: Simon Chan <1330321+yume-chan@users.noreply.github.com>
2024-12-09 09:33:08 +01:00
Romain Vimont
28b5bfb90e Revert "Start cleanup process with setsid or nohup"
This reverts commit c59a3c3169.

The next commit will use Os.setsid() instead.
2024-12-09 09:29:29 +01:00
Romain Vimont
65256d7cc7 Upgrade SDL (2.30.10) 2024-12-08 18:17:07 +01:00