Commit Graph

2408 Commits (master)
 

Author SHA1 Message Date
Romain Vimont 67f356f881 Improve crossbuild
Install all the prebuilt dependencies for Windows to a specific folder,
and use meson command line options to specify their location.

This removes crossbuild-specific code from the meson scripts and will
simplify dependency upgrades.

PR #4460 <https://github.com/Genymobile/scrcpy/pull/4460>
5 months ago
Romain Vimont c573bd2a33 Fix java code style 5 months ago
sam80180 acb2988837 Do not hardcode server path on the device
The path can be retrieved from the classpath.

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

Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
5 months ago
Romain Vimont 85a94dd4b5 Fix meson deprecated 'pkgconfig' to 'pkg-config'
When running ./release.sh:

> DEPRECATION: "pkgconfig" entry is deprecated and should be replaced by
> "pkg-config"
5 months ago
Romain Vimont 94031dfe97 Update documentation about video orientation
PR #4441 <https://github.com/Genymobile/scrcpy/pull/4441>
5 months ago
Romain Vimont b43a9e8e7a Add --orientation
Add a shortcut to set both the display and record orientations.

PR #4441 <https://github.com/Genymobile/scrcpy/pull/4441>
5 months ago
Romain Vimont a9d6cb5837 Add --record-orientation
Add an option to store the orientation to apply in a recorded file.

Only rotations are supported (not flips).

PR #4441 <https://github.com/Genymobile/scrcpy/pull/4441>
5 months ago
Romain Vimont 2f92686930 Pass --lock-video-orientation argument in degrees
For consistency with the new --display-orientation option, express the
--lock-video-orientation in degrees clockwise:

 * --lock-video-orientation=0 -> --lock-video-orientation=0
 * --lock-video-orientation=3 -> --lock-video-orientation=90
 * --lock-video-orientation=2 -> --lock-video-orientation=180
 * --lock-video-orientation=1 -> --lock-video-orientation=270

PR #4441 <https://github.com/Genymobile/scrcpy/pull/4441>
5 months ago
Romain Vimont bb88b60227 Add --display-orientation
Deprecate the option --rotation and introduce a new option
--display-orientation with the 8 possible orientations (0, 90, 180, 270,
flip0, flip90, flip180 and flip270).

New shortcuts MOD+Shift+(arrow) dynamically change the display
(horizontal or vertical) flip.

Fixes #1380 <https://github.com/Genymobile/scrcpy/issues/1380>
Fixes #3819 <https://github.com/Genymobile/scrcpy/issues/3819>
PR #4441 <https://github.com/Genymobile/scrcpy/pull/4441>
5 months ago
Romain Vimont 25e33566f5 Mention turning off audio in camera documentation 6 months ago
Romain Vimont 9df92ebe37 Fix manpage style syntax 6 months ago
Romain Vimont 0801cf0627 Fix options alphabetical order
Renaming --display to --display-id broke the alphabetical order.

Refs 23e116064d
6 months ago
Romain Vimont 4658c0e5d2 Update record format error message
Recording now supports formats other than mp4 and mkv.

Refs e637feba51
6 months ago
Romain Vimont 45a073a333 Do not create Device instance for camera
The device instance manages the display and the injection of input
events. It is not necessary for camera capture.
6 months ago
Romain Vimont 7e3b935932 Recreate the display on rotation
On Android 14 (Pixel 8), a device rotation while the camera app was
running resulted in an incorrect capture.

Destroying and recreating the display fixes the issue.
6 months ago
Romain Vimont abcb100597 Upgrade Android SDK to 34 6 months ago
Romain Vimont e8801cc3c0 Upgrade AGP (8.1.3) and Gradle to 8.4
Android Gradle Plugin 8.1.3.
Gradle 8.4.

From now on, Java 17 is required.
6 months ago
Romain Vimont 86808e8114 Upgrade Android checkstyle to 10.12.5
Upgrade to the latest version.
6 months ago
Romain Vimont 15a3bad4ab Log PTS fixing at debug level
Audio PTS are retrieved by AudioRecord.getTimestamp(), so they do not
necessarily exactly match the number of samples (this allows to take
drift and lag into account).

As a consequence, two consecutive timestamps in microseconds may
sometimes end up within the same millisecond, causing the warning. This
is particularly true for the Matroska muxer which uses a timebase of
1/1000 (1 ms precision).

Since this is "expected", lower the log level from warning to debug.
6 months ago
Romain Vimont 200488111e Add support for RAW audio (WAV) recording
RAW audio forwarding was supported but not for recording.

Add support for recording a raw audio stream to a `.wav` file (and
`.mkv`).
6 months ago
Romain Vimont 1713422c13 Upgrade FFmpeg build to 6.1-scrcpy-2
Use a build with WAV muxer.
6 months ago
Romain Vimont 4b4f045e19 Fix audio PTS by the duration of 1 sample
If the difference of PTS between two consecutive blocks of audio is less
than 1 sample, then it will be considered as non-increasing by FFmpeg
muxers having a time_base of 1/sample_rate.

Increase the PTS by 1 sample instead.
6 months ago
Romain Vimont a402eac7f2 Compute PTS of intermediate blocks
If several reads are performed for a single captured audio block (e.g.
if the read size is smaller than the captured block), then the provided
timestamp was the same for all packets.

Recompute the timestamp for each of them.
6 months ago
Romain Vimont 3bb6b0cb9f Read audio by blocks of 1024 samples
In practice, the system captures audio samples by blocks of 1024
samples.

