Commit Graph

221 Commits

Author SHA1 Message Date
Martin Pulec
0c9745dfda optind needs to be set to 0 than 1
optind needs to be set to 0 than 1 to reinit its internal state (see
NOTES in man getopt(3)) for getopt_long() in hd-rum-transcode. If not
so, the leading '+' in optstring (== disallowing permutation) won't
be effective.
2024-05-13 12:44:47 +02:00
Martin Pulec
a9225ff79e added unregister_should_exit_callback
\+ unregister the callback for video_rxtx
2024-05-06 15:15:29 +02:00
Martin Pulec
3cfd652bf3 register_should_exit_callback: register directly
no noeed to pass with a message
2024-05-06 15:14:48 +02:00
Martin Pulec
a66ee61564 Windows CUDA compilation fixes 2024-03-22 09:17:53 +01:00
Martin Pulec
a9da4539d8 to_lavc_vid_conv: add stub for CUDA implementation 2024-03-08 16:11:46 +01:00
Martin Pulec
502fb0c554 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 12:15:40 +01:00
Martin Pulec
95b344c83e added release 1.9 color 2024-02-12 16:34:52 +01:00
Martin Pulec
e00b80133a Windows: do not issue warning if TERM is defined
Although there is cmd/PS in process tree, it may be used just like shell
(eg. when run over SSH) so that the terminal may be eg. some Linux
terminal emulator.
2024-01-29 12:01:31 +01:00
Martin Pulec
bb2a72f67f issue a warning in legacy W10 terminals (PS/cmd)
Those terminal emulators block stdout/stderr output when scrolled,
which effectively stops UltraGrid. The behavior doesn't occur in MS
Terminal app, which is encouraged instead.

Note that Windows Terminal still runs cmd.exe or powershell.exe as a shell
while the cmd/PS process can acts like both terminal emulator and
shell. We also do not trigger the warning if UG is run from within
MSYS2 terminal.
2024-01-29 12:00:44 +01:00
Martin Pulec
4b9d203510 common_preinit: move init struct
fixes CID 424214
2023-11-30 10:45:25 +01:00
Martin Pulec
40a7d04ec1 unit_evaluate[_dbl]: added endptr param 2023-11-29 15:27:32 +01:00
Martin Pulec
94f4233e48 host.c: print_backtrace: glibc <2.27 compat
CentOS 7 has glibc 2.17 not supporting memfd_create, so use the generic
POSIX solution as for macOS but with a different, non-portable, thread
ID query function (note: gettid() requires glibc 2.30).
2023-11-20 08:56:44 +01:00
Martin Pulec
db8a6cd2dc crash_signal_handler: avoid backtrace interleaving
Previously, if eg. multiple worker crashed, backtraces were interleaved
- use temporary file to print it. It seems that the new implementation
prints backtrace just from one thread, which shouldn't matter, anyways,
because it is improbable that there are two different crashes at the
same time.
2023-11-14 08:20:52 +01:00
Martin Pulec
6b12ca5231 write_all: take the fd as 1st arg
Make the function more universal by not writting implicitly to
STDERR_FILENO.
2023-11-13 16:48:22 +01:00
Martin Pulec
624b34f7bd screen win uninitialize elevated: do not coinit
For uninit, screen-capture-recorder-x86.dll calls CoInitialize(0) and
fails because it fails.

Curiously this doesn't occur for register, which should be equivalent.
2023-10-26 16:11:49 +02:00
Martin Pulec
06956f0544 print caught signal desc in verbose 2023-10-26 08:44:43 +02:00
Martin Pulec
ff5ca386e6 audio codec: remove deprecated flag + new API fn
Get the info from audio lavc in textual form instead with a new API to
querying additional info about codec for user.

The new API will allow adding additional useful information in help,
eg. encoders present.

