Commit Graph

1028 Commits

Author SHA1 Message Date
Martin Pulec
fb15ce9218 aplay/alsa: moved buffer setting to a separate fn
refactor only

changed:
- use symbolic constannts MS_IN_US[_DBL]
- use MSG() instead of log_msg()
- add _MS suffix to macros for default buf sizes
- fixed including
2024-09-06 10:54:31 +02:00
Martin Pulec
e3556c66a7 aplay/alsa: warn if buffer is too short 2024-09-05 14:47:24 +02:00
Martin Pulec
f53204dd3c audio/utils: use static_assert for endianness
Use static_assert to ensure little endian instead of the preprocessor
checks - if the those macros are not defined by the compiler, the check
will be eliminated. If other complier is used, write this more
generically.
2024-08-14 15:37:22 +02:00
Martin Pulec
50812bba34 replacing PACKAGE_BUGREPORT with bug_msg
Where the PACKAGE_BUGREPORT is the only used item from config.h,
use bug_msg(), which can be then removed.

Improved bug_msg() to allow printf-like fomat + arguments.
2024-08-14 15:26:12 +02:00
Martin Pulec
781ac7689b rxrx/sdp: set actual audio specs
Instead of deducing from audio parameters, defer the creation until we
receive some audio data.

This complements identical change for RTSP in the commit 41b038862
(2024-08-13).
2024-08-14 11:28:11 +02:00
Martin Pulec
ea66f734e6 fixed CIDs 467079 and 467173
fixed some Coverity issues - actually no important, just complains about
uninitialized class members, that are, however, to be initialized later
2024-08-14 11:28:11 +02:00
Martin Pulec
5f90324328 tx: pass parent in common_opts 2024-08-13 12:59:51 +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
603a0c39a3 audio_register_display_clks: use struct for params 2024-08-09 09:22:58 +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
544485bc54 audio/codec: allow PCMA/PCMU aliases
instead of u-/a-law for convenience
2024-08-06 16:25:12 +02:00
Martin Pulec
f819deec7c wasapi: improved including 2024-07-30 10:38:15 +02:00
Martin Pulec
61bbc65806 wasapi: suppress warnings
Suppress warnings for missing braces:

    src/audio/capture/wasapi.cpp:61:41: warning: suggest braces around initialization of subobject [-Wmissing-braces]
       61 | const GUID KSDATAFORMAT_SUBTYPE_PCM = { STATIC_KSDATAFORMAT_SUBTYPE_PCM };

The macro is actually defined with Mingw-w64.
2024-07-29 11:48:34 +02:00
Martin Piatka
1260f9727f audio/utils: Fix leak
Coverity CID 466491
2024-07-16 12:26:05 +02:00
Martin Piatka
5133afc749 audio/filter: Add channel remap filter 2024-07-15 16:13:25 +02:00
Martin Piatka
8d7f878fba audio: Move channel_map struct to utils 2024-07-15 16:13:25 +02:00
Martin Piatka
bcba7c0056 audio/utils: Add remux_and_mix_channel() 2024-07-15 16:13:25 +02:00
Martin Piatka
7f25bb6036 audio/filter_chain: Remove initial ':' from cfg 2024-07-15 16:13:25 +02:00
Martin Pulec
e52dffac5e src/audio/playback/alsa.c: todo for get_sched_latency_ns
returns now always -1, suggesting removal
2024-07-08 10:21:01 +02:00
Martin Piatka
07ed6ce45c audio: Make it clear that channel map applies only to receiver 2024-06-25 13:48:45 +02:00
Martin Pulec
e494106bba moved strdupa from compat/misc to strings
\+ missing include guard
2024-06-12 14:26:34 +02:00
Martin Pulec
d0bfef4651 portaudio: accept device name prefixes
Also copy the device name to caller allocated buffer instead of cumbersome
giving the pointer to original string.
2024-05-14 11:31:56 +02:00
Martin Pulec
cec50e7656 portaudio: fixed including
- removed config*.h included
- optimized with include-what-you-use
2024-05-14 08:58:45 +02:00
Martin Pulec
06a71f0c2b CID 460738 fix
Fixed minor Coverity complaint (allocation check after first use).
2024-05-14 08:30:55 +02:00
Martin Pulec
9ca00ff610 CoreAudio: accept name for default devices
The default device name was not included in the list of device for
comparison, because the direction was not given. But we know the direction
both in capture and playback, so we can add it so that the default device
is recognized by name.

This also makes audio_ca_probe() more clear as a direction is always
capture or playback (-1 or 1).

\+ added some doxygen documentation