Remplace the hardcoded value of 5 milliseconds (240 samples), and let
AudioRecord fill the input buffer provided by MediaCodec (or by
AudioRawRecorder), with a maximum size of 1024 samples (just in case).
6 months ago
Romain Vimont 258eaaae2a Increase default audio buffer for FLAC
FLAC is not low latency: the default encoder produces blocks of 4096
samples, which represent ~85.333ms.

Increase the audio buffer by default so that audio playback works.
6 months ago
megapro17 4857c5dd59 Add support for FLAC audio codec
PR #4410 <#https://github.com/Genymobile/scrcpy/pull/4410>

Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
6 months ago
Romain Vimont f23be823fd Upgrade FFmpeg build to 6.1-scrcpy
Upgrade to FFmpeg 6.1, and with FLAC support enabled.
6 months ago
Romain Vimont 783719c72e Fix OPUS packet in an endian-independent way
Reading the header id as an int assumed that the current endianness was
little endian. Read to a byte array to remove this assumption.
6 months ago
Romain Vimont 80defdd8aa Suppress private APIs lints to Workarounds class
The whole class need them (including the static block).
6 months ago
Romain Vimont e637feba51 Update muxers documentation
Recording now supports formats other than mp4 and mkv.
6 months ago
Romain Vimont 5e59ed3135 Always initialize SDL with the video subsystem
Clipboard synchronization requires SDL_INIT_VIDEO, so always initialize
the video subsystem, even if --no-video or --no-video-playback is
passed.

Refs caf594c90e
Fixes #4418 <https://github.com/Genymobile/scrcpy/issues/4418>
6 months ago
Romain Vimont 4eb33054cd Do not log EPIPE on close for raw audio
Handle EPIPE the same way in AudioRawRecorder as in AudioEncoder.

This prevents useless errors on close.
6 months ago
Romain Vimont 420d3a40dd Fix error handling in raw audio recorder
It is incorret to ever call:

    streamer.writeDisableStream(...);

after:

    streamer.writeAudioHeader();

Move the try-catch block so that it can never happen.
6 months ago
Romain Vimont 9d5f53caa7 Stop capture on any RAW audio error
The server was stopped only if an IOException occurred during RAW audio
capture, but it did not catch RuntimeExceptions.
6 months ago
Romain Vimont 3c45625324 Log recording RAW audio codec as error
It is not possible to record with a RAW audio codec, so the log before
exiting should be an error rather than a warning.
6 months ago
Romain Vimont 11d738321f Recover on invalid camera FPS ranges
Some devices may provide invalid ranges, causing an
IllegalArgumentException "lower must be less than or equal to upper".

Catch the exception to list the cameras anyway.

Refs #4403 <https://github.com/Genymobile/scrcpy/issues/4403>
6 months ago
Romain Vimont ccaa832f48 Simplify --list-cameras output
Remove --video-source=camera from the output of --list-cameras (this is
implicit).
6 months ago
Romain Vimont 4e4ddc499f Return the FakeContext as application context
This avoids getApplicationContext() to return null and cause
NullPointerException.

Fixes #4392 <https://github.com/Genymobile/scrcpy/issues/4392#issuecomment-1792806080>
6 months ago
Romain Vimont 8d76b3e06d Fill application context for camera
Using the camera fails on some devices without a proper application
context.

Fixes #4392 <https://github.com/Genymobile/scrcpy/issues/4392>
6 months ago
Romain Vimont 85a0b935c9 Always assign a system context as base context
FakeContext used ActivityThread.getSystemContext() as base context only
in some cases, because it caused problems on some devices:
 - warnings on Xiaomi devices [1], which are now fixed by
   b8c5853aa6
 - issues related to Looper [2], which are solved by just calling
   Looper.prepare*()

Therefore, we can now always assign a base context, which simplifies and
helps to solve camera issues on some devices (#4392).

[1] <https://github.com/Genymobile/scrcpy/issues/4015#issuecomment-1595382142>
[2] <https://github.com/Genymobile/scrcpy/issues/3805#issuecomment-1596148031>

Fixes #4392 <https://github.com/Genymobile/scrcpy/issues/4392>
6 months ago
Romain Vimont 8c3e2bae7b Simplify Application instantiation
The constructor is public.
6 months ago
Romain Vimont 446ea818a4 Update links to v2.2 6 months ago
Romain Vimont c3c7bf7af3 Bump version to v2.2 6 months ago
Romain Vimont 5000368c2f Merge branch 'master' into release 6 months ago
Romain Vimont 855ae4adb1 Upgrade SDL (2.28.4) for Windows
Include the latest version of SDL in Windows releases.
6 months ago
Romain Vimont a8db3ec9e2 Upgrade platform-tools (34.0.5) for Windows
Include the latest version of adb in Windows releases.
6 months ago
Romain Vimont ff579990c2 Shutdown connection before joining threads
Interrupting async processors may require to shutdown the connection to
wake up blocking calls.

Therefore, shutdown the connection first, then join the threads, then
close the connection.

Refs commit 9c08eb79cb
6 months ago
Romain Vimont b8c5853aa6 Disable default stdout/stderr
Some devices (mostly Xiaomi) print internal errors using
e.printStackTrace(), flooding the console with irrelevant errors.

Disable system streams used via System.out and System.err streams, to
print only the logs from scrcpy.

Refs #994 <https://github.com/Genymobile/scrcpy/issues/994>
Refs #4213 <https://github.com/Genymobile/scrcpy/pull/4213>
6 months ago
Romain Vimont c64d150202 Improve manpage formatting 6 months ago
Romain Vimont 8350a61926 Simplify URLs in manpage
The .UR-formatted URLs are not always rendered correctly. Use simple
brackets instead.
6 months ago