Commit Graph

1188 Commits (f76fe2c0d4847d0e40d8708f97591abf3fa22ea5)
 

Author SHA1 Message Date
Biswapriyo Nath d1789f082a meson: Do not use full path with mingw tools name
This helps to use mingw toolchains which are not in /usr/bin path.

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

Signed-off-by: Romain Vimont <rom@rom1v.com>
3 years ago
Romain Vimont eb7e1070cf Release frame data as soon as possible
During a frame swap, one of the two frames involved can be released.
3 years ago
Romain Vimont 386f017ba9 Factorize frame swap 3 years ago
Romain Vimont cc48b24324 Simplify screen initialization
Use a single function to initialize the screen instance.
3 years ago
Romain Vimont 597c54f049 Group screen parameters into a struct
The function screen_init_rendering had too many parameters.
3 years ago
Romain Vimont 955da3b578 Remove screen static initializer
Most of the fields are initialized dynamically.
3 years ago
Romain Vimont cb9c42bdcb Use a callback to notify frame skip
A skipped frame is detected when the producer offers a frame while the
current pending frame has not been consumed.

However, the producer (in practice the decoder) is not interested in the
fact that a frame has been skipped, only the consumer (the renderer) is.

Therefore, notify frame skip via a consumer callback. This allows to
manage the skipped and rendered frames count at the same place, and
remove fps_counter from decoder.
3 years ago
Romain Vimont fb9f9848bd Use a callback to notify a new frame
Make the decoder independant of the SDL even mechanism, by making the
consumer register a callback on the video_buffer.
3 years ago
Romain Vimont c50b958ee4 Initialize screen before starting the stream
As soon as the stream is started, the video buffer could notify a new
frame available.

In order to pass this event to the screen without race condition, the
screen must be initialized before the screen is started.
3 years ago
Romain Vimont 441d3fb119 Make video buffer more generic
Video buffer is a tool between a frame producer and a frame consumer.

For now, it is used between a decoder and a renderer, but in the future
another instance might be used to swscale decoded frames.
3 years ago
Romain Vimont cb197ee3a2 Move fps counter out of video buffer
In order to make video buffer more generic, move out its specific
responsibility to count the fps between the decoder and the renderer.
3 years ago
Romain Vimont dca11f6c51 Remove obsolete FAQ entry
Issue #15 had been fixed in v1.14 by
e40532a376.
3 years ago
Romain Vimont 08baaf4b57 Mention adb debugging in FAQ 3 years ago
Romain Vimont 218636dc10 Inject touch events with smallest detectable size
A value of 1 means the "largest detectable size", a value of 0 means the
"smallest detectable size".

https://developer.android.com/reference/android/view/MotionEvent.PointerCoords#size
https://developer.android.com/reference/android/view/MotionEvent#AXIS_SIZE

Fixes #2125 <https://github.com/Genymobile/scrcpy/issues/2125>
3 years ago
yangfl 1863ca7ad1 Remove unnecessary escape characters in manpage
PR #2123 <https://github.com/Genymobile/scrcpy/pull/2123>

Signed-off-by: Romain Vimont <rom@rom1v.com>
3 years ago
Romain Vimont 7b51a0313e Update another java version in BUILD.md
Commit f8524a2be7 updated one reference to
the openjdk package, but there was another one.
3 years ago
Romain Vimont a2919b3ef2 Fix release instructions in BUILD.md
Makefile.CrossWindows have been renamed to release.mk, which is called
from release.sh.
3 years ago
Romain Vimont b16b65a715 Simplify default values
It makes sense to extract default values for bitrate and port range
(which are arbitrary and might be changed in the future).

However, the default values for "max size" and "lock video orientation"
are naturally unlimited/unlocked, and will never be changed. Extracting
these options just added complexity for no benefit, so hardcode them.
3 years ago
Romain Vimont a3aa5ac95e Insert numerical values statically in usage string 3 years ago
Romain Vimont 0207e3df33 Remove unused no_window field 3 years ago
Romain Vimont 9cd1a7380d Enable NDEBUG via Meson built-in option 3 years ago
Romain Vimont 24b637b972 Handle im-related events from input_manager.c 3 years ago
Romain Vimont 76a3d9805b Inline window events handling
Now that all screen-related events are handled from screen.c, there is
no need for a separate method for window events.
3 years ago
Romain Vimont 50b4a730e3 Handle screen-related events from screen.c 3 years ago
Romain Vimont ea2369f568 Reference video buffer from screen
This paves the way to handle EVENT_NEW_FRAME from screen.c, by allowing
to call screen_update_frame() without an explicit video_buffer instance.
3 years ago
Romain Vimont 0538e9645b Improve error handling in screen initialization
After the struct screen is initialized, the window, the renderer and the
texture are necessarily valid, so there is no need to check in
screen_destroy().
3 years ago
Romain Vimont 626094ad13 Handle window events only once visible
This will avoid corner cases where we need to resize while no frame has
been received yet.
3 years ago
Romain Vimont a566635c43 Log mipmaps error only if mipmaps are enabled 3 years ago
Romain Vimont 862948b132 Make use_opengl local
The flag is used only locally, there is no need to store it in the
screen structure.
3 years ago
Romain Vimont c0c4ba7009 Add intermediate frame in video buffer
There were only two frames simultaneously:
 - one used by the decoder;
 - one used by the renderer.

