Commit Graph

9621 Commits

Author SHA1 Message Date
Martin Pulec
39042d99ee audio_tx_send_standard: fixed static PT for MP3
In case that the input has 1 channel and 8 kHz, the packet type was not
set to 14, because the first if branch was entered instead of else-if
(not setting anything).
2024-08-09 09:23:00 +02:00
Martin Pulec
6508780adc audio_tx_send_standard: fixed PCMA/U dyn type
Fixed the condition that applied only if fixed PT was used for the
audio. But dynamic packet type is used when more channels are used,
in which case the condition didn't hold, which caused the stream not
being handled appropriately (interleaving the channels).
2024-08-09 09:23:00 +02:00
Martin Pulec
7330d9c181 audio_tx_send_standard: fixed bps for PCMA/U
The actual BPS is 1 (8-bits) regardless what .get_bps() returns (that
has a different semantics, see the comment).
2024-08-09 09:23:00 +02:00
Martin Pulec
642ffc8562 vrxtx/rtsp: update printed name
replace "H264 standard" with "RTP standard (using RTSP)" - the "standard"
protocol (on the sender) is no longer restricted to H264 - JPEG is also
possible as well as couple of audio codecs.
2024-08-09 09:23:00 +02:00
Martin Pulec
41b0388624 rtsp server: fixed audio props
Do not deduce audio properties from command-line parameters but from
the actual format that is being to sent.

Until now, the properties like ch_count and sample rate was deduced from
command-line parameters (ch_count from `-a channels=` and sample rate from
`-A xxx:sample_rate`). However, this is a bit fragile - the source may not
respect the `-a` parameters and also the `-A sample_rate` doesn't need
to be set, like in the following case:
```
uv -x rtsp -A A-law -a sample_r=8000 -s testcard
```

Here the capture sample_rate is set to 8000 but not parsed from parameters
(it must have been in `-A`). So SDP parameeters for RTSP was set
incorrectly (48000).
2024-08-09 09:22:59 +02:00
Martin Pulec
78f2a30f12 main: set audio data always
The audio state is always present (even if no audio rx/tx is used),
so set this always.

This will allow setting the data also for tx (the vrxtx) - the check if
either audio tx or rx is unnecessary (as indicated above).
2024-08-09 09:22:59 +02:00
Martin Pulec
0d143d3789 main: pass video_rxtx pointer to audio
will be used to register actual audio format for RTSP
2024-08-09 09:22:59 +02:00
Martin Pulec
b8d0c5e97d video_rxtx: make should_exit private 2024-08-09 09:22:59 +02:00
Martin Pulec
e75d1f2591 renamed rtsp_types_t audio and video
renamed to rtsp_type_audio and rtsp_type_video

Although not causing probles by now, the name itself (which is as a
part of unscoped struct global) is very common so it could have caused
conflicts in future.
2024-08-09 09:22:58 +02:00
Martin Pulec
c637644b72 vrxtx/ihdtv: use argc/argv from global option 2024-08-09 09:22:58 +02:00
Martin Pulec
44e4946b22 main: removed unused rxtx param a_tx_port 2024-08-09 09:22:58 +02:00
Martin Pulec
603a0c39a3 audio_register_display_clks: use struct for params 2024-08-09 09:22:58 +02:00
Martin Pulec
2cd30cbe6f COMMON_OPTS_INIT: do not use designed initializers
Inside C++, the designed initializers are supported from version c++20
but not supported eg. with GCC 9.4, that is on Ubuntu 20.04.
2024-08-09 09:22:58 +02:00
Martin Pulec
475be643e7 tv.h: include config.h
HAVE_TIMESPEC_H conditionaly defined with config.h is used later
2024-08-09 09:22:57 +02:00
Martin Pulec
1ab725d575 moved some common transmission opts to struct 2024-08-09 09:22:55 +02:00
Martin Pulec
b785c3d845 audio_options: do not duplicate def initialization
It should be either in audio/audio.h or main.cpp but not both because
it is unclear which will be used in the end.
2024-08-08 11:16:19 +02:00
Martin Pulec
ecc8332359 sdp: add "video" to get_codec_from_pt_rtpmap name
get_codec_from_pt_rtpmap->get_video_codec_from_pt_rtpmap
2024-08-08 11:16:19 +02:00
Martin Pulec
8ddf95a497 sdp.c: fixed wrong PT for static PT PCMA/PCMU
fixed the commit f28371c2 (from 2024-02-05)
2024-08-08 11:16:19 +02:00
Martin Pulec
36076c7cb8 rxtx/rtsp: print preliminate SDP immediately
print the SDP without need for connected client

