This partially reverts commit f00c6c5b13.
On Ctrl+C, we need to execute cleanup code. For instance, if recording
is enabled, we need to write MP4 file trailer on exit.
Custom SDL signal handlers were disabled because it leaded to process
hanging on Ctrl+C during network calls on initialization, but now it
seems to work correctly, the network calls return immediately on signal.
Since PTS handling has been fixed, the recorder do not associate a PTS
to a wrong frame anymore, so PTS of "configuration packets" (which never
produce a frame), are never read by the recorder. Therefore, there is no
need to ignore them explicitly, so we can remove the MediaCodec flags
completely.
The PTS was read from the socket and set as the current one even before
the frame was consumed, so it could be assigned to the previous frame
"in advance".
Store the PTS for the current frame and the last PTS read from the
packet header of the next frame in separate fields.
As a side-effect, this fixes the warning on quit:
> Application provided invalid, non monotonically increasing dts to
> muxer in stream 0: 17164020 >= 17164020
To handle special chars, text is handled as text input instead of key
events. However, this breaks the separation of DOWN and UP key events.
As a compromise, send letters and space as key events, to preserve
original DOWN/UP events, but send other text input events as text, to be
able to send "special" characters.
Fixes <https://github.com/Genymobile/scrcpy/issues/87>.
Suggested-by: pete1414
Suggested-by: King-Slide <kingslide@gmail.com>
The common command.c handled process errors from system-specific int
values (errno).
Rather, expose a new enum process_result to handle error cause in a
generic way.
There are many user who encounters missing adb.
To stop things happens again, we check it and show
sexy response to user.
Signed-off-by: yuchenlin <npes87184@gmail.com>
The current_process field was never reset after an installation is
complete. As a consequence, installer_stop() attempted to terminate it,
leading to a warning, at best.
In the Android input header file, an enum has a value taking more than
31 bits, leading to the following warning:
ISO C restricts enumerator values to range of ‘int’
Since we don't use it, remove it.
A missing initialization (fixed by the previous commit) leaded to kill
unexpected process.
In order to prevent consequences of similar errors in the future, never
call kill() with a non-positive PID.
See <https://github.com/Genymobile/scrcpy/issues/182>.
The current_process field of struct installer was not initialized.
Since the installer instance is static, its default value was 0.
The call to installer_stop() then called kill(0, SIGTERM) (on Linux),
which sent SIGTERM to every process in the process group. In particular,
the scrcpy process was killed.
As a consequence, the last cleanup steps, like disabling "show touches",
were not executed.
Fixes <https://github.com/Genymobile/scrcpy/issues/183>.
Meson decided to crossbuild for Windows as soon as
meson.is_cross_build() returned true. This made non-Windows crossbuilds
fail.
Instead, add an explicit option "crossbuild_windows".
Fixes <https://github.com/Genymobile/scrcpy/issues/165>.