this updates the commit a0dd6b9b85
2023-10-25 13:02:38 +02:00
Martin Pulec
a544c26f78 added --param allow-unknown-params
This may be useful sometimes, eg. when comparing 2 versions where one
has some param and the other not. Or if the param presence is depending
on selected feature (eg. `--param debug-dump=`).
2023-10-16 16:29:24 +02:00
Martin Pulec
8747eae19c Revert "do not use source TS as RTP TS by default"
This reverts commit 2f1bfa9340.
2023-10-16 16:19:57 +02:00
Martin Pulec
16fa09eebc debug-dump: print usage with "help" 2023-10-06 08:07:20 +02:00
Martin Pulec
2af4ace259 Reed-Solomon (zfec): fixed fec_new fail
With current zfec code, fec_init() needs to be called prior to fec_new(),
otherwise the later one returns NULL.

\+ updated submodule to the current zfec version (requiring fec_init();
but UG will compile with the older zfec version as well)
2023-10-06 08:06:05 +02:00
Martin Pulec
2f995895c8 rename indent_paragraph to wrap_paragraph
More suitable name - the function doesn't indent but just wraps long
lines.
2023-09-15 15:36:41 +02:00
Martin Pulec
f590145ed3 ug_srand->ug_rand_init (improved seeding)
On POSIX systems, add also clock() to the seed + use as a source also
/dev/random if available.
2023-08-07 11:42:50 +02:00
Martin Pulec
3639d00dbf replaced not thread-safe *rand48 functions
Use rand_s() in Windows and random() in POSIX systems.
2023-08-02 10:07:19 +02:00
Martin Pulec
a0dd6b9b85 deprecate Speex audio codec
Speex doesn't seem to offer any advantage over other codecs and is deprecated in
favor of Opus by Xiph.Org.

Added this feature in a generic fashion in order to allow eventual deprecation
of some other codecs that may not be useful but would complicate further
development.
2023-07-27 12:02:35 +02:00
Martin Pulec
2f1bfa9340 do not use source TS as RTP TS by default
Do not use source TS as (a base for) RTP TS by default anymore. Since this
was essential for synchronized DeckLink playback, require `--incompatible`
to enable this.

The reason to disable for now is because it breaks compressed
audio. Eg. for Opus, one receives 2 packets for 40 ms input. Currently
only the first gets source TS, second is undefined, thus getting the
default, loosely related TS, that may however create TS discontinuity
(especially with the time, when PC and DeckLink time diverges).

There is no good solution for the above yet, sending both packet with
the same TS and m-bit on second isn't sufficient now, because it gets
joined in receiver buffer and eg. Opus is not self delimiting so it will
need changes on receiver side to pass RTP packets to Opus decoder as
Opus packets.

refer to GH-326
2023-07-26 16:59:50 +02:00
Martin Pulec
046c6ce767 set_audio_delay: log changed value
refers GH-219
2023-06-20 09:41:45 +02:00
Martin Pulec
183d175d73 fixed some of new Coverity issues 2023-05-10 08:52:02 +02:00
Martin Pulec
01b3f55f9b ~state_root: prevent unserialized var access
The should_exit_callbacks members can be concurrently accessed also from
the should_exit_thread, that has not yet been joined.
2023-04-28 16:08:05 +02:00
Martin Pulec
a233123473 ULTRAGRID_VERBOSE env var: neutralize if empty
While set, user may want to unset it just for one command, for which the
easiest way is to use `ULTRAGRID_VERBOSE= <cmd>`.
2023-04-28 14:32:54 +02:00
Martin Pulec
64688bb4c7 hd-rum-transcode: share signal callbacks with UG
The crash and freeze signal handlers may be useful also for the
reflector.
2023-04-28 13:12:35 +02:00
Martin Pulec
89ac81b0bd hd-rum-translator: fixed messages not delivered
The state_root::new_message is now handled in host.cpp, which processed
all messages, even those intended for reflector.