Previously, the generated SDP was printed just as a client connects
because the sdpLines() member is called just after that (with appropriate
IP version).
2024-08-08 11:16:18 +02:00
Martin Pulec
6d5c6fe139 RTSP subsession SDP gen: unify audio and video 2024-08-08 11:16:18 +02:00
Martin Pulec
f26a34c8cb prefix rtsp_server_parameters:rtp_port width video
for audio rtp_port_audio is used so make this clear that this is for vid
2024-08-08 11:16:18 +02:00
Martin Pulec
b030a7e29e vrxtx/rtsp: run the RTSP srv for audio instantly
If video is not used, run the RTSP server immediately. This fixes the
commit 75f86ba6 (from 2024-08-01) that changed the behavior (delays RTSP
server start until video format is known).
2024-08-08 11:13:49 +02:00
Martin Pulec
6d4576fb02 rtpdec_jpeg: watch bogus quant data
As supposed by RFC 2435, watch invalid lengths for quantization tables.
2024-08-07 11:19:14 +02:00
Martin Pulec
544485bc54 audio/codec: allow PCMA/PCMU aliases
instead of u-/a-law for convenience
2024-08-06 16:25:12 +02:00
Martin Pulec
c5312812ec rxtx/sdp: print the supported codecs as well 2024-08-06 16:25:12 +02:00
Martin Pulec
298ea63fc7 {rxtx,vcap}/rtsp: print supported codecs 2024-08-06 16:25:12 +02:00
Martin Pulec
9a2c632d16 removed av from enum rtsp_types_t
use rather the bit sum of `audio | video`
2024-08-06 16:25:12 +02:00
Martin Pulec
ea958702ea rtsp_utils: fixed a typo (rtSP instead of rtPS) 2024-08-06 16:25:12 +02:00
Martin Pulec
0c1f301327 openssl_encrypt: allow cipher selection 2024-08-06 16:24:52 +02:00
Martin Pulec
42a0c8295c openssl_encrypt: add ciphers metadata struct 2024-08-06 15:59:33 +02:00
Martin Pulec
9dccd8a3f7 tx encryption: do not send invalid frame
If encryption fails, do not pass the data further since it will abort
on data_len <= 0 assertion in RTP.
2024-08-06 15:42:43 +02:00
Martin Pulec
f4bebb27b0 configure: ENSURE_FEATURE_PRESENT more generic
handle all values except of "no" and "auto" as required (eg. for
`--enable-ssl=wolfssl`)
2024-08-06 15:06:28 +02:00
Martin Pulec
98f8e31c0b vcf/logo: replace assert with error messages
If either encoder or decoder is not found, print the error message rather
than crashing with abort().

refer to GH-403
2024-08-02 16:50:09 +02:00
Martin Pulec
04fe6be014 vcf/logo: include needed headers
do not use config*h
2024-08-02 16:45:08 +02:00
Martin Pulec
e956582c7a rtpdec_jpeg: print frame incomplete with debug 2024-08-02 15:53:00 +02:00
Martin Pulec
9c9d8c34b6 rtpdec_jpeg: print error on unsupported JPEG Type
do not assert but rather print error

Also removed TODO - the JPEG types defined in RFC are all 8-bit, which
should not use 16-bit tables.
2024-08-02 15:53:00 +02:00
Martin Pulec
0d3f3c8ed2 rtpdec_jpeg: compute Q tables for 0-127
code taken directly from RFC 2435 text
2024-08-02 15:53:00 +02:00
Martin Pulec
835a7c01cf rtpdec_jpeg: handle custom static Q tables
Handle Q=128-254, which are defined by the transport but in opposite
to Q=255, its values don't change over time.
2024-08-02 15:53:00 +02:00
Martin Pulec
128935d038 rtsp dec: move decode_data_rtsp to a separate hdr 2024-08-02 15:53:00 +02:00
Martin Pulec
1b03ad341a sdp: generate rtpmap even for static PT
Generate rtpmap lines even for formats with statically assigned PT  -
bluenviron/mediamtx does it as well and it is nicer, although not
necessary.

RFC 3555
2024-08-02 15:52:59 +02:00
Martin Pulec
1a570365df rtsp,sdp: prefer rtpmap codec over PT 2024-08-02 15:52:59 +02:00
Martin Pulec
ae10e2ca17 vcap/rtsp: accept JPEG without rtpmap= in SDP
JPEG uses static PT=26, which is sufficient for identification

UG currently doesn't produce rtpmap for static PT.
2024-08-02 15:52:59 +02:00
Martin Pulec
a0405b4d49 jpeg_reader.c: extend the complaint over FFmpeg
Although RFC 2435 supports YUV 422, it has to have sampling factors
h: 2,1,1 v: 1,1,1

FFmpeg built-in JPEG encoder generates h: 2,1,1 v: 2,2,2 and
it cannot changed (set by function ff_mjpeg_init_hvsample() in
libavcodec/mjpegenc_common.c).
2024-08-02 15:52:59 +02:00
Martin Pulec
2d42b12cfa rxtx/rtsp: support for JPEG 2024-08-02 15:52:59 +02:00
Martin Pulec
1a6ef2d808 utils/sdp: replace STR_LENGTH with STR_LEN
STR_LENGTH was very similar name to STR_LEN, even set to the same value
so replace its ocuurences simply by STR_LEN.

This also allows putting it to headers because the constant is public.
2024-08-02 15:52:58 +02:00
Martin Pulec
75f86ba6c5 rxtx/rtsp: delay server creation + tx callback
We pass the video_codec as RTSP parameters but until we receive first frame
we cannot know the actual codec, so that delay the creation until we receive
the first frame.
2024-08-02 15:52:58 +02:00
Martin Pulec
985005cae5 rxtx/rtsp: pass also video codec
only H.264 for now

+ store the param struct as a member (will be needed later)
2024-08-02 15:52:58 +02:00
Martin Pulec
1efc15cfa0 main: print exception errors with logger
The problems are definitely fatal if caught on top-level.
2024-08-02 15:52:58 +02:00
Martin Pulec
dcbcf6e1cb rxtx/rtsp: combine init+start to single fn
start() was called immediately after init(), anyways
2024-08-02 15:52:58 +02:00
Martin Pulec
5e91d61fa0 vcap/rtsp: decompress - do not enforce H.264
decompress will work for JPEG as well if leaving the actual color_spec
2024-08-02 15:52:58 +02:00