Commit Graph

6156 Commits

Author SHA1 Message Date
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
d1a8e93f0b resize: simplified a bit
Generalized handling a bit - there are only 2 cases in general - output
is 16 bit (if resize input is /eg. converted/ RG48) or 8 bit RGB.
2023-11-13 16:48:22 +01:00
Martin Pulec
4c2778b397 resize cap. f.: support for conversions 2023-11-13 16:48:17 +01:00
Martin Pulec
88834e113b parallel_pix_conv: accept 0 for thread count (auto)
\+ document

\+ remove inclusion of config*.h (in worker.h as well; fixed a guard
macro there as well)

\+ ptrdiff_t for iteration to compute in wider type (clang-tidy
bugprone-implicit-widening-of-multiplication-result)
2023-11-13 10:27:10 +01:00
Martin Pulec
05d73fb5d0 resize: removed enforcing interlacing option
It is unneeded now, since `override_fps` capture filter and postprocess
is present and so it is slightly unsystematic here.
2023-11-13 10:27:10 +01:00
Martin Pulec
818e76247e resize cap. f.: support for RG48 2023-11-13 10:27:10 +01:00
Martin Pulec
41ad20d13d resize_utils: small rebase 2023-11-13 10:27:10 +01:00
Martin Pulec
a57124f174 resize cap. f.: print error on unsupp codec
Print error on unsupported codec instead of crashing on abort.
2023-11-13 10:27:10 +01:00
Martin Pulec
56582cd614 resize cap. f.: moved reconf to fn
\+ use logger for reconfigure notice
2023-11-13 10:27:10 +01:00
Martin Pulec
1994a02ecf resize utils: abort on unsupported codecs
Continuing would cause abort anyways in CV calls, because the empty
(error) return value is not handled in any way.
2023-11-13 10:27:09 +01:00
Martin Pulec
84f827d4cb resize_utils: return void
Actually no error is handled except of wrong usage (passing NULL in/out
pointers). As the functions are used just from one place, the caller
should take responsibility that this won't happen.
2023-11-13 10:27:09 +01:00
Martin Pulec
9dae59dc5f resize cap f.: color help
\+ removed config_*h includes
2023-11-13 10:27:09 +01:00
Martin Pulec
c14ad5f95e pixfmt_conv.h: small doxy update
\+ added some direct pixfmt_conv.h includes (in attempt to remove its
inclusion from video_codec.h, which finally didn't take place but still
it is better to include this directly)
2023-11-13 10:27:09 +01:00
Martin Pulec
deab6eecf9 thread.h: guard variables defined in host
This allows linking the file outside UltraGrid.
2023-11-13 10:25:19 +01:00
Martin Pulec
ddaba11059 fixed previous commit
pthread.h was not included in thread.c in the end

\+ small improvements
2023-11-10 16:04:53 +01:00
Martin Pulec
9f5530df1b build: hedge lavc depends
Allow linking libavcodec conversions outside UG with reasonably small
amount of dependencies.
2023-11-10 15:49:53 +01:00
Martin Piatka
405e18f7f2 transmit: Fix crash when NULL parent module is passed 2023-11-10 11:41:10 +01:00
Martin Piatka
bf8af5fc9e rtp: Fix crash due to invalid force_ip_version
The parameter changed from bool to int containing version number in
c692a01
2023-11-10 11:37:46 +01:00
Martin Pulec
96373a1e73 tools/convert: support for storing PNM/Y4M 2023-11-09 16:00:21 +01:00
Martin Pulec
ea9558cab1 thread.c: removed SetThreadDescription ptype [Win]
already included in MinGW headers, moreover with additiona `__declspec
(dllimport)` attribute.
2023-11-08 16:54:06 +01:00
Martin Pulec
a71264ac65 GL Spout/Syphon: add 'disp.' to MOD_NAME
to be consistent with 'spout cap.'

\+ renamed "Syphon display" to 'syphon disp.' (from the same reason)
2023-11-08 16:25:23 +01:00
Martin Pulec
687bcfb30e spout cap.: improvements
- removed inclusion of config*.h

