Romain Vimont
4601735e51
Add support for AAC audio codec
...
Add option --audio-codec=aac.
PR #3757 <https://github.com/Genymobile/scrcpy/pull/3757 >
2023-03-10 22:22:15 +01:00
Romain Vimont
13a3395a33
Disable audio on initialization error
...
By default, audio is enabled (--no-audio must be explicitly passed to
disable it).
However, some devices may not support audio capture (typically devices
below Android 11, or Android 11 when the shell application is not
foreground on start).
In that case, make the server notify the client to dynamically disable
audio forwarding so that it does not wait indefinitely for an audio
stream.
Also disable audio on unknown codec or missing decoder on the
client-side, for the same reasons.
PR #3757 <https://github.com/Genymobile/scrcpy/pull/3757 >
2023-03-10 22:22:15 +01:00
Romain Vimont
609b098a97
Do not merge config audio packets
...
For video streams (at least H.264 and H.265), the config packet
containing SPS/PPS must be prepended to the next packet (the following
keyframe).
For audio streams (at least OPUS), they must not be merged.
PR #3757 <https://github.com/Genymobile/scrcpy/pull/3757 >
2023-03-10 22:22:15 +01:00
Romain Vimont
de430bc4aa
Add an audio demuxer
...
Add a demuxer which will read the stream from the audio socket.
PR #3757 <https://github.com/Genymobile/scrcpy/pull/3757 >
2023-03-10 22:22:15 +01:00
Romain Vimont
d499f890e7
Give a name to demuxer instances
...
This will be useful in logs.
PR #3757 <https://github.com/Genymobile/scrcpy/pull/3757 >
2023-03-10 22:22:15 +01:00
Romain Vimont
e02f30f895
Remove unnecessary error logs
...
When a call to a packet or frame sink fails, do not log the error on the
caller side: either the "failure" is expected (explicitly stopped) or it
must be logged by the packet or frame sink implementation.
2023-02-19 02:10:14 +01:00
Romain Vimont
680ddf64be
Fix demuxer error message
...
Now that there are several possible codecs, do not hardcode H.264 in the
error message.
Refs 3e517cd40e
2023-02-18 09:31:06 +01:00
Romain Vimont
49eb326ce9
Extract packet merging
...
Config packets must be prepended to the next media packet. Extract the
logic to a new sc_packet_merger helper to simplify the demuxer code.
2023-02-11 09:44:33 +01:00
Romain Vimont
f03f32267e
Remove unused parser
...
Since 1c02b58412
, the parser is not used
anymore.
2023-02-10 23:18:11 +01:00
Romain Vimont
730eb1086a
Properly report demuxer errors
...
All demuxer errors were reported as "device disconnected", even if the
failure was not related to device socket read.
2023-02-10 18:55:43 +01:00
Romain Vimont
953edfd1df
Split codec_id reading
...
Receive codec id and convert it to AVCodecID separately.
This will allow the caller to distinguish between EOS and unknown codec
id.
2023-02-10 18:55:43 +01:00
Romain Vimont
230b8274b9
Fix error return value
...
The function returns an enum AVCodecID, not a bool.
2023-02-10 18:55:43 +01:00
Romain Vimont
40866ddc10
Fix demuxer error message
...
The message applies to all packets, not only config packets.
2023-02-10 18:55:39 +01:00
Romain Vimont
bd56c0abf7
Remove unused codec context
...
The demuxer does not need any codec context.
2023-02-10 18:46:01 +01:00
Romain Vimont
d2dce51038
Add support for AV1
...
Add option --codec=av1.
PR #3713 <https://github.com/Genymobile/scrcpy/pull/3713 >
2023-02-06 11:00:49 +01:00
Romain Vimont
4342c5637d
Add support for H265
...
Add option --codec=h265.
PR #3713 <https://github.com/Genymobile/scrcpy/pull/3713 >
Fixes #3092 <https://github.com/Genymobile/scrcpy/issues/3092 >
2023-02-06 11:00:49 +01:00
Romain Vimont
3e517cd40e
Add option to select video codec
...
Introduce the selection mechanism. Alternative codecs will be added in
further commits.
PR #3713 <https://github.com/Genymobile/scrcpy/pull/3713 >
2023-02-06 10:58:45 +01:00
Romain Vimont
bf8696d02e
Avoid unnecessary copy on config packets demuxing
...
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 16:18:23 +01:00
Romain Vimont
041cdf6cf5
Rename buffer_util.h to binary.h
...
It will allow to expose more binary util functions not related to
buffers.
PR #3369 <https://github.com/Genymobile/scrcpy/pull/3369 >
2022-08-28 15:23:08 +02:00
Romain Vimont
db8c1ce8e1
Fix protocol documentation in comments
...
Flags were in the correct order in the schema, but their description
were reversed.
2022-07-20 11:41:04 +02:00
Romain Vimont
5c62f3419d
Rename buffer util functions with sc_ prefix
2022-02-12 09:12:46 +01:00
Romain Vimont
044acc2259
Rename HEADER_SIZE to SC_PACKET_HEADER_SIZE
...
Prefix the constant for consistency.
2022-02-11 21:34:58 +01:00
Romain Vimont
6fc388f369
Remove unused BUFSIZE
2022-02-11 21:34:12 +01:00
Romain Vimont
1c02b58412
Remove sc_demuxer_parse()
...
Now that the key frame flag is known, parsing the packet is useless.
2022-02-11 21:33:09 +01:00
Romain Vimont
67068e4e3d
Pass key frame flag from the device
...
MediaCodec indicates when a packet is a key frame. Transmit it to the
client.
2022-02-11 21:32:55 +01:00
Romain Vimont
e3c2398aa2
Store packet flags in PTS most significant bits
...
A special PTS value was used to encode a config packet.
To prepare for adding more flags, use the most significant bits of the
PTS field to store flags.
2022-02-11 21:32:11 +01:00
Romain Vimont
61b6324ee9
Remove LOGC()
...
It is not clear when to use LOGC() rather than LOGE(). Always use
LOGE().
Moreover, enum sc_log_level has no "critical" log level.
2022-02-09 09:52:15 +01:00
Romain Vimont
c460243ce2
Simplify demuxer
...
Call the same push_packet_to_sinks() in all cases, and make
sc_demuxer_parse() return void.
2022-02-02 21:03:55 +01:00
Romain Vimont
7dec225ceb
Rename stream to sc_demuxer
...
For consistency with recorder and decoder, name the component which
demuxes a "demuxer".
And add the missing sc_ prefix.
2022-02-02 21:03:55 +01:00