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

@@ -53,52 +53,45 @@ typedef enum Friendconn_Status {
typedef struct Friend_Connections Friend_Connections;
non_null() Net_Crypto *friendconn_net_crypto(const Friend_Connections *fr_c);
Net_Crypto *_Nonnull friendconn_net_crypto(const Friend_Connections *_Nonnull fr_c);
/** @return friendcon_id corresponding to the real public key on success.
/**
* @return friendcon_id corresponding to the real public key on success.
* @retval -1 on failure.
*/
non_null()
int getfriend_conn_id_pk(const Friend_Connections *fr_c, const uint8_t *real_pk);
int getfriend_conn_id_pk(const Friend_Connections *_Nonnull fr_c, const uint8_t *_Nonnull real_pk);
/** @brief Increases lock_count for the connection with friendcon_id by 1.
*
* @retval 0 on success.
* @retval -1 on failure.
*/
non_null()
int friend_connection_lock(const Friend_Connections *fr_c, int friendcon_id);
int friend_connection_lock(const Friend_Connections *_Nonnull fr_c, int friendcon_id);
/**
* @retval FRIENDCONN_STATUS_CONNECTED if the friend is connected.
* @retval FRIENDCONN_STATUS_CONNECTING if the friend isn't connected.
* @retval FRIENDCONN_STATUS_NONE on failure.
*/
non_null()
unsigned int friend_con_connected(const Friend_Connections *fr_c, int friendcon_id);
unsigned int friend_con_connected(const Friend_Connections *_Nonnull fr_c, int friendcon_id);
/** @brief Copy public keys associated to friendcon_id.
*
* @retval 0 on success.
* @retval -1 on failure.
*/
non_null(3) nullable(1, 2)
int get_friendcon_public_keys(uint8_t *real_pk, uint8_t *dht_temp_pk, const Friend_Connections *fr_c, int friendcon_id);
int get_friendcon_public_keys(uint8_t *_Nullable real_pk, uint8_t *_Nullable dht_temp_pk, const Friend_Connections *_Nonnull fr_c, int friendcon_id);
/** Set temp dht key for connection. */
non_null()
void set_dht_temp_pk(Friend_Connections *fr_c, int friendcon_id, const uint8_t *dht_temp_pk, void *userdata);
void set_dht_temp_pk(Friend_Connections *_Nonnull fr_c, int friendcon_id, const uint8_t *_Nonnull dht_temp_pk, void *_Nonnull userdata);
typedef int global_status_cb(void *object, int friendcon_id, bool status, void *userdata);
typedef int global_status_cb(void *_Nullable object, int friendcon_id, bool status, void *_Nullable userdata);
typedef int fc_status_cb(void *object, int friendcon_id, bool status, void *userdata);
typedef int fc_data_cb(void *object, int friendcon_id, const uint8_t *data, uint16_t length, void *userdata);
typedef int fc_lossy_data_cb(void *object, int friendcon_id, const uint8_t *data, uint16_t length, void *userdata);
typedef int fc_status_cb(void *_Nullable object, int friendcon_id, bool status, void *_Nullable userdata);
typedef int fc_data_cb(void *_Nullable object, int friendcon_id, const uint8_t *_Nonnull data, uint16_t length, void *_Nullable userdata);
typedef int fc_lossy_data_cb(void *_Nullable object, int friendcon_id, const uint8_t *_Nonnull data, uint16_t length, void *_Nullable userdata);
/** Set global status callback for friend connections. */
non_null(1) nullable(2, 3)
void set_global_status_callback(Friend_Connections *fr_c, global_status_cb *global_status_callback, void *object);
void set_global_status_callback(Friend_Connections *_Nonnull fr_c, global_status_cb *_Nullable global_status_callback, void *_Nullable object);
/** @brief Set the callbacks for the friend connection.
* @param index is the index (0 to (MAX_FRIEND_CONNECTION_CALLBACKS - 1)) we
* want the callback to set in the array.
@@ -106,20 +99,17 @@ void set_global_status_callback(Friend_Connections *fr_c, global_status_cb *glob
* @retval 0 on success.
* @retval -1 on failure
*/
non_null(1) nullable(4, 5, 6, 7)
int friend_connection_callbacks(const Friend_Connections *fr_c, int friendcon_id, unsigned int index,
fc_status_cb *status_callback,
fc_data_cb *data_callback,
fc_lossy_data_cb *lossy_data_callback,
void *object, int number);
int friend_connection_callbacks(const Friend_Connections *_Nonnull fr_c, int friendcon_id, unsigned int index,
fc_status_cb *_Nullable status_callback,
fc_data_cb *_Nullable data_callback,
fc_lossy_data_cb *_Nullable lossy_data_callback,
void *_Nullable object, int number);
/** @brief return the crypt_connection_id for the connection.
*
* @return crypt_connection_id on success.
* @retval -1 on failure.
*/
non_null()
int friend_connection_crypt_connection_id(const Friend_Connections *fr_c, int friendcon_id);
int friend_connection_crypt_connection_id(const Friend_Connections *_Nonnull fr_c, int friendcon_id);
/** @brief Create a new friend connection.
* If one to that real public key already exists, increase lock count and return it.
@@ -127,16 +117,14 @@ int friend_connection_crypt_connection_id(const Friend_Connections *fr_c, int fr
* @retval -1 on failure.
* @return connection id on success.
*/
non_null()
int new_friend_connection(Friend_Connections *fr_c, const uint8_t *real_public_key);
int new_friend_connection(Friend_Connections *_Nonnull fr_c, const uint8_t *_Nonnull real_public_key);
/** @brief Kill a friend connection.
*
* @retval -1 on failure.
* @retval 0 on success.
*/
non_null()
int kill_friend_connection(Friend_Connections *fr_c, int friendcon_id);
int kill_friend_connection(Friend_Connections *_Nonnull fr_c, int friendcon_id);
/** @brief Send a Friend request packet.
*
@@ -144,38 +132,30 @@ int kill_friend_connection(Friend_Connections *fr_c, int friendcon_id);
* @retval 0 if it sent the friend request directly to the friend.
* @return the number of peers it was routed through if it did not send it directly.
*/
non_null()
int send_friend_request_packet(
Friend_Connections *fr_c, int friendcon_id, uint32_t nospam_num, const uint8_t *data, uint16_t length);
int send_friend_request_packet(Friend_Connections *_Nonnull fr_c, int friendcon_id, uint32_t nospam_num, const uint8_t *_Nonnull data, uint16_t length);
typedef int fr_request_cb(
void *object, const uint8_t *source_pubkey, const uint8_t *data, uint16_t length, void *userdata);
void *_Nonnull object, const uint8_t *_Nonnull source_pubkey, const uint8_t *_Nonnull data, uint16_t length, void *_Nullable userdata);
/** @brief Set friend request callback.
*
* This function will be called every time a friend request packet is received.
*/
non_null()
void set_friend_request_callback(Friend_Connections *fr_c, fr_request_cb *fr_request_callback, void *object);
void set_friend_request_callback(Friend_Connections *_Nonnull fr_c, fr_request_cb *_Nonnull fr_request_callback, void *_Nonnull object);
/** Create new friend_connections instance. */
non_null()
Friend_Connections *new_friend_connections(
const Logger *logger, const Memory *mem, const Mono_Time *mono_time, const Network *ns,
Onion_Client *onion_c, bool local_discovery_enabled);
Friend_Connections *_Nullable new_friend_connections(const Logger *_Nonnull logger, const Memory *_Nonnull mem, const Mono_Time *_Nonnull mono_time, const Network *_Nonnull ns,
Onion_Client *_Nonnull onion_c, bool local_discovery_enabled);
/** main friend_connections loop. */
non_null()
void do_friend_connections(Friend_Connections *fr_c, void *userdata);
void do_friend_connections(Friend_Connections *_Nonnull fr_c, void *_Nonnull userdata);
/** Free everything related with friend_connections. */
nullable(1)
void kill_friend_connections(Friend_Connections *fr_c);
void kill_friend_connections(Friend_Connections *_Nullable fr_c);
typedef struct Friend_Conn Friend_Conn;
non_null() Friend_Conn *get_conn(const Friend_Connections *fr_c, int friendcon_id);
non_null() int friend_conn_get_onion_friendnum(const Friend_Conn *fc);
non_null() const IP_Port *friend_conn_get_dht_ip_port(const Friend_Conn *fc);
Friend_Conn *_Nullable get_conn(const Friend_Connections *_Nonnull fr_c, int friendcon_id);
int friend_conn_get_onion_friendnum(const Friend_Conn *_Nonnull fc);
const IP_Port *_Nullable friend_conn_get_dht_ip_port(const Friend_Conn *_Nonnull fc);
#endif /* C_TOXCORE_TOXCORE_FRIEND_CONNECTION_H */