Introduce a new packet type, a "session" packet, containing metadata
about the encoding session. It is used only for the video stream,
and currently includes the video resolution.
For illustration, here is a sequence of packets on the video stream:
device rotation
v
CODEC | SESSION | MEDIA | MEDIA | … | SESSION | MEDIA | MEDIA | …
1920x1080 <-----------------> 1080x1920 <------------------
encoding session 1 encoding session 2
This metadata is not strictly necessary, since the video resolution can
be determined after decoding. However, it allows detection of cases
where the encoder does not respect the requested size (and logs a
warning), even without decoding (e.g., when there is no video playback).
Additional metadata could be added later if necessary, for example the
actual device rotation.
Refs #5918 <https://github.com/Genymobile/scrcpy/pull/5918>
Refs #5894 <https://github.com/Genymobile/scrcpy/pull/5894>
Co-authored-by: gz0119 <liyong2@4399.com>
The texture was created as soon as the initial video size was known,
even before the first frame arrived.
However, texture creation will require other data, such as the color
range, which is only available once the first frame is received.
Therefore, delay texture creation until the first frame.
A test for Java deserialization of the START_APP control message was
already present, but the corresponding C-side serialization test was
missing.
Refs 13ce277e1f
Rename "common" to "_init" because it not only exposes common functions
but also initializes environment variables.
Call _init in a single line in all dependency build scripts.
The function update_texture() calls update_texture_internal() and falls
back to set_pending_frame() if it fails.
When the frame passed is the pending frame, call only the _internal()
version instead.
This will prevent issues with frame reference counts by ensuring the
source and destination frames are never the same.
Refs 6298ef095f
Refs #6357 <https://github.com/Genymobile/scrcpy/issues/6357>
The field gl_context is initialized from SDL_GL_CreateContext(), which
returns a raw SDL_GLContext, not a pointer.
The type mismatch was silently ignored by SDL2 because SDL_GLContext
was defined as an alias to `void *` (in SDL3, it is instead an alias to
`struct SDL_GLContextState *`, so compilation fails).
Refs #3895 <https://github.com/Genymobile/scrcpy/pull/3895>
PR #6259 <https://github.com/Genymobile/scrcpy/pull/6259>
Signed-off-by: Romain Vimont <rom@rom1v.com>
Over HID, only integral scroll values can be sent. When SDL precise
scrolling is active, scroll events may include fractional values (e.g.,
0.05), which are truncated to 0 in the HID event.
To fix the problem, use the integral scroll value reported by SDL, which
internally accumulates fractional deltas.
Fixes#6156 <https://github.com/Genymobile/scrcpy/issues/6156>
PR #6172 <https://github.com/Genymobile/scrcpy/pull/6172>
SDL precise scrolling can sometimes produce values greater than 1 or
less than -1.
On the wire, the value is encoded as a 16-bit fixed-point number.
Previously, the range was interpreted as [-1, 1], using 1 bit for the
integral part (the sign) and 15 bits for the fractional part.
To support larger values, interpret the range as [-16, 16] instead,
using 5 bits for the integral part and 11 bits for the fractional part
(which is more than enough).
PR #6172 <https://github.com/Genymobile/scrcpy/pull/6172>