- use Sleep instead of usleep

- subsequent improves in gl_common.h (removed config*.h)
2023-11-08 16:25:15 +01:00
Martin Pulec
bbc380660f spout cap.: print only long codec name
the long ones are a bit cluttered - Red Green Blue 24bit

Also make the output more terse (with+height -> size).
2023-11-08 14:39:30 +01:00
Martin Pulec
ecedf7eadd spout cap.: report nosig + rate-limit
- report if no signal was detected (perhaps no server)

- rate limit to 100 ms because the ReceiveImage() returns immediately
false, effectively busy waiting
2023-11-08 14:15:25 +01:00
Martin Pulec
202ea81a91 spout cap.: print init notice
Spout module init is very silent and when it succeeds but there is no
Spout server, it prints nothing while waiting for signal, which may be
confusing if it is really working. So print at least that init succeeded
and waiting for signal.
2023-11-08 13:43:01 +01:00
Martin Pulec
c3d2b158be pipe disp.: adverise all pixfmts
closes GH-349
2023-11-08 12:59:30 +01:00
Martin Pulec
7d3c5bf4ca Revert "hot-fixed crashing Spout on log setting"
since b98b5ab0 this hot-fix is not needed

This reverts commit 5294185671.
2023-11-08 12:59:30 +01:00
Martin Pulec
b8e9e59760 video_codec: always define metadata for HW_VDPAU
Since HW_VDPAU is unconditionally in codec_t, we may ask for metadata
eg. when iterating over all codecs to get pixfmts only. HW_VDPAU doesn't
match but not having metadata defined causes that is_codec_opaque()
returns false, so it is included.
2023-11-08 12:59:30 +01:00
Martin Pulec
7deb2dc24f Logger: appending TERM_RESET before NL fix
Do not crash with out_of_range exception if trying to output empty log
(`LOG(LOG_LEVEL_INFO) << "";`) - either intentionally or by mistake.

Check if output has really size >0 before comparing last char with '\n'.

Rewritten a bit, but only functional change is the above. Eg. it was
slightly counterintuitive comparing msg[msg.size() - sizeof TERM_RESET]
to '\n'. This actually caused the crash on empty string, even though
TERM_RESET was appended. It is because `sizeof TERM_RESET` counts
'\0', which is not counted in C++ string. Semantically better would
have been `strlen(TERM_RESET) - 1`, from which is obvious it will fail
if output string was originally empty.
2023-11-08 12:59:30 +01:00
Martin Pulec
35217a3dc8 video_codec: assert codec metadata to be present
Those functions are usually used directly, without checking the return
value. Using this value may result to hard-to-trace errors later.
2023-11-08 12:59:30 +01:00
Martin Pulec
d909f99255 hd-rum-recompress: fix crash on compress init fail
Fixed a crash in deinit if compression init fails, eg.:
```
hd-rum-transcode 8M 5004 -c nonexistent -P 6004 localhost
```
2023-11-08 12:59:29 +01:00
Martin Piatka
01023463a6 lavc_common: get_avpixfmts_names: Clear buf first
Since the buffer is static, it contains stuff from previous run of the
function. We need to clear it before appending new pixfmts in the loop.
2023-11-07 15:44:53 +01:00
Martin Pulec
0b4c0e850d lib_common: print dlopen errs as warn
Since the libraries should be bundled, treat the dlopen errors rather
as errors and issue warning. This also occurs eg. on bare debootstraped
Ubuntu system, where basic libraries like libasound2, libdrm and libgl1
are missing but are among those excluded from AppImages.
2023-11-06 16:50:27 +01:00
Martin Pulec
e148a2912a decklink disp.: needless NL in errmsg
Splitting the error to
```
[DeckLink display] Unable to switch audio output for channels 3 or above although
card shall support it: Not implemented (0x80000001)
Check if it is ok. Continuing anyway.
```
actually doesn't help readibility.
2023-11-06 13:28:18 +01:00
Martin Pulec
11fd6830be add opt --audio-channel-map shortcut -U 2023-11-06 13:28:18 +01:00
Martin Piatka
1f8644f87f pipewire_common: Stop the loop in destructor 2023-11-06 10:13:03 +01:00
Martin Pulec
9ce4b3d557 DeckLik disp.: print errmsg if can't set aud switch 2023-11-03 11:11:10 +01:00
Martin Pulec
f618b6e9e7 DeckLink disp.: ensure that queried ch_count is valid
If not, it may later fail (see GH-354) in
display_decklink_reconfigure_audio() depending what the actual value is
and what will be negotiated, it would certainly fail for < 2.
2023-11-03 10:41:40 +01:00
Martin Pulec
7abe8937e9 DeckLink disp.: set audio chans only on query succ
refers to GH-354

