Squashed 'external/toxcore/c-toxcore/' changes from 1701691d5..640e6cace

640e6cace fix(toxav): remove extra copy of video frame on encode Tested and works, but there might be alignment issues and other stuff.
6f7f51554 chore(toxav): use realtime deadline for vp8 encoder Technically all this does is choose a quality based on frame duration, which we always set to 1, and as such is always realtime. (In same timebase as pts, which we use as a frame counter...)
5047ae5a2 chore: make the source tarball exhibit the old behavior
14804a4b8 chore: Fix sonar-scan CI action.
e2db7d946 cleanup: Exclude lan_discovery test from running on macos, instead of excluding it from the project.
3accade67 chore: Fix CI, disabling some tests that no longer run on CI.
ef8d767e6 cleanup: Fix comment formatting errors.
34ec822da cleanup: Fix some clang-19 format warnings.
40b3f0b46 refactor: Use clang's nullability qualifiers instead of attributes.
f81e30679 refactor: Use per-parameter nullability annotations.
REVERT: 1701691d5 chore(toxav): use realtime deadline for vp8 encoder Technically all this does is choose a quality based on frame duration, which we always set to 1, and as such is always realtime. (In same timebase as pts, which we use as a frame counter...)
REVERT: a87505867 fix(toxav): remove extra copy of video frame on encode Tested and works, but there might be alignment issues and other stuff.

git-subtree-dir: external/toxcore/c-toxcore
git-subtree-split: 640e6cace81b4412c45977b94eb9c41e53c54035
This commit is contained in:
Green Sky
2025-10-08 12:03:02 +02:00
parent ab12fbe820
commit 54c0a3c874
195 changed files with 3148 additions and 5495 deletions

View File

