We try to allocate as many frames as were configured by looking for a
big enough range of unused contiguous frames while taking the configured
modes into account.
The number of frame stores / frame buffers can't be used like this as
the actual number of frames that can be used also depends on the
resolution.
If too many frames are used and the card's memory runs full, strange
problems (green frames, channels leaking into each other, etc.) will
appear.
As such, configure 8 frames for the source by default and half the queue
length for the sink. If anything else is needed, manual configuration
via the properties has to happen based on the expected workload on all
channels and the characteristics of the card in use.
../gstajacommon.cpp: In function ‘GType gst_aja_audio_meta_api_get_type()’:
/usr/include/glib-2.0/glib/gatomic.h:113:19: error: argument 2 of ‘__atomic_load’ must not be a pointer to a ‘volatile’ type
113 | __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gthread.h:260:7: note: in expansion of macro ‘g_atomic_pointer_get’
260 | (!g_atomic_pointer_get (location) && \
| ^~~~~~~~~~~~~~~~~~~~
../gstajacommon.cpp:398:7: note: in expansion of macro ‘g_once_init_enter’
398 | if (g_once_init_enter(&type)) {
| ^~~~~~~~~~~~~~~~~
And calculate them automatically be default based on the number of frame
buffers available and the number of channels.
This works around various bugs in the AJA SDK when selecting these
manually.
See AJA support ticket #5056.
This does not implement automatic mode selection yet, for which it is
necessary to change the routing at runtime based on the detected
format. It is a first step into that direction though.
ADF packets that are not a multiple of 12 large are truncated at the end
in SD modes. Instead of directly converting all the packets at once like
for non-SD modes, do the conversion (partially) manually.
Stop using CountAncillaryDataWithType(AJAAncillaryDataType_Cea708) etc
because for SD it doesn't recognize the packets. It assumes they would
only be received on AJAAncillaryDataChannel_Y but for SD it is actually
AJAAncillaryDataChannel_Both.