Commit graph

2837 commits

Author SHA1 Message Date
Romain Vimont
13fc75902a Merge branch 'master' into release 2025-06-11 19:39:09 +02:00
Romain Vimont
454beaa757 Upgrade libusb (1.0.29) 2025-06-11 19:39:02 +02:00
Romain Vimont
1a9ffb3814 Upgrade SDL (2.32.8) 2025-06-11 19:38:29 +02:00
Romain Vimont
ac16be54c8 Upgrade platform-tools (36.0.0) 2025-06-11 19:36:22 +02:00
Romain Vimont
8a02e3c2f5 Simplify ClipboardManager wrapper
Use the public ClipboardManager API, with the FakeContext as context.

This requires a running main looper, otherwise clipboard changes are not
processed.

Refs #6009 <https://github.com/Genymobile/scrcpy/pull/6009>
PR #6129 <https://github.com/Genymobile/scrcpy/pull/6129>

Suggested by: Simon Chan <1330321+yume-chan@users.noreply.github.com>
2025-06-11 17:47:37 +02:00
Romain Vimont
283326b2f6 Run a main looper
Instead of blocking the main thread until completion, run a looper.

This will allow the main thread to process any event posted to the main
looper.

Refs #6009 comment <https://github.com/Genymobile/scrcpy/pull/6009#issuecomment-2940810736>
PR #6129 <https://github.com/Genymobile/scrcpy/pull/6129>
2025-06-11 17:47:07 +02:00
Simon Chan
ca4f50c5ef Associate UHID devices to virtual displays
This allows the mouse pointer to appear on the correct display (only for
devices running Android 15+).

Fixes #5547 <https://github.com/Genymobile/scrcpy/issues/5547>
PR #6009 <https://github.com/Genymobile/scrcpy/pull/6009>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2025-06-05 20:34:11 +02:00
Romain Vimont
7a3fe830d4 Synchronize access to DisplayManager
The DisplayManager and its method getDisplayInfo() may be used from both
the Controller thread and the video (main) thread.

PR #6009 <https://github.com/Genymobile/scrcpy/pull/6009>
2025-06-05 20:34:11 +02:00
Romain Vimont
ee414231ed Cache getDisplayInfo method
Do not use reflection to retrieve the method for every call.

PR #6009 <https://github.com/Genymobile/scrcpy/pull/6009>
2025-06-05 20:34:11 +02:00
Simon Chan
41ed40f5f9 Simplify InputManager wrapper
Use the public InputManager API.

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

Signed-off-by: Romain Vimont <rom@rom1v.com>
2025-06-05 20:34:11 +02:00
Colin Kinloch
d2cc930975 Add app name SDL hint
This allows pulseaudio to label the audio stream "scrcpy" rather than
"SDL Application".

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

Signed-off-by: Romain Vimont <rom@rom1v.com>
2025-06-05 19:59:59 +02:00
Romain Vimont
52f5d08d1f Avoid calling wait(0)
Calling wait(0) results in waiting without a timeout, which is
unintended.

Refs #6009 comment <https://github.com/Genymobile/scrcpy/pull/6009#issuecomment-2935930294>
2025-06-03 21:15:11 +02:00
Romain Vimont
70bfa2cf39 Remove useless flag in zsh completion script
The -N flag is only useful after a pattern section (-p) to switch back
to listing command names.

Refs <https://zsh.sourceforge.io/Doc/Release/Completion-System.html>
2025-05-22 20:00:58 +02:00
hltdev8642
38f779d9d3 Escape parentheses in zsh completion script
PR #6079 <https://github.com/Genymobile/scrcpy/pull/6079>

Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2025-05-22 20:00:53 +02:00
Romain Vimont
8cd63cb63e Report specific error for INJECT_EVENT permission
Some devices require a specific option to be enabled in Developer
Options to avoid a permission issue when injecting input events.

When this error occurs, hide the stack trace and print a human-readable
message explaining how to fix the issue.

PR #6080 <https://github.com/Genymobile/scrcpy/pull/6080>
2025-05-15 19:52:52 +02:00
Romain Vimont
cc309a2b34 Build static linux binary on Ubuntu 22.04
Ubuntu 20.04 is no longer available on GitHub Actions.

Refs <https://github.com/actions/runner-images/issues/11101>
Refs #6050 <https://github.com/Genymobile/scrcpy/pull/6050>

This reverts commit 69858c6f43.
2025-05-02 11:39:47 +02:00
Romain Vimont
91a4a74641 Move regex pattern initialization
If text == null, then the Pattern is not used.
2025-04-25 10:24:07 +02:00
Romain Vimont
48f38c4bb6 Fix default locked capture orientation
The default landscape locked orientation was reversed.

Fixes #6010 <https://github.com/Genymobile/scrcpy/issues/6010>
2025-04-24 16:12:28 +02:00
Romain Vimont
6875e9aa88 Revert "Fix AudioRecord package name for Android 16"
This reverts commit c27d116a66.

This commit breaks audio on Android 16 beta 4.

Refs #5960 comment <https://github.com/Genymobile/scrcpy/issues/5960#issuecomment-2816608015>
Fixes #6021 <https://github.com/Genymobile/scrcpy/issues/6021>
2025-04-24 16:05:13 +02:00
Nicholas Wilson
c5ed2cfc28 Replace "licence" with "license" in README
Although "licence" is correct in British English, the rest of the
statement uses "license," so change it for consistency.

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

Signed-off-by: Romain Vimont <rom@rom1v.com>
2025-04-19 10:30:29 +02:00
Romain Vimont
1a0d300786 Add missing --screen-off-timeout doc in manpage
Refs eff5b4b219
2025-04-14 18:07:37 +02:00
Romain Vimont
d2447b5c19 Fix --screen-off-timeout bash completion
Only the option must be auto-completed, not its value.
2025-04-14 18:05:08 +02:00
Romain Vimont
5900e9e39c Remove irrelevant link in FAQ 2025-04-07 10:30:56 +02:00
Romain Vimont
882003f314 Fix segfault on SDL event without window
Since #5804, controls have been enabled even with --no-window. As a
result, the Android clipboard is synchronized with the computer, causing
SDL to trigger an SDL_CLIPBOARDUPDATE event.

This event is ignored by scrcpy, but it was still transmitted to the
sc_screen instance, even if it had not been initialized.

Fix the issue by calling sc_screen_handle_event() only when a screen
instance exists.

Refs #5804 <https://github.com/Genymobile/scrcpy/pull/5804>
Fixes #5970 <https://github.com/Genymobile/scrcpy/issues/5970>
2025-04-03 08:15:55 +02:00
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):
 - <https://android.googlesource.com/platform/frameworks/av/+/7c4e6991acdf8d110e9b00d144863c3c4823bc43/services/audiopolicy/permission/NativePermissionController.cpp#129>
 - <https://android.googlesource.com/platform/frameworks/av/+/7c4e6991acdf8d110e9b00d144863c3c4823bc43/services/audiopolicy/permission/NativePermissionController.cpp#40>

Refs <https://android.googlesource.com/platform/frameworks/av/+/9f91a5eebb4520b9333576e946b3911d0f946a04%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