The pointer ifa_addr in struct ifaddrs can be NULL and indeed it occurs
(perhaps with interfaces without assigned addrs?). Steps to reproduce:
```
uv -x sdp -t testcard -c lavc:subs=420
````
Since the function can be called from the signal handler, there must
not be any call to signal unsafe function (see signal-safety(7)).
Actually, this is not just a fix of a possible problem but it caused
activelly problems within the reflector when 2 signals were raised one
shortly after anotner. Was stuck at following (snippet):
```
std::unique_lock<std::mutex>::unique_lock(std::mutex&) at /usr/include/c++/14.1.1/bits/unique_lock.h:74
(inlined by) state_root::broadcast_should_exit() at /home/martin/Projects/ultragrid/src/host.cpp:533
exit_uv at /home/martin/Projects/ultragrid/src/host.cpp:587
signal_handler(int) at /home/martin/Projects/ultragrid/src/hd-rum-translator/hd-rum-translator.cpp:219
```
Previously the --conference-compression parameter would only work for
automatic output ports (sending back to participants who are sending to
us), while the hosts explicitely specified on cmdline would default to
packet reflecting mode (and not receive the mixed video).
If using transcoding reflector, eg.:
`hd-rum-transcode 8M 5004 -c libavcodec -P 6004 100:1`
pipe is used, which advertised VC_NONE, for which assertion at the
beginning of get_pixfmt_desc() failed.
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.
Moved metadata housekeeping to store_metadata() and removed the
assert. The idea is to prevent crashes on assert when some encode fails.
In some malicous case (eg. when the latency is higg), the metadata can be
now released prior to restoring, so print at least a warning about that.
fixed commits from 2023-01-03 (a9c001b9 and 4a915454):
1. unspecified device index is -1, not 0; this fixes run without device
spec (`-t avfoundation`)
2. device_name was not include in the condition for explicit device
selection. It coincidentally worked because of the bug nr. 1, because
the device_index was set to -1 and checked to not equal 0, which fulfills
the if condition
set always max_aud_chans to BMDDeckLinkMaximumAudioChannels
Setting it to BMDDeckLinkMaximumAnalogAudioOutputChannels ('aach') for
analog output was incorrect, because eg. BMD Studio 4K has mach=16 but
aach=4. This subsequently crashes on assert, because
IDeckLinkOutput::EnableAudioOutput accepts only 2, 8, 16, 32 or 64
channels.
At least the struct gpujpeg_image_parameters is input/output - the
pixel_format is read from there (to evaluate if alpha formats should
be presented). So better initialize it correctly - now it perhaps doesn't
matter but to be future-proof.
If no poison pill is passed (eg. some other module,init like vidcap
fails), poisoned pill is currently not passed before the done callback
is called. In case of this module it causes indefinite freeze. Moreover,
the processs cannot be killed from the command-line (neither Ctrl-C nor
Ctrl-\), because the console is "consumed" by CACA.
example of fixed command: `uv -t fail -d caca`
Set tmp_frame width, height and format. Those are not copied by
av_frame_copy_props as supposed by commit 5d3c31c115 (2023-10-31).
As such, this partially revers that commit.
Do not issue the warning over PowerShell or cmd legacy terminal emulators
in Windows 11. In Window the check doesn't work, because the process
tree is different - the Windows Terminal doesn't have its own process
and it is uv.exe->powershell.exe->exporer.exe.
This improves commit bb2a72f67f.
Fixed deleteStream message not being processed if the client doesn't
properly issue TEARDOWN on `Medium::close(instance->rtspServer);`.
(see also previous 2 commits)
Print RTP URLs for statically mapped packet types that do not require
SDP description.
It seems like just ffplay is capable to handle the stream(s), mpv and
vlc doesn't (vlc supports at least audio).
- 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)
/usr/local/lib is default location for Homebrew on Intel macs, which is,
however, searched by default. So it is actually not needed on Intels.
It is, however, also the path of the JACK library installed by the
official installer, which uses the universal binary (there is Intel-only
installer, too). With that universal library, the x86_64 build using
Rosetta2 will work with JACK also on ARM64 macs.
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
This macro is actually the deployment target, eg with current XCode on
macOS 13, the compilation gives this warnings:
```
src/video_capture/avfoundation.mm:142:25: warning: 'AVCaptureDeviceTypeExternal' is only available on macOS 14.0 or newer [-Wunguarded-av
ailability-new]
AVCaptureDeviceTypeExternal DESK_VIEW_IF_DEFINED
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AVFoundation.fra
mework/Headers/AVCaptureDevice.h:448:38: note: 'AVCaptureDeviceTypeExternal' has been marked as being introduced in macOS 14.0 here, but
the deployment target is macOS 13.0.0
AVF_EXPORT AVCaptureDeviceType const AVCaptureDeviceTypeExternal API_AVAILABLE(macos(14.0), ios(17.0), macCatalyst(17.0), tvos(17.0)) API
_UNAVAILABLE(watchos) API_UNAVAILABLE(visionos);
^
src/video_capture/avfoundation.mm:142:25: note: enclose 'AVCaptureDeviceTypeExternal' in an @available check to silence this warning
AVCaptureDeviceTypeExternal DESK_VIEW_IF_DEFINED
```
see also commit 7780fa8a
- use snprintf instead of strncat (better behavior - always appends \0 and
no need to subtract 1 from len /and expecting that there is \0 at the end)
- use actual string length with sizeof than STR_LEN (which may get
removed because it is misleading in respect to global STR_LENi value)
Send only one channel in RFC-compliant mode even if there are more,
just print an error.
The point is that even though the default audio capture channel count
is 1, some devices may not support mono (eg. DeckLink) and produce more
channels (usually 2) anyways.