refer to GH-385
2024-05-13 16:47:20 +02:00
Martin Pulec
56a6dc78b0 replace remaining WIN32 platform macros
see the commit HEAD@{2}
2024-05-13 12:56:53 +02:00
Martin Pulec
a8083dc0c4 unregister remaining should_exit callbacks
Doesn't look that any of the instances exhibits a problem in either case
but it is more safe.
2024-05-06 16:19:20 +02:00
Martin Pulec
02eeac9ea5 audio: unregister callback
This caused occasional crashes on M1 Mac Pro with `uv --capabilities`
(also in macos-14 arm64 GH runner). This was most likely caused by the
callback being run just after the audio state has been destroyed.
2024-05-06 15:15:29 +02:00
Martin Pulec
80281c5c07 older compiler compat - rm array type deduction
Removed array template arguments deduction. Is not supported eg. by
clang 10 on macOS (Xcode 10.1) - perhaps not a big deal but the fix is
quite undemanding.
2024-04-26 14:38:39 +02:00
Martin Pulec
13905c4d76 use dedicated server mode blackhole addr
- use custom IPv6 black hole address 100::556C:7472:4772:6453 instead
of 100::1, which a user may use explicitly to signalize server mode
- check just the one address, not the black hole prefix in general
(again, the user may select the discard address intentinally without
knowing our semantics)
- removed the black hole handling functions (no longer needed)
- compute the actual in6_addr from the string with inet_pton instead of
hard coding the value
2024-04-26 10:35:16 +02:00
Martin Pulec
1cb9d0aea1 jack sources: fixed includes+year, enum
- removed config*.h (not needed)
- moved system headers prior user-defined
- fixed copyright year to 2024
- replaced numeric macros with enum (cppcoreguidelines-macro-to-enum)
2024-02-07 11:31:12 +01:00
Martin Pulec
0241177c0e JACK loader [macOS,arm64]: try using Homebrew lib
On ARM64 macs, the loader refuses to load the library installed with
Homebrew in /opt/homebrew/lib, even when added to DYLD_LIBRARY_PATH. Error
message is:
```
JACK library "libjack.dylib" opening failed: dlopen(libjack.dylib,
0x0002): tried: 'libjack.dylib' (relative path not allowed in hardened
program), '/System/Volumes/Preboot/Cryptexes/OSlibjack.dylib' (no such
file), '/Volumes/ULTRAGRID/uv-qt.app/Contents/libs/libjack.dylib' (no
such file), '/Volumes/ULTRAGRID/uv-qt.app/Contents/libs/libjack.dylib'
(no such file), '/usr/lib/libjack.dylib' (no such file, not in dyld
cache), 'libjack.dylib' (relative path not allowed in hardened program)
```

As a solution, the absolute path `/opt/homebrew/lib/libjack.dylib`
is loaded.

Other changes:
- try array of candidate JACK library paths
- increased STR_LEN to 2048 - for the error messages from the JACK, 1024
could be too little (errs stored and printed only if no library usable)
- MOD_NAME defined in the header, so that MOD_NAME cannot be defined in
the source prior include; undefined at the end of the header
2024-02-07 10:21:16 +01:00
Martin Pulec
0d1631299a audio: do not abort on unsupp codec for SDP
do not crash/abort on `uv -s testcard -x sdp -A mp3`
2024-02-05 09:40:48 +01:00
Martin Pulec
f08c736ff3 audio: log receiver/port change 2024-01-15 16:00:08 +01:00
Martin Pulec
e5ef4d512e audio_*_process_message: reindent
just a reindention and small warning fixes (like NULL->nullptr), no
functional change
2024-01-15 16:00:08 +01:00
Martin Pulec
f9290460a2 fixed CID 428882 2023-12-01 10:18:47 +01:00
Martin Pulec
dd97abd111 audio/audio.cpp: optimized includes and using 2023-11-29 15:35:37 +01:00
Martin Pulec
869c436588 audio codec fmt: accept shortcuts
accept prefix syntax for bitrate and sample_rate
2023-11-29 15:27:33 +01:00
Martin Pulec
5c61b9d4d8 parse_audio_codec_params: check bitrate suffix
do not accept something like:
`uv -A Opus:bitrate=64b`

(was meant 64 bps or what?)
2023-11-29 15:27:32 +01:00
Martin Pulec
7fa5f3e672 parse_audio_codec_params: wrong cond fix 2023-11-29 15:27:32 +01:00
Martin Pulec
40a7d04ec1 unit_evaluate[_dbl]: added endptr param 2023-11-29 15:27:32 +01:00
Martin Pulec
6ebcfa1a26 audio/codec: improved including 2023-11-29 15:26:32 +01:00
Martin Pulec
bfb7a1d232 removed no longer needed check_audio_codec 2023-11-29 14:58:16 +01:00
Martin Pulec
e50db753be audio/codec parse_audio_codec_params: check vals 2023-11-29 14:58:16 +01:00
Martin Pulec
288b2c5804 refactor audio codec fmt parse
Should be almost functional equivalent as the previous version.
2023-11-29 14:58:14 +01:00
Martin Pulec
cd22b7d8cc aplay dummy: print also offset from previous TS 2023-11-27 15:21:40 +01:00
Martin Pulec
99269e670d aplay dummy: added option debug
print timestamps etc.
2023-11-27 15:21:29 +01:00