6398 Commits

Author SHA1 Message Date
Martin Pulec
a0fbc4e517 vcomp/cmpto_j2k: mct opt parse fix
Fixed the commit 27bfe2fc (2020-05-29) which added option nomct, but
switched the meaning of nomct and mct by mistake.
2024-06-26 16:35:53 +02:00
Martin Pulec
498fd765ee vcap/decklink: profile setting fix
Fixed the wrong condition since the commit 215ee42481 (2023-05-04) -
profile was actually not set.
2024-06-26 16:35:53 +02:00
Martin Pulec
9f52fabe76 fixed new (>0.25) gpujpeg compat
\+ use RESTART_AUTO if we have >= 0.25.3
2024-06-26 16:35:53 +02:00
Martin Pulec
67467807a3 fix repeated get_sockaddr_str calls
When get_sockaddr_str was called second time, the buffer was not cleared.

Also use snprintf to write the result in get_scoaddr_addr_str.
2024-06-26 16:35:53 +02:00
Martin Pulec
7dc235843b net: get_local_addresses - ifaddrs.ifa_addr can be NULL
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
````
2024-06-26 16:35:53 +02:00
Martin Pulec
91fe3ac71e vdec/lavd: check_duration wrong cond
It was perhaps meant to advise frame threads if not enabled, not if
slice thread is not enabled.
2024-06-26 16:08:14 +02:00
Martin Pulec
2d5b20734b broadcast_should_exit: fixed signalling
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
```
2024-06-26 16:08:14 +02:00
Martin Piatka
065ca274c8 hd-rum-translator: Force recompression for conference
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).
2024-06-25 13:56:12 +02:00
Martin Piatka
298b1bb819 display/conference: Fix behaviour when fps is unspecified 2024-05-31 14:43:38 +02:00
Martin Pulec
42bbc2a31f vdisp/pipe: do not announce VC_NONE support
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.
2024-05-22 10:50:44 +02:00
Martin Pulec
d7e64a07af hd-rum-transcode: exit if serv sock init fails 2024-05-22 10:24:28 +02:00
Martin Pulec
ee9fe26e01 hd-rum-transcode: catch stoi invalid_argument
Make something like `hd-rum-transcode 8M 5004 -P x 100::1` fail with
humaan readable message.
2024-05-22 10:23:47 +02:00
Martin Pulec
afda0381ae deinterlace: fixed noopt config
Introduced by the commit c4aa64c8 (2024-01-13).

refers to GH-384
2024-05-22 10:10:28 +02:00
Martin Pulec
00f95eb8ef 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-22 09:59:18 +02:00
Martin Pulec
051047d16e added unregister_should_exit_callback
\+ unregister the callback for video_rxtx
2024-05-22 09:59:12 +02:00
Martin Pulec
fcd222f5b2 register_should_exit_callback: register directly
no noeed to pass with a message
2024-05-22 09:59:00 +02:00
Martin Pulec
e613d4bd8c vcompress/lavc: do metadata housekeeping in store
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.
2024-05-22 09:57:41 +02:00
Martin Pulec
5da326b10f RTP: err sending RTCP - missing NL 2024-05-22 09:56:50 +02:00
Martin Pulec
4e6625bd33 vcap/avfoundation: fixed cmdline dev spec parsing
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
2024-04-29 10:43:36 +02:00
Martin Pulec
5bc00776b8 disp/decklink: always set max_aud_chans to value of 'mach'
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.
2024-04-29 10:43:27 +02:00
Martin Pulec
4807355d1d fixed video RX port explicit setting
Fixed the commit cb0f7fea (2023-05-09) which caused that -P <vrx>:<vtx>
didn't set the video bind port.
2024-04-29 10:41:00 +02:00
Martin Pulec
1bf4146a5c disp/caca: suppress logging if output is console 2024-04-29 10:40:22 +02:00
Martin Pulec
2fb5dc80fd vcap/dshow: added mapping for H.264 2024-04-29 10:37:57 +02:00
Martin Pulec
131e858677 vdec/gpujpeg: fixed compat gpujpeg case
P012Z should not be returned in this context, anyways
2024-04-29 10:26:35 +02:00
Martin Pulec
9ad453cf78 vdec/gpujpeg: set the default GJ params (probe)
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.
2024-04-29 10:26:03 +02:00
Martin Pulec
4e0c46eb9a GPUJPEG 0.25 API compat 2024-04-29 10:23:35 +02:00
Martin Pulec
f611e9a58c disp/caca: done correctly on no poisoined pill
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`
2024-04-29 10:22:21 +02:00
Martin Pulec
8ec4c897f6 vcap/file: fixed compat 2024-03-20 15:23:37 +01:00
Martin Pulec
0f47917883 testcard: fixed mode/size=4k
Since 61544172 (2024-10-10), _4k_ (and similar) modes were not accepted
because lacking FPS specification, which was unintended change in
that commit.
2024-03-06 10:59:23 +01:00
Martin Pulec
200b420b9a to_lavc_vid_conv_init: set tmp_frame attributes
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.
2024-03-01 15:57:58 +01:00
Martin Pulec
8f3d3cc1f0 Windows: issue a warning for PWSH/cmd term only in W10
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.
2024-02-28 13:15:53 +01:00
Martin Pulec
8d6e1a1622 UG 1.9 splashscreen 2024-02-12 16:34:55 +01:00
Martin Pulec
95b344c83e added release 1.9 color 2024-02-12 16:34:52 +01:00
Martin Pulec
1d3ca83c3e video_rxtx/h264_rtp.cpp: deleteStream msg not proc
Fixed deleteStream message not being processed if the client doesn't
properly issue TEARDOWN on `Medium::close(instance->rtspServer);`.