When the decoder finished decoding a frame, it swapped it with the
rendering frame.

Adding a third frame provides several benefits:
 - the decoder do not have to wait for the renderer to release the
   mutex;
 - it simplifies the video_buffer API;
 - it makes the rendering frame valid until the next call to
   video_buffer_take_rendering_frame(), which will be useful for
   swscaling on window resize.
3 years ago
Romain Vimont c53bd4d8b6 Assert non-recursive usage of mutexes 3 years ago
Romain Vimont 54f5c42d7b Add mutex assertions 3 years ago
Romain Vimont 21d206f360 Expose mutex assertions
Add a function to assert that the mutex is held (or not).
3 years ago
Romain Vimont d2689fc168 Expose thread id 3 years ago
Romain Vimont f6320c7e31 Wrap SDL thread functions into scrcpy-specific API
The goal is to expose a consistent API for system tools, and paves the
way to make the "core" independant of SDL in the future.
3 years ago
Romain Vimont 30e619d37f Replace SDL_strdup() by strdup()
The functions SDL_malloc(), SDL_free() and SDL_strdup() were used only
because strdup() was not available everywhere.

Now that it is available, use the native version of these functions.
3 years ago
Romain Vimont c0dde0fade Provide strdup() compat
Make strdup() available on all platforms.
3 years ago
Romain Vimont ace438e52a Remove unused port_range field
The port_range is used from "struct server_params", the copy in
"struct server" was unused.
3 years ago
Romain Vimont 8e83f3e8af Remove unused custom event 3 years ago
Michael Richardson f8524a2be7 Update java version in BUILD.md
PR #2064 <https://github.com/Genymobile/scrcpy/pull/2064>

Signed-off-by: Romain Vimont <rom@rom1v.com>
3 years ago
Romain Vimont 97b001e7c0 Fix undefined left shift
Small unsigned integers promote to signed int. As a consequence, if v is
a uint8_t, then (v << 24) yields an int, so the left shift is undefined
if the MSB is 1.

Cast to uint32_t to yield an unsigned value.

Reported by USAN (meson x -Db_sanitize=undefined):

    runtime error: left shift of 255 by 24 places cannot be represented
    in type 'int'
3 years ago
Romain Vimont d8e9ad20b0 Improve file handler error message
Terminating the file handler current process may be either a "push" or
"install" command.
3 years ago
Romain Vimont b566700bfd Kill process with SIGKILL signal
An "adb push" command is not terminated by SIGTERM.
3 years ago
Romain Vimont 7afd149f4b Fix file_handler process race condition
The current process could be waited both by run_file_handler() and
file_handler_stop().

To avoid the race condition, wait the process without closing, then
close with mutex locked.
3 years ago
Romain Vimont 6a50231698 Expose a single process_wait()
There were two versions: process_wait() and process_wait_noclose().

Expose a single version with a flag (it was already implemented that way
internally).
3 years ago
Romain Vimont b8edcf52b0 Simplify process_wait()
The function process_wait() returned a bool (true if the process
terminated successfully) and provided the exit code via an output
parameter exit_code.

But the returned value was always equivalent to exit_code == 0, so just
return the exit code instead.
3 years ago
Romain Vimont 94eff0a4bb Fix size_t incorrectly assigned to int
The function control_msg_serialize() returns a size_t.
3 years ago
Romain Vimont 8dbb1676b7 Factorize meson compiler variable initialization 3 years ago
Romain Vimont ab912c23e7 Define feature test macros in common.h
This enables necessary functions once for all.

As a consequence, define common.h before any other header.
3 years ago
Simon Chan ce43fad645 Update README.zh-Hans to v1.17
PR #2029 <https://github.com/Genymobile/scrcpy/pull/2029>

Reviewed-by: Win7GM
Signed-off-by: Romain Vimont <rom@rom1v.com>
3 years ago