It seems that if the query fails, it sets some undefined or invalid
value to the output variable.

\+ print actual used maximal value in verbose mode

\+ print also error message
2023-11-03 10:21:53 +01:00
Martin Pulec
3a3c607638 types.h: removed a forward decl
unneeded and in a wrong header
2023-11-03 09:51:41 +01:00
Martin Pulec
817f3475aa DeckLink disp.: fixed a typo
fixes GH-355
2023-11-03 09:39:01 +01:00
Martin Pulec
c610aaef5f DeckLink disp.: set_audio_props improved
print the connection directly from the display flag and then we can return
if audio is required to be embedded (no need to set AESEBU/analog switch).

\+ use more defensive msg about audio output (we actually may not set anything)
2023-11-03 09:38:59 +01:00
Martin Pulec
724ab38854 DeckLink disp.: warn in verb. on nosupp aud switch
If cannot switch to AESEBU/analog, warn at least in verbose mode
(shouldn't be an issue in most cases, since this is usually needed only
for more than 2 channels).
2023-11-03 09:31:53 +01:00
Martin Pulec
27ac319234 DeckLink disp.: factor out aud init to fn
Moved audio configuration to a separate function - refactor only, should
behave almost the same as before.
2023-11-03 09:19:39 +01:00
Martin Pulec
9938f6b082 av_log_ug_callback: handle overflow
If the buffer is full, flush the output even if there is no NL at the
end and issue a warning (should be handled - either some error or some
module produces unexpectedly long output).
2023-11-01 17:01:32 +01:00
Martin Pulec
fea0d10f67 improved UG FFmpeg logger
do not prefix messages not starting on new line by timestamps, eg.:

    $ uv -s embedded -t testcard -d file:n=/dev/null -V
    [1698853041.393] [lavc]   Stream #0:0[1698853041.393] : Video: rawvideo, 1 reference frame (UYVY / 0x59565955), uyvy422, 1920x1080 (0x0), q=2-31, 829440 kb/s[1698853041.393] , [1698853041.393] 25 tbn[1698853041.393]

Flush the output only on NL and before it store it in internal
thread-local buffer.

Locking was removed as static data are now thread-local.

this improves 808b3de3
2023-11-01 17:01:31 +01:00
Martin Pulec
40d2c66903 file disp.: initialize UG AV logging
not necessary, but better; also makes UG behavior deterministic, eg.:

    uv -s embedded -t testcard -d file:n=/dev/null [-c libavcodec] -V

produce different output for file depending if libavcodec is on or off
(AV messages prefixed by UG logger).
2023-11-01 17:01:31 +01:00
Martin Pulec
1589eae332 display file: changed allowed av diff to 100 ms
\+ set the option to be in seconds instead of video frame times

refers to GH-333
2023-11-01 12:01:09 +01:00
Martin Pulec
5d3c31c115 to_lavc_vid_conv: cp metadata out to tmp (refactor)
Set metadata to out_frame only and copy it to tmp_frame (not to repeat
every assignment and potentially forgotting something).

\+ check tmp_frame afor allocation failure
2023-10-31 11:03:36 +01:00