The audio output thread only reads samples from the buffer, and most of
the time, the audio receiver thread only writes samples to the buffer.
In these cases, using atomics avoids lock contention.
There are still corner cases where the audio receiver thread needs to
"read" samples (and drop them), so lock only in these cases.
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.
Power on the device on start only if video capture is enabled.
Note that it only impacts display mirroring, since control is completely
disabled if video source is camera.
Refs 110b3a16f6
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]
For AV1, the config packet must not be merged with the next non-config
packet.
This fixes the following error when passing --video-codec=av1:
> INFO: [FFmpeg] libdav1d 1.3.0
> ERROR: [FFmpeg] Unknown OBU type 0 of size 29393
> ERROR: [FFmpeg] Error parsing OBU data
> ERROR: Decoder 'video': could not send video packet: -1094995529
PR #4487 <https://github.com/Genymobile/scrcpy/pull/4487>
The SDL video subsystem may be initialized so that clipboard
synchronization works even without video playback.
But if the video subsystem initialization fails (e.g. because no video
device is available), consider it as an error only if video playback is
enabled.
Refs 5e59ed3135Fixes#4477 <https://github.com/Genymobile/scrcpy/issues/4477>
On some Samsung devices, DisplayManagerGlobal.getDisplayInfoLocked()
calls ActivityThread.currentActivityThread().getConfiguration(), which
requires a non-null ConfigurationController.
Fixes <https://github.com/Genymobile/scrcpy/issues/4467>
Fix the following warning/error:
../app/src/cli.c:2158:17: warning: a label can only be part of a
statement and a declaration is not a statement [-Wpedantic]
With some compilers, this is an error rather than a pedantic warning.
Refs <https://github.com/Genymobile/scrcpy/issues/2256#issuecomment-1467008307>
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>