Compare commits

..

3 Commits

Author SHA1 Message Date
Romain Vimont
886781e115 Avoid unnecessary copy on demuxing config packets
Use av_packet_ref() to reference the packet without copy.

This also simplifies the logic, by making the "offset" variable and the
memcpy() call local to the if-block.
2023-01-02 15:55:46 +01:00
Romain Vimont
d8c2fe6ef2 Revert "Remove continuous resizing workaround for Windows"
This reverts commit 18082f6069.

I can't reproduce, but it seems the workaround improves the behavior on
some Windows versions.

Fixes #3640 <https://github.com/Genymobile/scrcpy/issues/3640>
Refs #3458 <https://github.com/Genymobile/scrcpy/issues/3458>
2022-12-26 12:42:59 +01:00
Romain Vimont
54c7baceac Use "meson setup" from install_release.sh
Refs 64821466a1
2022-12-22 13:07:07 +01:00
5 changed files with 14 additions and 37 deletions

20
FAQ.md
View File

@@ -7,7 +7,7 @@ Here are the common reported problems and their status.
If you encounter any error, the first step is to upgrade to the latest version. If you encounter any error, the first step is to upgrade to the latest version.
## `adb` and USB issues ## `adb` issues
`scrcpy` execute `adb` commands to initialize the connection with the device. If `scrcpy` execute `adb` commands to initialize the connection with the device. If
`adb` fails, then scrcpy will not work. `adb` fails, then scrcpy will not work.
@@ -133,21 +133,6 @@ Try with another USB cable or plug it into another USB port. See [#281] and
[#283]: https://github.com/Genymobile/scrcpy/issues/283 [#283]: https://github.com/Genymobile/scrcpy/issues/283
## HID/OTG issues on Windows
On Windows, if `scrcpy --otg` (or `--hid-keyboard`/`--hid-mouse`) results in:
> ERROR: Could not find any USB device
(or if only unrelated USB devices are detected), there might be drivers issues.
Please read [#3654], in particular [this comment][#3654-comment1] and [the next
one][#3654-comment2].
[#3654]: https://github.com/Genymobile/scrcpy/issues/3654
[#3654-comment1]: https://github.com/Genymobile/scrcpy/issues/3654#issuecomment-1369278232
[#3654-comment2]: https://github.com/Genymobile/scrcpy/issues/3654#issuecomment-1369295011
## Control issues ## Control issues
@@ -168,7 +153,8 @@ The default text injection method is [limited to ASCII characters][text-input].
A trick allows to also inject some [accented characters][accented-characters], A trick allows to also inject some [accented characters][accented-characters],
but that's all. See [#37]. but that's all. See [#37].
Since scrcpy v1.20, it is possible to simulate a [physical keyboard][hid] (HID). Since scrcpy v1.20 on Linux, it is possible to simulate a [physical
keyboard][hid] (HID).
[text-input]: https://github.com/Genymobile/scrcpy/issues?q=is%3Aopen+is%3Aissue+label%3Aunicode [text-input]: https://github.com/Genymobile/scrcpy/issues?q=is%3Aopen+is%3Aissue+label%3Aunicode
[accented-characters]: https://blog.rom1v.com/2018/03/introducing-scrcpy/#handle-accented-characters [accented-characters]: https://blog.rom1v.com/2018/03/introducing-scrcpy/#handle-accented-characters

View File

@@ -80,22 +80,16 @@ On Arch Linux:
pacman -S scrcpy pacman -S scrcpy
``` ```
On Fedora, a [COPR] package is available: [`scrcpy`][copr-link]:
```
dnf copr enable zeno/scrcpy
dnf install scrcpy
```
[COPR]: https://fedoraproject.org/wiki/Category:Copr
[copr-link]: https://copr.fedorainfracloud.org/coprs/zeno/scrcpy/
A [Snap] package is available: [`scrcpy`][snap-link]. A [Snap] package is available: [`scrcpy`][snap-link].
[snap-link]: https://snapstats.org/snaps/scrcpy [snap-link]: https://snapstats.org/snaps/scrcpy
[snap]: https://en.wikipedia.org/wiki/Snappy_(package_manager) [snap]: https://en.wikipedia.org/wiki/Snappy_(package_manager)
For Fedora, a [COPR] package is available: [`scrcpy`][copr-link].
[COPR]: https://fedoraproject.org/wiki/Category:Copr
[copr-link]: https://copr.fedorainfracloud.org/coprs/zeno/scrcpy/
For Gentoo, an [Ebuild] is available: [`scrcpy/`][ebuild-link]. For Gentoo, an [Ebuild] is available: [`scrcpy/`][ebuild-link].

View File

@@ -95,29 +95,27 @@ sc_demuxer_push_packet(struct sc_demuxer *demuxer, AVPacket *packet) {
// A config packet must not be decoded immediately (it contains no // A config packet must not be decoded immediately (it contains no
// frame); instead, it must be concatenated with the future data packet. // frame); instead, it must be concatenated with the future data packet.
if (demuxer->pending || is_config) { if (demuxer->pending || is_config) {
size_t offset;
if (demuxer->pending) { if (demuxer->pending) {
offset = demuxer->pending->size; size_t offset = demuxer->pending->size;
if (av_grow_packet(demuxer->pending, packet->size)) { if (av_grow_packet(demuxer->pending, packet->size)) {
LOG_OOM(); LOG_OOM();
return false; return false;
} }
memcpy(demuxer->pending->data + offset, packet->data, packet->size);
} else { } else {
offset = 0;
demuxer->pending = av_packet_alloc(); demuxer->pending = av_packet_alloc();
if (!demuxer->pending) { if (!demuxer->pending) {
LOG_OOM(); LOG_OOM();
return false; return false;
} }
if (av_new_packet(demuxer->pending, packet->size)) { if (av_packet_ref(demuxer->pending, packet)) {
LOG_OOM(); LOG_OOM();
av_packet_free(&demuxer->pending); av_packet_free(&demuxer->pending);
return false; return false;
} }
} }
memcpy(demuxer->pending->data + offset, packet->data, packet->size);
if (!is_config) { if (!is_config) {
// prepare the concat packet to send to the decoder // prepare the concat packet to send to the decoder
demuxer->pending->pts = packet->pts; demuxer->pending->pts = packet->pts;

View File

@@ -306,14 +306,13 @@ sc_screen_render(struct sc_screen *screen, bool update_content_rect) {
} }
#if defined(__APPLE__) #if defined(__APPLE__) || defined(__WINDOWS__)
# define CONTINUOUS_RESIZING_WORKAROUND # define CONTINUOUS_RESIZING_WORKAROUND
#endif #endif
#ifdef CONTINUOUS_RESIZING_WORKAROUND #ifdef CONTINUOUS_RESIZING_WORKAROUND
// On Windows and MacOS, resizing blocks the event loop, so resizing events are // On Windows and MacOS, resizing blocks the event loop, so resizing events are
// not triggered. On MacOS, as a workaround, handle them in an event handler // not triggered. As a workaround, handle them in an event handler.
// (it does not work for Windows unfortunately).
// //
// <https://bugzilla.libsdl.org/show_bug.cgi?id=2077> // <https://bugzilla.libsdl.org/show_bug.cgi?id=2077>
// <https://stackoverflow.com/a/40693139/1987178> // <https://stackoverflow.com/a/40693139/1987178>

View File

@@ -12,7 +12,7 @@ echo "$PREBUILT_SERVER_SHA256 scrcpy-server" | sha256sum --check
echo "[scrcpy] Building client..." echo "[scrcpy] Building client..."
rm -rf "$BUILDDIR" rm -rf "$BUILDDIR"
meson "$BUILDDIR" --buildtype=release --strip -Db_lto=true \ meson setup "$BUILDDIR" --buildtype=release --strip -Db_lto=true \
-Dprebuilt_server=scrcpy-server -Dprebuilt_server=scrcpy-server
cd "$BUILDDIR" cd "$BUILDDIR"
ninja ninja