This exception is a super-type of:
- ClassNotFoundException
- IllegalAccessException
- InstantiationException
- InvocationTargetException
- NoSuchFieldException
- NoSuchMethodException
Use it to simplify.
Create the service managers from each manager wrapper class rather than
from their getter in ServiceManager.
The way a wrapper retrieve the underlying service is an implementation
detail, and it must be consistent with the way it accesses it, so it is
better to write the creation in the wrapper.
If the initial timestamp could not be retrieved, use the current time as
returned by System.nanoTime(). In practice, it is the same time base as
AudioRecord timestamps.
Fixes#4536 <https://github.com/Genymobile/scrcpy/issues/4536>
The result is assigned to a long (64-bit signed integer), but the
intermediate multiplication was stored in an int (32-bit signed
integer).
This value is only used as a fallback when no timestamp could be
retrieved, that's why it did not cause too much harm so far.
Fixes#4536 <https://github.com/Genymobile/scrcpy/issues/4536>
Reported by checkstyle:
> [ant:checkstyle] [INFO]
> scrcpy/server/src/main/java/com/genymobile/scrcpy/wrappers/ClipboardManager.java:48:
> Line is longer than 150 characters (found 167). [LineLength]
On some Samsung devices, DisplayManagerGlobal.getDisplayInfoLocked()
calls ActivityThread.currentActivityThread().getConfiguration(), which
requires a non-null ConfigurationController.
Fixes <https://github.com/Genymobile/scrcpy/issues/4467>
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.
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.
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.
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).
It is incorret to ever call:
streamer.writeDisableStream(...);
after:
streamer.writeAudioHeader();
Move the try-catch block so that it can never happen.
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>
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
Add --camera-high-speed to enable high frame rate camera capture. If
the option is enabled, then --camera-fps is mandatory.
PR #4213 <https://github.com/Genymobile/scrcpy/pull/4213>
Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
Add a new option for specifying the camera frame rate.
By default, Android's default frame rate (30 fps) is used.
PR #4213 <https://github.com/Genymobile/scrcpy/pull/4213>
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
In addition to --camera-size to specify an explicit size, make it
possible to select the camera size automatically, respecting the maximum
size (already used for display mirroring) and an aspect ratio.
For example, "scrcpy --video-source=camera" followed by:
- (no additional arguments)
: mirrors at the maximum size, any a-r
- -m1920
: only consider valid sizes having both dimensions not above 1920
- --camera-ar=4:3
: only consider valid sizes having an aspect ratio of 4:3 (+/- 10%)
- -m2048 --camera-ar=1.6
: only consider valid sizes having both dimensions not above 2048
and an aspect ratio of 1.6 (+/- 10%)
PR #4213 <https://github.com/Genymobile/scrcpy/pull/4213>
Co-authored-by: Simon Chan <1330321+yume-chan@users.noreply.github.com>
Add an option to select the camera by its lens facing (front, back or
external).
PR #4213 <https://github.com/Genymobile/scrcpy/pull/4213>
Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>