As a solution, the new_message callback of state_root processes only
messages for it and puts remaining messages back to the pool with the
new function module_store_message() that doesn't call the new_message
callback.
2023-04-28 12:18:52 +02:00
Martin Pulec
81e2920f17 ~state_root: erase should_exit callbacks
erase should_exit_callbacks before calling broadcast_should_exit

The destructor is called after most of the modules are destroyed but the
should_exit callbacks are not unregistered (it is not supposed to be
required since it should be called only to unblock blocking modules
calls to allow destroying them).
2023-04-24 13:44:58 +02:00
Martin Pulec
1ed549df4a separated some common root mod handling to host.cpp
The management of should_exit events should be also be shared with the
transcoding reflector that uses some parts that may depend upon this
functionality.

This is not purely a refactorization but slightly changes behavior,
namely the shared state cleanup is done in a destructor, not by
`uv.stop()` as it used to be.

see GH-307
2023-04-12 16:35:55 +02:00
Martin Pulec
a3daa89ef6 displays: changed api for mainloop
- removed `needs_mainloop` attribute and deduce if mainloop is needed
  from the presence of _run callback (the information is now redundant
  only displays needing/running mainloop should announce _run callback)

- run the custom mainloop (currently only Syphon!) only when display
  doesn't run its mainloop. This allows running Syphon and GL/SDL
  display because it connects to the display mainloop.
2023-03-29 13:39:48 +02:00
Martin Pulec
449251ac3e get rid of global should exit variable 2023-03-24 14:06:50 +01:00
Martin Piatka
68d30a4f6b capabilities: Add device options 2023-03-16 13:20:41 +01:00
Martin Pulec
c9e5f620cd audio/capture: get rid of audio_init_state_ok
replaced with convenient INIT_NOERR

+ removed all remaining references (audio.h, host.cpp)
2023-03-14 10:52:17 +01:00
Martin Pulec
20a331fad1 logging: do not override log_level default val
If user didn't set anything on command line, do not override the default
value of `log_level` specified by the initializer.

This is a bit contraintuitive if a developer sets the value ad hoc to a
different val, it won't take effect.
2023-03-07 16:31:05 +01:00
Martin Pulec
4fe552f225 use common com_[un]initialize 2023-02-24 16:06:42 +01:00
Martin Pulec
8df499ffac merged utils/hresult to utils/windows
These 2 files are relatively small and coherent.

+ fixed hresult_to_str not returning anything on RPC_E_CHANGED_MODE
2023-02-24 15:00:00 +01:00
Martin Pulec
9aef0d6011 common_init: init COM on main thread in Windows
Ensure that COM is intialized as COINIT_MULTITHREADED on main thread
because eg. Portaudio uses COINIT_APARTMENTTHREADED.
2023-02-24 13:47:36 +01:00
Martin Pulec
98805677eb --conv-policy help - improvements 2023-02-23 09:06:49 +01:00
Martin Pulec
fd58880e99 call srand48 in common_preinit
lrand48() is now called in rtp_init_if() prior to init_rng() to get
random port offset. But when not seeded, first call of lrand48() return
always 0 (with glibc 2.37).
2023-02-23 09:06:45 +01:00
Martin Pulec
927842cf43 added pixfmt conversion policy opt
+ changed the default policy to keep bit-depth over color-space

pixfmt_conv_pref is defined in video_codec.c, otherwise tools/convert
won't compile.
2023-02-14 09:49:48 +01:00
Martin Pulec
cac1d11190 updated copyrights of files changed in 2023 2023-02-09 09:19:50 +01:00
Martin Piatka
83d7a28a32 capabilities: Fix printing incorrect module name 2023-02-07 10:44:23 +01:00
Martin Piatka
53ff8e4bbf capabilities: Use explicit type in lambda 2023-02-02 15:54:20 +01:00
Martin Piatka
28797c2246 capabilities: null initialize device list pointer 2023-02-02 15:52:58 +01:00
Martin Piatka
c131e1ebd8 capabilities: Don't print modules when selective querying 2023-02-02 12:27:49 +01:00