@@ -44,7 +44,7 @@ typedef struct Bin_Pack Bin_Pack;
* This function would typically cast the `void *` to the actual object pointer type and then call
* more appropriately typed packing functions.
*/
typedef bool bin_pack_cb(const void *obj, const Logger *logger, Bin_Pack *bp);
typedef bool bin_pack_cb(const void *_Nullable obj, const Logger *_Nullable logger, Bin_Pack *_Nonnull bp);
/** @brief Function used to pack an array of objects.
*
@@ -54,7 +54,7 @@ typedef bool bin_pack_cb(const void *obj, const Logger *logger, Bin_Pack *bp);
* @param arr is the object array as void pointer.
* @param index is the index in the object array that is currently being packed.
*/
typedef bool bin_pack_array_cb(const void *arr, uint32_t index, const Logger *logger, Bin_Pack *bp);
typedef bool bin_pack_array_cb(const void *_Nullable arr, uint32_t index, const Logger *_Nullable logger, Bin_Pack *_Nonnull bp);
/** @brief Determine the serialised size of an object.
*
@@ -65,9 +65,7 @@ typedef bool bin_pack_array_cb(const void *arr, uint32_t index, const Logger *lo
* @return The packed size of the passed object according to the callback.
* @retval UINT32_MAX in case of errors such as buffer overflow.
*/
non_null(1) nullable(2, 3)
uint32_t bin_pack_obj_size(bin_pack_cb *callback, const void *obj, const Logger *logger);
uint32_t bin_pack_obj_size(bin_pack_cb *_Nonnull callback, const void *_Nullable obj, const Logger *_Nullable logger);
/** @brief Pack an object into a buffer of a given size.
*
* This function creates and initialises a `Bin_Pack` packer object, calls the callback with the
@@ -88,9 +86,7 @@ uint32_t bin_pack_obj_size(bin_pack_cb *callback, const void *obj, const Logger
*
* @retval false if an error occurred (e.g. buffer overflow).
*/
non_null(1, 4) nullable(2, 3)
bool bin_pack_obj(bin_pack_cb *callback, const void *obj, const Logger *logger, uint8_t *buf, uint32_t buf_size);
bool bin_pack_obj(bin_pack_cb *_Nonnull callback, const void *_Nullable obj, const Logger *_Nullable logger, uint8_t *_Nonnull buf, uint32_t buf_size);
/** @brief Determine the serialised size of an object array.
*
* Behaves exactly like `bin_pack_obj_b_array` but doesn't write.
@@ -104,9 +100,7 @@ bool bin_pack_obj(bin_pack_cb *callback, const void *obj, const Logger *logger,
* @return The packed size of the passed object array according to the callback.
* @retval UINT32_MAX in case of errors such as buffer overflow.
*/
non_null(1) nullable(2, 4)
uint32_t bin_pack_obj_array_b_size(bin_pack_array_cb *callback, const void *arr, uint32_t arr_size, const Logger *logger);
uint32_t bin_pack_obj_array_b_size(bin_pack_array_cb *_Nonnull callback, const void *_Nullable arr, uint32_t arr_size, const Logger *_Nullable logger);
/** @brief Pack an object array into a buffer of a given size.
*
* Similar to `bin_pack_obj_array` but does not write the array length, so
@@ -124,9 +118,7 @@ uint32_t bin_pack_obj_array_b_size(bin_pack_array_cb *callback, const void *arr,
*
* @retval false if an error occurred (e.g. buffer overflow).
*/
non_null(1, 5) nullable(2, 4)
bool bin_pack_obj_array_b(bin_pack_array_cb *callback, const void *arr, uint32_t arr_size, const Logger *logger, uint8_t *buf, uint32_t buf_size);
bool bin_pack_obj_array_b(bin_pack_array_cb *_Nonnull callback, const void *_Nullable arr, uint32_t arr_size, const Logger *_Nullable logger, uint8_t *_Nonnull buf, uint32_t buf_size);
/** @brief Encode an object array as MessagePack array into a bin packer.
*
* Calls the callback `arr_size` times with increasing `index` argument from 0 to
@@ -150,51 +142,48 @@ bool bin_pack_obj_array_b(bin_pack_array_cb *callback, const void *arr, uint32_t
*
* @retval false if an error occurred (e.g. buffer overflow).
*/
non_null(1, 2) nullable(3, 5)
bool bin_pack_obj_array(Bin_Pack *bp, bin_pack_array_cb *callback, const void *arr, uint32_t arr_size, const Logger *logger);
bool bin_pack_obj_array(Bin_Pack *_Nonnull bp, bin_pack_array_cb *_Nonnull callback, const void *_Nullable arr, uint32_t arr_size, const Logger *_Nullable logger);
/** @brief Start packing a MessagePack array.
*
* A call to this function must be followed by exactly `size` calls to other functions below.
*/
non_null()
bool bin_pack_array(Bin_Pack *bp, uint32_t size);
bool bin_pack_array(Bin_Pack *_Nonnull bp, uint32_t size);
/** @brief Pack a MessagePack bool. */
non_null() bool bin_pack_bool(Bin_Pack *bp, bool val);
bool bin_pack_bool(Bin_Pack *_Nonnull bp, bool val);
/** @brief Pack a `uint8_t` as MessagePack positive integer. */
non_null() bool bin_pack_u08(Bin_Pack *bp, uint8_t val);
bool bin_pack_u08(Bin_Pack *_Nonnull bp, uint8_t val);
/** @brief Pack a `uint16_t` as MessagePack positive integer. */
non_null() bool bin_pack_u16(Bin_Pack *bp, uint16_t val);
bool bin_pack_u16(Bin_Pack *_Nonnull bp, uint16_t val);
/** @brief Pack a `uint32_t` as MessagePack positive integer. */
non_null() bool bin_pack_u32(Bin_Pack *bp, uint32_t val);
bool bin_pack_u32(Bin_Pack *_Nonnull bp, uint32_t val);
/** @brief Pack a `uint64_t` as MessagePack positive integer. */
non_null() bool bin_pack_u64(Bin_Pack *bp, uint64_t val);
bool bin_pack_u64(Bin_Pack *_Nonnull bp, uint64_t val);
/** @brief Pack an empty array member as a MessagePack nil value. */
non_null() bool bin_pack_nil(Bin_Pack *bp);
bool bin_pack_nil(Bin_Pack *_Nonnull bp);
/** @brief Pack a byte array as MessagePack bin. */
non_null() bool bin_pack_bin(Bin_Pack *bp, const uint8_t *data, uint32_t length);
bool bin_pack_bin(Bin_Pack *_Nonnull bp, const uint8_t *_Nonnull data, uint32_t length);
/** @brief Start packing a custom binary representation.
*
* A call to this function must be followed by exactly `size` bytes packed by functions below.
*/
non_null() bool bin_pack_bin_marker(Bin_Pack *bp, uint32_t size);
bool bin_pack_bin_marker(Bin_Pack *_Nonnull bp, uint32_t size);
/** @brief Write a `uint8_t` directly to the packer in 1 byte. */
non_null() bool bin_pack_u08_b(Bin_Pack *bp, uint8_t val);
bool bin_pack_u08_b(Bin_Pack *_Nonnull bp, uint8_t val);
/** @brief Write a `uint16_t` as big endian 16 bit int in 2 bytes. */
non_null() bool bin_pack_u16_b(Bin_Pack *bp, uint16_t val);
bool bin_pack_u16_b(Bin_Pack *_Nonnull bp, uint16_t val);
/** @brief Write a `uint32_t` as big endian 32 bit int in 4 bytes. */
non_null() bool bin_pack_u32_b(Bin_Pack *bp, uint32_t val);
bool bin_pack_u32_b(Bin_Pack *_Nonnull bp, uint32_t val);
/** @brief Write a `uint64_t` as big endian 64 bit int in 8 bytes. */
non_null() bool bin_pack_u64_b(Bin_Pack *bp, uint64_t val);
bool bin_pack_u64_b(Bin_Pack *_Nonnull bp, uint64_t val);
/** @brief Write a byte array directly to the packer in `length` bytes.
*
* Note that unless you prepend the array length manually, there is no record of it in the resulting
* serialised representation.
*/
non_null() bool bin_pack_bin_b(Bin_Pack *bp, const uint8_t *data, uint32_t length);
bool bin_pack_bin_b(Bin_Pack *_Nonnull bp, const uint8_t *_Nonnull data, uint32_t length);
#ifdef __cplusplus
} /* extern "C" */