Commit Graph

401 Commits (headerfix)
 

Author SHA1 Message Date
Romain Vimont 57687bdfcd Write header file with correct extradata
When recording, the header must be written with extradata set to the
content of the very first packet.

Suggested-by: Steve Lhomme <robux4@ycbcr.xyz>
5 years ago
Romain Vimont ee3cba57a8 Forward FFmpeg logs
FFmpeg logs can be useful to understand the cause of issues.
5 years ago
Romain Vimont c11905b860 Add log verbose macro
This was the only log priority missing.
5 years ago
Romain Vimont 1a5ba59504 Fix memory leak on close
The buffer associated to the AVIOContext must be freed.
5 years ago
Romain Vimont aa07dfd2ca
Merge pull request #412 from npes87184/dev
app: add always_on_top
5 years ago
Yu-Chen Lin eca82e09c3 app: add always_on_top
It is very convenient when I play mobile game and watch video at the
same time.

Tested on Linux mint Cinnamon as well as Windows 10.

Signed-off-by: Yu-Chen Lin <npes87184@gmail.com>
5 years ago
Romain Vimont b35733edb6 Fix expected mouse event sizes
Commit fefb9816a9 modified mouse events
serialization. The server-side parsing was updated to correctly read the
position, but the expected size of these events was not updated.

As a result, the server might try to parse incomplete events, leading
to BufferUnderflowException.

Fixes
<https://github.com/Genymobile/scrcpy/issues/350#issuecomment-456298816>.
5 years ago
Romain Vimont 7764a836f1 Fix incorrect comment
Comment had not been updated along with the code.
5 years ago
Romain Vimont 0bfaf7b7ff Update links to v1.6 in README and BUILD 5 years ago
Romain Vimont 446c682374 Bump version to 1.6 5 years ago
Romain Vimont 3aacb7967d Merge branch 'dev' into master 5 years ago
Romain Vimont 06a0bbbc71 Update FFmpeg (4.1) for Windows
Include the last version of FFmpeg in Windows releases.
5 years ago
Romain Vimont d71e036f3a Do not disable screensaver
Keep screensaver enabled while scrcpy is running.

Fixes <https://github.com/Genymobile/scrcpy/issues/380>.
5 years ago
Romain Vimont b343a5dc59
Merge pull request #401 from npes87184/dev
input_manager: don't ignore double click event when clicking inside device
5 years ago
Yu-Chen Lin c5ec1a194c input_manager: don't ignore double click event when clicking inside device
Signed-off-by: Yu-Chen Lin <npes87184@gmail.com>
5 years ago
Romain Vimont 4f254d8232
Merge pull request #396 from npes87184/master
prepare-dep: use variable for better readability
5 years ago
Romain Vimont 1fdde490fd Mirror "secure" content
Some applications, like Silence, prevent the content of a window from
being viewed on non-secure displays:
<https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_SECURE>

We can mirror it by just creating a "secure" display:
<https://developer.android.com/reference/android/view/Display#FLAG_SECURE>
5 years ago
yuchenlin fb73aa101a prepare-dep: use variable for better readability
The arguments are saved to variable when script started. Instead of
using $1, $2 and $3, we can use these variables.

Signed-off-by: yuchenlin <npes87184@gmail.com>
5 years ago
Romain Vimont 39c5e71605 Make the server unlink itself
To clean up the device, the client executed "adb shell rm" once the
server was guaranteed to be started (after the connection succeeded).

This implied to track whether the installation state, and failed if an
additional tunnel was used in "forward" mode:
<https://github.com/Genymobile/scrcpy/issues/386#issuecomment-453936034>

Instead, make the server unlink itself on start.
5 years ago
Romain Vimont fefb9816a9 Handle mouse events outside device screen
Mouse events position were unsigned (so negative values could not be
handled properly).

To avoid issues with negative values, mouse events outside the device
screen were ignored (commit a7fe9ad779).

But as a consequence, drag&drop were "broken" if the "drop" occurred
outside the device screen.

Instead, use signed 32-bits to store the position, and forward events
outside the device screen.

Fixes <https://github.com/Genymobile/scrcpy/issues/357>.
6 years ago
Romain Vimont 7830859c21 Merge branch 'master' into dev 6 years ago
Romain Vimont 0e019f8ab8 Add a note to allow simulating input in README 6 years ago
Romain Vimont f7d02cad4b Add ninja-build to the packages list to install
The package ninja-build should be installed automatically as a meson
dependency, but some users need to install a newer meson from pip3, so
ninja must be installed explicitly.
6 years ago
Romain Vimont a7fe9ad779 Ignore mouse events outside device screen
Never create a "struct point" with a position possibly outside the
device screen (i.e. in the black borders area), and do not transmit such
events.

