Commit Graph

1275 Commits (3d5b31e0cbd0025f5072bc530cc0840ae301379a)
 

Author SHA1 Message Date
Romain Vimont 3d5b31e0cb Add icon source in SVG format
Scrcpy only uses the PNG format (because SDL only supports bitmap
icons), but keep the SVG source in the repo.
3 years ago
Romain Vimont 6004f0b6b0 Use a new scrcpy icon
Use the new icon designed by @varlesh:
<https://github.com/Genymobile/scrcpy/pull/1987#issuecomment-949684080>

Load it from a PNG file (SDL only supports bitmap icons).
3 years ago
Romain Vimont 12ed2f2402 Add support for palette icon formats
To support more icon formats.
3 years ago
Romain Vimont 0e4564da03 Add icon loader
Add helper to load icons from image files via FFmpeg.
3 years ago
Romain Vimont 156d958e77 Move common instruction out of ifdef
Both ifdef-branches return server_path.
3 years ago
Romain Vimont 7229e3cce0 Extract util function to build a local file path
Finding a local file in the scrcpy directory may be useful for files
other than scrcpy-server in the future.
3 years ago
Romain Vimont a7e41b0f85 Fix code style 3 years ago
zhongkaizhu 46d3e35c30 Fix "Could not find v4l2 muxer"
The AVOutputFormat name is a comma-separated list. In theory, possible
names for V4L2 are:

    - "video4linux2,v4l2"
    - "v4l2,video4linux2"
    - "v4l2"
    - "video4linux2"

