Commit Graph

248 Commits

Author SHA1 Message Date
Martin Pulec
aef1b690cd fix CID 488781
very marginal, but...
2025-08-19 10:22:01 +02:00
Martin Pulec
e233623787 host: reenable stacktrace on mac
reenable the stacktrace

Disabled accidentaly by the commit 222499a2 (2025-04-14), which removed
the backgrace on everything except glibc and Windows.
2025-08-14 08:07:09 +02:00
Martin Pulec
1115d403de host: libbacktrace/print_stacktrace_glibc improves
- rename some symbols (state bs->bt), callbacks prefix with libbt
- assemble the line with strappend-like functions and write() just the
result
- flush the output after backtrace_symbols_fd() in case that the later
calls fail to have at least something output
- write_number->append_number for point 2 + tid write
2025-08-13 14:52:23 +02:00
Martin Pulec
9a2956ef34 print_stacktrace_glibc: fixes
- do not write trailing NULL byte
- do not use snprintf - is not async-signal-safe
- added a bit Doxy docu
2025-08-13 12:44:07 +02:00
Martin Pulec
2b3ae39a4f support for symbolic trace with libbacktrace
Linux (+ eventaully macOS)
2025-08-13 12:44:05 +02:00
Martin Pulec
b4aed788ca module: move private data to separate structure 2025-06-17 12:35:41 +02:00
Martin Pulec
99588ababe remove module.deleter 2025-06-17 12:35:38 +02:00
Ben Roeder
a62fe80c3f Fix spelling errors throughout codebase
Corrected various spelling mistakes in comments, documentation, and
variable names across the project. Changes include:
- Documentation files (CONTRIBUTING.md, README.md, etc.)
- Source code comments in C/C++ files
- Function parameter names and descriptions

No functional changes were made.
2025-06-01 18:03:40 +01:00
Martin Pulec
9b31e8c6af -l help - proper regex
While the pattern is specified as a regex, use correct syntax for
the numbers.
2025-04-30 15:38:10 +02:00
Martin Pulec
46ecc5ebda avoid use of strdupa 2025-04-14 15:44:10 +02:00
Martin Pulec
d2fab937f7 host/mtrace: use only if using glibc 2025-04-14 15:44:10 +02:00
Martin Pulec
222499a246 host/backtrace: do not use when glibc not used
compat eg. with musl
2025-04-14 15:44:10 +02:00
Martin Pulec
72ac724fb1 correct color names
The actual value (5,2,1)/5 didn't match peach fuzz (255,190,152)/255
but the rather closest color is Tomato (255,99,71)/255.

The T_DARKER_ORANGE is poorly defined but its value (3,1,0)/5 matches
approximately the X11 color Saddle Brown (139,69,19)/255.
2024-10-21 10:55:27 +02:00
Martin Pulec
9adf7b6101 compat/htonl.->compat/net.h
It can be used in place of other network-related headers, not just for
htonl and family.

+ compat for fd_t and INVALID_SOCKET (that has been in config_*.h)
2024-09-30 10:54:14 +02:00
Martin Piatka
2798cfb5f8 capabilities: Report placeholder text for codec options 2024-09-20 15:33:22 +02:00
Martin Pulec
922fe47fc9 check for unexpected exit
Ensure that some code/library doesn't call delilberately exit(). If so,
write an error msg to warn about it.

refer to GH-402
2024-08-16 16:32:54 +02:00
Martin Pulec
0092d0cc3a windows: print stacktrace in crash handler
added print_stacktrace_win

similarly to other platforms
2024-08-16 16:05:05 +02:00
Martin Pulec
c6a1714b0d host.cpp: improved including 2024-08-14 11:15:42 +02:00
Martin Pulec
58e0ac7c2c add opt -DCUDA_DEVICE_RESET for explicit cuda reset
Needed for `cuda-memcheck --leak-check full` to really detect leaks.
2024-08-14 10:41:33 +02:00
Martin Pulec
446fac2b0d Win 10 term warn: don't print if stdout isn't tty
The terminal warning is neadlessly printed eg. in the GUI.
2024-07-08 16:45:38 +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
08d827fd00 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-05-22 09:53:00 +02:00
Martin Pulec
752cc53fe9 setting verbose mode fix
fixed inverted condition introduced by the commit 2909e464 (2024-05-13)
2024-05-21 12:56:45 +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
2909e4646f common_preinit: use non-permuting getopt
Instead of tweaking the getopt manually, use non-permuting version of
getopt (POSIX-compiliant, indicated by leading '+' in optstring).

This is slightly less error-prone and more readable. Althoug still a
bit tweaking is needed - skipping a non-opt (which can be in the middle
of argv if user cmd uses this syntax). Also options for opts that are
not recognized by this getopt (any aother than -O/-V) will appear as
a non-opt.
2024-05-13 12:56:52 +02:00
Martin Pulec
4d82b59bb3 parse_bitrate: use also for hd-rum-transcode 2024-05-13 12:56:52 +02:00
Martin Pulec
cf2314de28 uv: make some shortopts as in hd-rum-transcode
to be consistent
2024-05-13 12:56:51 +02:00
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