This fixes an assertion failure on mouse wheel events outside the device
screen area.
6 years ago
Romain Vimont 1e22ebcac2 Always use non-empty arguments
The client passes parameters to the server via "adb shell" arguments.

Use "-" instead of "" when no crop is specified to avoid empty
arguments, which are not handled the same way on all devices.

Fixed <https://github.com/Genymobile/scrcpy/issues/337>.
6 years ago
Romain Vimont d81729ba39 Always expect 5 parameters for the server
The client always sends all the arguments, so there is no need to check.
6 years ago
Romain Vimont b2c3df7550 Point out that ninja must not be run as root
See https://github.com/Genymobile/scrcpy/issues/335.
6 years ago
Romain Vimont 46fec41b7b Move drag&drop features in README
Present how to install an APK and how to push a file in the "features"
section (instead of "shortcuts").
6 years ago
Romain Vimont 2876463d39 Fix read_packet() return value on error or EOF
Fix warning on error or EOF:

> Invalid return value 0 for stream protocol

See <http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=a606f27f4c610708fa96e35eed7b7537d3d8f712>.

Fixes <https://github.com/Genymobile/scrcpy/issues/333>.
6 years ago
Romain Vimont 6dc6ec05d5 Configure version at meson project level
Make meson aware of the project version, so that it does not print:

    Project version: undefined
6 years ago
Romain Vimont b5e630eea3 Update links to v1.5-fixversion
I forgot to bump version _before_ the release, so I had to make a new
one which fixes the version string (for scrcpy --help).
6 years ago
Pierre Gordon a17f1116ce Bump version to 1.5
Signed-off-by: Romain Vimont <rom@rom1v.com>
6 years ago
Romain Vimont e4cf152b26 Update links to v1.5 in README and BUILD 6 years ago
Romain Vimont bd32016632 Improve features presentation in README 6 years ago
Romain Vimont 77b620e1d0 Merge branch 'record' into dev (#292)
Record screen to file
6 years ago
Romain Vimont 22ff03f2f7 Do not queue invalid PTS
Configuration packets produced by MediaCodec have no valid PTS, and do
not produce frame. Do not queue their (invalid) PTS not to break the
matching between frames and their PTS.
6 years ago
Romain Vimont 60afb46c8d Store queue of PTS for pending frames
Several frames may be read by read_packet() before they are consumed
(returned by av_read_frame()), so we need to store the PTS of frames in
order, so that the right PTS is assigned to the right frame.
6 years ago
Romain Vimont 345f8858d3 Send frame meta only if recording is enabled
The client needs the PTS for each frame only if recording is enabled.
Otherwise, the PTS are not necessary, and the protocol is more
straighforward.
6 years ago
Romain Vimont 22bf0c19d6 Rename --output-file to --record
To record the screen to a local file:

    scrcpy --record file.mp4
6 years ago
Romain Vimont 70579dc709 Wrap receiver state into separate struct
For readability, wrap the state of the receiver in a separate struct
receiver_state.
6 years ago
Romain Vimont e562837c0b Avoid partial header reads
Use net_recv_all() to avoid partial reads for the "meta" header (this
would break the whole stream).
6 years ago
Romain Vimont ebe998cf78 Move buffer reader functions to buffer_util.h 6 years ago
Romain Vimont b98eb7d0fa Support AVStream.codec for old FFmpeg versions
AVStream.codec has been deprecated in favor of AVStream.codecpar.

Due to the FFmpeg/Libav split, this happened in two separate versions:
 - 57.33.100 for FFmpeg
 - 57.5.0 for Libav
6 years ago
yuchenlin e361b49b4a recorder: use av_oformat_next to support older FFmpeg
Signed-off-by: yuchenlin <npes87184@gmail.com>
6 years ago
Romain Vimont d0e090e1f9 Reenable custom SDL signal handlers
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.
6 years ago
Romain Vimont 475912a39c Do not transmit MediaCodec flags
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.
6 years ago
Romain Vimont 27e8a9a79d Assign PTS to the right frame
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
6 years ago
Romain Vimont 61db575861 Decode and push frame before recording
Handle display before recording, to reduce latency.
6 years ago
Romain Vimont 2cd99e7205 Only set valid PTS/DTS
When the PTS is valid, set both PTS and DTS to avoid FFmpeg warnings.

Since configuration packets have no PTS, do not record these packets.
6 years ago
Romain Vimont 27686e9361 Add recorder
Implement recording in a separate "class".
6 years ago