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

@@ -66,10 +66,8 @@
typedef struct Onion_Client Onion_Client;
non_null()
DHT *onion_get_dht(const Onion_Client *onion_c);
non_null()
Net_Crypto *onion_get_net_crypto(const Onion_Client *onion_c);
DHT *_Nonnull onion_get_dht(const Onion_Client *_Nonnull onion_c);
Net_Crypto *_Nonnull onion_get_net_crypto(const Onion_Client *_Nonnull onion_c);
/** @brief Add a node to the path_nodes bootstrap array.
*
@@ -84,39 +82,34 @@ Net_Crypto *onion_get_net_crypto(const Onion_Client *onion_c);
* @retval false on failure
* @retval true on success
*/
non_null()
bool onion_add_bs_path_node(Onion_Client *onion_c, const IP_Port *ip_port, const uint8_t *public_key);
bool onion_add_bs_path_node(Onion_Client *_Nonnull onion_c, const IP_Port *_Nonnull ip_port, const uint8_t *_Nonnull public_key);
/** @brief Put up to max_num nodes in nodes.
*
* return the number of nodes.
*/
non_null()
uint16_t onion_backup_nodes(const Onion_Client *onion_c, Node_format *nodes, uint16_t max_num);
uint16_t onion_backup_nodes(const Onion_Client *_Nonnull onion_c, Node_format *_Nonnull nodes, uint16_t max_num);
/** @brief Get the friend_num of a friend.
*
* return -1 on failure.
* return friend number on success.
*/
non_null()
int onion_friend_num(const Onion_Client *onion_c, const uint8_t *public_key);
int onion_friend_num(const Onion_Client *_Nonnull onion_c, const uint8_t *_Nonnull public_key);
/** @brief Add a friend who we want to connect to.
*
* return -1 on failure.
* return the friend number on success or if the friend was already added.
*/
non_null()
int onion_addfriend(Onion_Client *onion_c, const uint8_t *public_key);
int onion_addfriend(Onion_Client *_Nonnull onion_c, const uint8_t *_Nonnull public_key);
/** @brief Delete a friend.
*
* return -1 on failure.
* return the deleted friend number on success.
*/
non_null()
int onion_delfriend(Onion_Client *onion_c, int friend_num);
int onion_delfriend(Onion_Client *_Nonnull onion_c, int friend_num);
/** @brief Set if friend is online or not.
*
@@ -126,8 +119,7 @@ int onion_delfriend(Onion_Client *onion_c, int friend_num);
* return -1 on failure.
* return 0 on success.
*/
non_null()
int onion_set_friend_online(Onion_Client *onion_c, int friend_num, bool is_online);
int onion_set_friend_online(Onion_Client *_Nonnull onion_c, int friend_num, bool is_online);
/** @brief Get the ip of friend friendnum and put it in ip_port
*
@@ -135,10 +127,9 @@ int onion_set_friend_online(Onion_Client *onion_c, int friend_num, bool is_onlin
* @retval 0 if public_key refers to a friend and we failed to find the friend (yet)
* @retval 1 if public_key refers to a friend and we found them
*/
non_null()
int onion_getfriendip(const Onion_Client *onion_c, int friend_num, IP_Port *ip_port);
int onion_getfriendip(const Onion_Client *_Nonnull onion_c, int friend_num, IP_Port *_Nonnull ip_port);
typedef int recv_tcp_relay_cb(void *object, uint32_t number, const IP_Port *ip_port, const uint8_t *public_key);
typedef int recv_tcp_relay_cb(void *_Nonnull object, uint32_t number, const IP_Port *_Nonnull ip_port, const uint8_t *_Nonnull public_key);
/** @brief Set the function for this friend that will be callbacked with object and number
* when that friend gives us one of the TCP relays they are connected to.
@@ -148,11 +139,9 @@ typedef int recv_tcp_relay_cb(void *object, uint32_t number, const IP_Port *ip_p
* return -1 on failure.
* return 0 on success.
*/
non_null()
int recv_tcp_relay_handler(Onion_Client *onion_c, int friend_num,
recv_tcp_relay_cb *callback, void *object, uint32_t number);
int recv_tcp_relay_handler(Onion_Client *_Nonnull onion_c, int friend_num, recv_tcp_relay_cb *_Nonnull callback, void *_Nonnull object, uint32_t number);
typedef void onion_dht_pk_cb(void *object, int32_t number, const uint8_t *dht_public_key, void *userdata);
typedef void onion_dht_pk_cb(void *_Nonnull object, int32_t number, const uint8_t *_Nonnull dht_public_key, void *_Nullable userdata);
/** @brief Set the function for this friend that will be callbacked with object and number
* when that friend gives us their DHT temporary public key.
@@ -162,25 +151,21 @@ typedef void onion_dht_pk_cb(void *object, int32_t number, const uint8_t *dht_pu
* return -1 on failure.
* return 0 on success.
*/
non_null()
int onion_dht_pk_callback(Onion_Client *onion_c, int friend_num, onion_dht_pk_cb *function, void *object,
uint32_t number);
int onion_dht_pk_callback(Onion_Client *_Nonnull onion_c, int friend_num, onion_dht_pk_cb *_Nonnull function, void *_Nonnull object, uint32_t number);
/** @brief Set a friend's DHT public key.
*
* return -1 on failure.
* return 0 on success.
*/
non_null()
int onion_set_friend_dht_pubkey(Onion_Client *onion_c, int friend_num, const uint8_t *dht_key);
int onion_set_friend_dht_pubkey(Onion_Client *_Nonnull onion_c, int friend_num, const uint8_t *_Nonnull dht_key);
/** @brief Copy friends DHT public key into dht_key.
*
* return 0 on failure (no key copied).
* return 1 on success (key copied).
*/
non_null()
unsigned int onion_getfriend_dht_pubkey(const Onion_Client *onion_c, int friend_num, uint8_t *dht_key);
unsigned int onion_getfriend_dht_pubkey(const Onion_Client *_Nonnull onion_c, int friend_num, uint8_t *_Nonnull dht_key);
#define ONION_DATA_IN_RESPONSE_MIN_SIZE (CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_MAC_SIZE)
@@ -196,32 +181,23 @@ unsigned int onion_getfriend_dht_pubkey(const Onion_Client *onion_c, int friend_
* return the number of packets sent on success
* return -1 on failure.
*/
non_null()
int send_onion_data(Onion_Client *onion_c, int friend_num, const uint8_t *data, uint16_t length);
int send_onion_data(Onion_Client *_Nonnull onion_c, int friend_num, const uint8_t *_Nonnull data, uint16_t length);
typedef int oniondata_handler_cb(void *object, const uint8_t *source_pubkey, const uint8_t *data,
uint16_t length, void *userdata);
typedef int oniondata_handler_cb(void *_Nullable object, const uint8_t *_Nonnull source_pubkey, const uint8_t *_Nonnull data,
uint16_t length, void *_Nullable userdata);
/** Function to call when onion data packet with contents beginning with byte is received. */
non_null(1) nullable(3, 4)
void oniondata_registerhandler(Onion_Client *onion_c, uint8_t byte, oniondata_handler_cb *cb, void *object);
typedef bool onion_group_announce_cb(Onion_Client *onion_c, uint32_t sendback_num, const uint8_t *data,
size_t data_length, void *user_data);
void oniondata_registerhandler(Onion_Client *_Nonnull onion_c, uint8_t byte, oniondata_handler_cb *_Nullable cb, void *_Nullable object);
typedef bool onion_group_announce_cb(Onion_Client *_Nonnull onion_c, uint32_t sendback_num, const uint8_t *_Nonnull data,
size_t data_length, void *_Nullable user_data);
/** Function to call when the onion gets a group announce response. */
non_null(1) nullable(2, 3)
void onion_group_announce_register(Onion_Client *onion_c, onion_group_announce_cb *func, void *user_data);
void onion_group_announce_register(Onion_Client *_Nonnull onion_c, onion_group_announce_cb *_Nullable func, void *_Nullable user_data);
void do_onion_client(Onion_Client *_Nonnull onion_c);
non_null()
void do_onion_client(Onion_Client *onion_c);
non_null()
Onion_Client *new_onion_client(const Logger *logger, const Memory *mem, const Random *rng, const Mono_Time *mono_time, Net_Crypto *c);
nullable(1)
void kill_onion_client(Onion_Client *onion_c);
Onion_Client *_Nullable new_onion_client(const Logger *_Nonnull logger, const Memory *_Nonnull mem, const Random *_Nonnull rng, const Mono_Time *_Nonnull mono_time, Net_Crypto *_Nonnull c);
void kill_onion_client(Onion_Client *_Nullable onion_c);
typedef enum Onion_Connection_Status {
/** We are not connected to the network. */
ONION_CONNECTION_STATUS_NONE = 0,
@@ -231,18 +207,16 @@ typedef enum Onion_Connection_Status {
ONION_CONNECTION_STATUS_UDP = 2,
} Onion_Connection_Status;
non_null()
Onion_Connection_Status onion_connection_status(const Onion_Client *onion_c);
Onion_Connection_Status onion_connection_status(const Onion_Client *_Nonnull onion_c);
typedef struct Onion_Friend Onion_Friend;
non_null() uint16_t onion_get_friend_count(const Onion_Client *onion_c);
non_null() Onion_Friend *onion_get_friend(const Onion_Client *onion_c, uint16_t friend_num);
non_null() const uint8_t *onion_friend_get_gc_public_key(const Onion_Friend *onion_friend);
non_null() const uint8_t *onion_friend_get_gc_public_key_num(const Onion_Client *onion_c, uint32_t num);
non_null() void onion_friend_set_gc_public_key(Onion_Friend *onion_friend, const uint8_t *public_key);
non_null(1) nullable(2)
void onion_friend_set_gc_data(Onion_Friend *onion_friend, const uint8_t *gc_data, uint16_t gc_data_length);
non_null() bool onion_friend_is_groupchat(const Onion_Friend *onion_friend);
uint16_t onion_get_friend_count(const Onion_Client *_Nonnull onion_c);
Onion_Friend *_Nullable onion_get_friend(const Onion_Client *_Nonnull onion_c, uint16_t friend_num);
const uint8_t *_Nullable onion_friend_get_gc_public_key(const Onion_Friend *_Nonnull onion_friend);
const uint8_t *_Nullable onion_friend_get_gc_public_key_num(const Onion_Client *_Nonnull onion_c, uint32_t num);
void onion_friend_set_gc_public_key(Onion_Friend *_Nonnull onion_friend, const uint8_t *_Nonnull public_key);
void onion_friend_set_gc_data(Onion_Friend *_Nonnull onion_friend, const uint8_t *_Nullable gc_data, uint16_t gc_data_length);
bool onion_friend_is_groupchat(const Onion_Friend *_Nonnull onion_friend);
#endif /* C_TOXCORE_TOXCORE_ONION_CLIENT_H */