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

@@ -110,8 +110,7 @@ const IP_Port *friend_conn_get_dht_ip_port(const Friend_Conn *fc)
* @retval true if the friendcon_id is valid.
* @retval false if the friendcon_id is not valid.
*/
non_null()
static bool friendconn_id_valid(const Friend_Connections *fr_c, int friendcon_id)
static bool friendconn_id_valid(const Friend_Connections *_Nonnull fr_c, int friendcon_id)
{
return (unsigned int)friendcon_id < fr_c->num_cons &&
fr_c->conns != nullptr &&
@@ -123,8 +122,7 @@ static bool friendconn_id_valid(const Friend_Connections *fr_c, int friendcon_id
* @retval false if realloc fails.
* @retval true if it succeeds.
*/
non_null()
static bool realloc_friendconns(Friend_Connections *fr_c, uint32_t num)
static bool realloc_friendconns(Friend_Connections *_Nonnull fr_c, uint32_t num)
{
if (num == 0) {
mem_delete(fr_c->mem, fr_c->conns);
@@ -147,8 +145,7 @@ static bool realloc_friendconns(Friend_Connections *fr_c, uint32_t num)
* @retval -1 on failure.
* @return friendcon_id on success.
*/
non_null()
static int create_friend_conn(Friend_Connections *fr_c)
static int create_friend_conn(Friend_Connections *_Nonnull fr_c)
{
for (uint32_t i = 0; i < fr_c->num_cons; ++i) {
if (fr_c->conns[i].status == FRIENDCONN_STATUS_NONE) {
@@ -172,8 +169,7 @@ static int create_friend_conn(Friend_Connections *fr_c)
* @retval -1 on failure.
* @retval 0 on success.
*/
non_null()
static int wipe_friend_conn(Friend_Connections *fr_c, int friendcon_id)
static int wipe_friend_conn(Friend_Connections *_Nonnull fr_c, int friendcon_id)
{
if (!friendconn_id_valid(fr_c, friendcon_id)) {
return -1;
@@ -197,7 +193,7 @@ static int wipe_friend_conn(Friend_Connections *fr_c, int friendcon_id)
return 0;
}
Friend_Conn *get_conn(const Friend_Connections *fr_c, int friendcon_id)
Friend_Conn *_Nullable get_conn(const Friend_Connections *fr_c, int friendcon_id)
{
if (!friendconn_id_valid(fr_c, friendcon_id)) {
return nullptr;
@@ -230,9 +226,7 @@ int getfriend_conn_id_pk(const Friend_Connections *fr_c, const uint8_t *real_pk)
* @retval -1 on failure.
* @retval 0 on success.
*/
non_null()
static int friend_add_tcp_relay(Friend_Connections *fr_c, int friendcon_id, const IP_Port *ip_port,
const uint8_t *public_key)
static int friend_add_tcp_relay(Friend_Connections *_Nonnull fr_c, int friendcon_id, const IP_Port *_Nonnull ip_port, const uint8_t *_Nonnull public_key)
{
IP_Port ipp_copy = *ip_port;
@@ -268,8 +262,7 @@ static int friend_add_tcp_relay(Friend_Connections *fr_c, int friendcon_id, cons
}
/** Connect to number saved relays for friend. */
non_null()
static void connect_to_saved_tcp_relays(Friend_Connections *fr_c, int friendcon_id, unsigned int number)
static void connect_to_saved_tcp_relays(Friend_Connections *_Nonnull fr_c, int friendcon_id, unsigned int number)
{
const Friend_Conn *const friend_con = get_conn(fr_c, friendcon_id);
@@ -289,8 +282,7 @@ static void connect_to_saved_tcp_relays(Friend_Connections *fr_c, int friendcon_
}
}
non_null()
static unsigned int send_relays(Friend_Connections *fr_c, int friendcon_id)
static unsigned int send_relays(Friend_Connections *_Nonnull fr_c, int friendcon_id)
{
Friend_Conn *const friend_con = get_conn(fr_c, friendcon_id);
@@ -330,8 +322,7 @@ static unsigned int send_relays(Friend_Connections *fr_c, int friendcon_id)
}
/** callback for recv TCP relay nodes. */
non_null()
static int tcp_relay_node_callback(void *object, uint32_t number, const IP_Port *ip_port, const uint8_t *public_key)
static int tcp_relay_node_callback(void *_Nonnull object, uint32_t number, const IP_Port *_Nonnull ip_port, const uint8_t *_Nonnull public_key)
{
Friend_Connections *fr_c = (Friend_Connections *)object;
const Friend_Conn *friend_con = get_conn(fr_c, number);
@@ -347,12 +338,10 @@ static int tcp_relay_node_callback(void *object, uint32_t number, const IP_Port
return add_tcp_relay(fr_c->net_crypto, ip_port, public_key);
}
non_null()
static int friend_new_connection(Friend_Connections *fr_c, int friendcon_id);
static int friend_new_connection(Friend_Connections *_Nonnull fr_c, int friendcon_id);
/** Callback for DHT ip_port changes. */
non_null()
static void dht_ip_callback(void *object, int32_t number, const IP_Port *ip_port)
static void dht_ip_callback(void *_Nonnull object, int32_t number, const IP_Port *_Nonnull ip_port)
{
Friend_Connections *const fr_c = (Friend_Connections *)object;
Friend_Conn *const friend_con = get_conn(fr_c, number);
@@ -375,8 +364,7 @@ static void dht_ip_callback(void *object, int32_t number, const IP_Port *ip_port
}
}
non_null()
static void change_dht_pk(Friend_Connections *fr_c, int friendcon_id, const uint8_t *dht_public_key)
static void change_dht_pk(Friend_Connections *_Nonnull fr_c, int friendcon_id, const uint8_t *_Nonnull dht_public_key)
{
Friend_Conn *const friend_con = get_conn(fr_c, friendcon_id);
@@ -398,8 +386,7 @@ static void change_dht_pk(Friend_Connections *fr_c, int friendcon_id, const uint
memcpy(friend_con->dht_temp_pk, dht_public_key, CRYPTO_PUBLIC_KEY_SIZE);
}
non_null()
static int handle_status(void *object, int id, bool status, void *userdata)
static int handle_status(void *_Nonnull object, int id, bool status, void *_Nonnull userdata)
{
Friend_Connections *const fr_c = (Friend_Connections *)object;
Friend_Conn *const friend_con = get_conn(fr_c, id);
@@ -446,8 +433,7 @@ static int handle_status(void *object, int id, bool status, void *userdata)
}
/** Callback for dht public key changes. */
non_null()
static void dht_pk_callback(void *object, int32_t number, const uint8_t *dht_public_key, void *userdata)
static void dht_pk_callback(void *_Nonnull object, int32_t number, const uint8_t *_Nonnull dht_public_key, void *_Nonnull userdata)
{
Friend_Connections *const fr_c = (Friend_Connections *)object;
Friend_Conn *const friend_con = get_conn(fr_c, number);
@@ -473,8 +459,7 @@ static void dht_pk_callback(void *object, int32_t number, const uint8_t *dht_pub
onion_set_friend_dht_pubkey(fr_c->onion_c, friend_con->onion_friendnum, dht_public_key);
}
non_null()
static int handle_packet(void *object, int id, const uint8_t *data, uint16_t length, void *userdata)
static int handle_packet(void *_Nonnull object, int id, const uint8_t *_Nonnull data, uint16_t length, void *_Nonnull userdata)
{
Friend_Connections *const fr_c = (Friend_Connections *)object;
@@ -533,8 +518,7 @@ static int handle_packet(void *object, int id, const uint8_t *data, uint16_t len
return 0;
}
non_null()
static int handle_lossy_packet(void *object, int id, const uint8_t *data, uint16_t length, void *userdata)
static int handle_lossy_packet(void *_Nonnull object, int id, const uint8_t *_Nonnull data, uint16_t length, void *_Nonnull userdata)
{
const Friend_Connections *const fr_c = (const Friend_Connections *)object;
@@ -565,8 +549,7 @@ static int handle_lossy_packet(void *object, int id, const uint8_t *data, uint16
return 0;
}
non_null()
static int handle_new_connections(void *object, const New_Connection *n_c)
static int handle_new_connections(void *_Nonnull object, const New_Connection *_Nonnull n_c)
{
Friend_Connections *const fr_c = (Friend_Connections *)object;
const int friendcon_id = getfriend_conn_id_pk(fr_c, n_c->public_key);
@@ -638,8 +621,7 @@ static int friend_new_connection(Friend_Connections *fr_c, int friendcon_id)
return 0;
}
non_null()
static int send_ping(const Friend_Connections *fr_c, int friendcon_id)
static int send_ping(const Friend_Connections *_Nonnull fr_c, int friendcon_id)
{
Friend_Conn *const friend_con = get_conn(fr_c, friendcon_id);
@@ -832,7 +814,7 @@ int new_friend_connection(Friend_Connections *fr_c, const uint8_t *real_public_k
* @retval -1 on failure.
* @retval 0 on success.
*/
int kill_friend_connection(Friend_Connections *fr_c, int friendcon_id)
int kill_friend_connection(Friend_Connections *_Nonnull fr_c, int friendcon_id)
{
Friend_Conn *const friend_con = get_conn(fr_c, friendcon_id);
@@ -952,8 +934,7 @@ Friend_Connections *new_friend_connections(
}
/** Send a LAN discovery packet every LAN_DISCOVERY_INTERVAL seconds. */
non_null()
static void lan_discovery(Friend_Connections *fr_c)
static void lan_discovery(Friend_Connections *_Nonnull fr_c)
{
if (fr_c->last_lan_discovery + LAN_DISCOVERY_INTERVAL < mono_time_get(fr_c->mono_time)) {
const uint16_t first = fr_c->next_lan_port;