To find the muxer in all cases, we must request exactly one muxer name
at a time.

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

Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
3 years ago
Romain Vimont 07d75eb336 Simplify net_send_all()
There is no need to declare the variable before the loop.
3 years ago
Romain Vimont 8df42cec82 Fix workarounds for Meizu
Workarounds.fillAppInfo() is necessary for Meizu devices even before the
first call to internalStreamScreen(), but it is harmful on other
devices (#940).

Therefore, simplify the workaround, by calling fillAppInfo() only if
Build.BRAND equals "meizu" (case insensitive).

Fixes #240 <https://github.com/Genymobile/scrcpy/issues/240> (again)
Fixes #2656 <https://github.com/Genymobile/scrcpy/issues/2656>
3 years ago
Romain Vimont 31131039bb Add missing includes
Refs #2616 <https://github.com/Genymobile/scrcpy/issues/2616>
3 years ago
Romain Vimont fa100b814b Add support for expandNotificationsPanel() variant
Some custom vendor ROM added an int as a parameter.

Fixes #2551 <https://github.com/Genymobile/scrcpy/issues/2551>
3 years ago
Romain Vimont 069fe93f74 Update links to v1.19 3 years ago
Romain Vimont 228e2c15f4 Bump version to 1.19 3 years ago
Romain Vimont 9a8f06af65 Merge branch 'master' into dev 3 years ago
Romain Vimont 1d1c9f36f4 Retrieve correct error messages on Windows
For sockets functions, Windows does not store error codes in errno, so
perror() does not print any error. Use WSAGetLastError() instead.

Refs #2624 <https://github.com/Genymobile/scrcpy/issues/2624>
3 years ago
Romain Vimont 4d6dd9d281 Compute scrcpy directory manually
The function dirname() does not work correctly everywhere with non-ASCII
characters.

Fixes #2619 <https://github.com/Genymobile/scrcpy/issues/2619>
3 years ago
a1346054 b5e98db635 Fix typo in manpage
PR #2606 <https://github.com/Genymobile/scrcpy/pull/2606>

Signed-off-by: Romain Vimont <rom@rom1v.com>
3 years ago
Romain Vimont 116acc8d25 Use SOURCE_MOUSE for scroll events
This has no practical impact (AFAIK), but a scroll events should come
from a mouse.

Refs #2602 <https://github.com/Genymobile/scrcpy/issues/2602>
3 years ago
nkh0472 3a39bacb76 Upgrade SDL (2.0.16) for Windows
Include the latest version of SDL in Windows releases.

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

Signed-off-by: Romain Vimont <rom@rom1v.com>
3 years ago
nkh0472 3fdc89ad42 Upgrade platform-tools (31.0.3) for Windows
Include the latest version of adb in Windows releases.

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

Signed-off-by: Romain Vimont <rom@rom1v.com>
3 years ago
Romain Vimont 3761f56c28 Declare callbacks static
It was a typo, "static" was missing.
3 years ago
horizon86 c96f5c70e9 Add Simplified Chinese translation of FAQ
PR #2568 <https://github.com/Genymobile/scrcpy/pull/2568>

Signed-off-by: Romain Vimont <rom@rom1v.com>
3 years ago
Romain Vimont d6aaa5bf9a Add a FAQ section for Wayland support
The video driver might need to be explicitly set to wayland.

Refs #2554 <https://github.com/Genymobile/scrcpy/issues/2554>
Refs #2559 <https://github.com/Genymobile/scrcpy/issues/2559>
3 years ago
kosantosbik 4ab3e89c29 Add README file in Turkish
PR #2514 <https://github.com/Genymobile/scrcpy/pull/2514>

Signed-off-by: Romain Vimont <rom@rom1v.com>
3 years ago
Hyperterminal Byte 4bc78244b9 Fix OBS project ref URL
PR #2545 <https://github.com/Genymobile/scrcpy/pull/2545>

Signed-off-by: Romain Vimont <rom@rom1v.com>
3 years ago
Stefan Huber ea233d811d Fix typo in DEVELOP.md
PR #2540 <https://github.com/Genymobile/scrcpy/pull/2540>

Signed-off-by: Romain Vimont <rom@rom1v.com>
3 years ago
Romain Vimont f78608ab29 Fix type for assignment
The functions net_send_all() and net_recv_all() return ssize_t, not int.
3 years ago
Romain Vimont 6f03022646 Fix net_send_all()
On partial writes, the final result was the number of bytes written by
the last send() rather than the total.
3 years ago
Romain Vimont daf90d33d5 Fix code style
Make the code fit into 80 columns.
3 years ago
Romain Vimont 0ae10f2b39 Improve slope estimation on start
The first frames are typically received and decoded with more delay than
the others, causing a wrong slope estimation on start.

To compensate, assume an initial slope of 1, then progressively use the
estimated slope.
3 years ago
Romain Vimont 4c4d02295c Add buffering debugging tools
Output buffering and clock logs by disabling a compilation flag.
3 years ago
Romain Vimont 2f03141e9f Add clock tests
The clock rolling sum is not trivial. Test it.
3 years ago
Romain Vimont 3397720330 Add buffering command line options
Add --display-buffer and --v4l2-buffer options to configure buffering
time.
3 years ago
Romain Vimont 79278961b9 Implement buffering
To minimize latency (at the cost of jitter), scrcpy always displays a
frame as soon as it available, without waiting.

However, when recording (--record), it still writes the captured
timestamps to the output file, so that the recorded file can be played
correctly without jitter.

Some real-time use cases might benefit from adding a small latency to
compensate for jitter too. For example, few tens of seconds of latency
for live-streaming are not important, but jitter is noticeable.

Therefore, implement a buffering mechanism (disabled by default) to add
a configurable latency delay.

PR #2417 <https://github.com/Genymobile/scrcpy/issues/2417>
3 years ago
Romain Vimont 408a301201 Notify new frames via callbacks
Currently, a frame is available to the consumer as soon as it is pushed
by the producer (which can detect if the previous frame is skipped).

Notify the new frames (and frame skipped) via callbacks instead.

This paves the way to add (optional) buffering, which will introduce a
delay between the time when the frame is produced and the time it is
available to be consumed.
3 years ago
Romain Vimont 4d8bcfc68a Extract current video_buffer to frame_buffer
The current video buffer only stores one pending frame.

In order to add a new buffering feature, move this part to a separate
"frame buffer". Keep the video_buffer, which currently delegates all its
calls to the frame_buffer.
3 years ago
Romain Vimont 336248df08 Rename video_buffer to sc_video_buffer
Add a scrcpy-specific prefix.
3 years ago
Romain Vimont 28bce48d47 Relax v4l2_sink lock constraints
To fix a data race, commit 5caeab5f6d
called video_buffer_push() and video_buffer_consume() under the
v4l2_sink lock.

Instead, use the previous_skipped indication (initialized with video
buffer locked) to lock only for protecting the has_frame flag.

This enables the possibility for the video_buffer to notify new frames
via callbacks without lock inversion issues.
3 years ago
Romain Vimont 32e692d5d2 Replace delay by deadline in timedwait()
The function sc_cond_timedwait() accepted a parameter representing the
max duration to wait, because it internally uses SDL_CondWaitTimeout().

Instead, accept a deadline, to be consistent with
pthread_cond_timedwait().
3 years ago
Romain Vimont ec871dd3f5 Wrap tick API
This avoids to use the SDL timer API directly, and will allow to handle
generic ticks (possibly negative).
3 years ago
Romain Vimont 5524f378c8 Add missing error log
Log video buffer initialization failure in v4l2_sink.
3 years ago
Romain Vimont 4ed3aa3604 Move include fps_counter
The fps_counter is not used from video_buffer.
3 years ago
Romain Vimont 40cea1f677 Remove obsolete comment
Commit 2a94a2b119 removed video_buffer
callbacks, the comment is now meaningless.
3 years ago
Romain Vimont 099cba07f0 Rename queue to sc_queue
Add a scrcpy-specific prefix.
3 years ago
Romain Vimont af8a21ed7c Fix manpage formatting 3 years ago
Romain Vimont 5938e862a1 Fix --lock-video-orientation syntax in help
Commit f76fe2c0d4 fixed README and tests.

Fix command line help and manpage.
3 years ago
Romain Vimont e9096e3e34 Remove unnecessary calls to av_packet_unref()
av_packet_free() already calls av_packet_unref().
3 years ago
Romain Vimont 5caeab5f6d Fix v4l2 data race
The v4l2_sink implementation directly read the internal video_buffer
field "pending_frame_consumed", which is protected by the internal
video_buffer mutex. But this mutex was not locked, so reads were racy.

Lock using the v4l2_sink mutex in addition, and use a separate field to
avoid depending on the video_buffer internal data.
3 years ago
Romain Vimont 33fbdc86c7 Initialize fields before starting a thread
To avoid data races.

Reported by TSAN.
3 years ago