(see also previous 2 commits)
2024-02-08 14:50:01 +01:00
Martin Pulec
7d62e569c6 call c_stop_server in h264_rtp_video_rxtx::join()
This eliminates sending messages to alredy unregistered audio
receiver.

Also calling the stop in this method is more suitable.
2024-02-08 14:50:00 +01:00
Martin Pulec
ace6d570c9 Revert "vrxtx/rtsp subsessions: do not send msgs on exit"
This reverts commit c3bb31928e.

Will be handled differently in next commit (server stop in join).
2024-02-08 14:49:49 +01:00
Martin Pulec
7eed598ae7 module: unread message - print mod path in verbose 2024-02-08 14:49:45 +01:00
Martin Pulec
ecdad2a74b utils/sdp: print RTP url for static PT
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).
2024-02-07 16:38:57 +01: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
408febd8f0 JACK loader [mac]: try also lib in /usr/local
/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.
2024-02-07 10:50:43 +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
2a32a1e365 avfoundation: replaced also other compat macros
(see previous commit description)

\+ skip config*.h inclusion

\+ include system hdrs first
2024-02-06 17:02:01 +01:00
Martin Pulec
e7f4750ea4 AVF: use __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
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
2024-02-06 16:53:24 +01:00
Martin Pulec
bba976da66 utils/sdp: fixes includes
compile failed on arm64 macOS 12&13
2024-02-06 10:33:47 +01:00
Martin Pulec
772ef5de19 utils/sdp: improved string handling
- 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)
2024-02-05 16:42:31 +01:00
Martin Pulec
6b03287fa0 utils/sdp: use CRLF
CRLF should be used in SDP (the same as for HTTP for robots.txt+security)
2024-02-05 16:37:20 +01:00
Martin Pulec
e8af3008d7 rtsp: support for mp3 - use get_audio_rtp_pt_rtpmap 2024-02-05 15:08:34 +01:00
Martin Pulec
f28371c2e0 utils/sdp: separate and export PT+rtpmap fn
Separated packet type computation + eventual rtpmap generation to a
separate function, that may be used also by RTSP.
2024-02-05 15:00:06 +01:00
Martin Pulec
0d32e24b81 audio_tx_send_standard: MP3/Opus send 1 channel
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.
2024-02-05 11:36:48 +01:00
Martin Pulec
f716083050 validate_std_audio: check also channel count for mp3 2024-02-05 10:43:50 +01:00