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

@@ -87,21 +87,18 @@ bool create_forward_chain_packet(const uint8_t *chain_keys, uint16_t chain_lengt
return true;
}
non_null()
static uint16_t forwarding_packet_length(uint16_t sendback_data_len, uint16_t data_length)
{
const uint16_t sendback_len = sendback_data_len == 0 ? 0 : TIMED_AUTH_SIZE + sendback_data_len;
return 1 + 1 + sendback_len + data_length;
}
non_null(1, 4, 6) nullable(2)
static bool create_forwarding_packet(const Forwarding *forwarding,
const uint8_t *sendback_data, uint16_t sendback_data_len,
const uint8_t *data, uint16_t length,
uint8_t *packet)
static bool create_forwarding_packet(const Forwarding *_Nonnull forwarding,
const uint8_t *_Nullable sendback_data, uint16_t sendback_data_len,
const uint8_t *_Nonnull data, uint16_t length,
uint8_t *_Nonnull packet)
{
packet[0] = NET_PACKET_FORWARDING;
if (sendback_data_len == 0) {
packet[1] = 0;
memcpy(packet + 1 + 1, data, length);
@@ -143,10 +140,9 @@ bool send_forwarding(const Forwarding *forwarding, const IP_Port *dest,
#define FORWARD_REQUEST_MIN_PACKET_SIZE (1 + CRYPTO_PUBLIC_KEY_SIZE)
non_null(1) nullable(2, 4)
static bool handle_forward_request_dht(const Forwarding *forwarding,
const uint8_t *sendback_data, uint16_t sendback_data_len,
const uint8_t *packet, uint16_t length)
static bool handle_forward_request_dht(const Forwarding *_Nonnull forwarding,
const uint8_t *_Nullable sendback_data, uint16_t sendback_data_len,
const uint8_t *_Nullable packet, uint16_t length)
{
if (length < FORWARD_REQUEST_MIN_PACKET_SIZE) {
return false;
@@ -170,12 +166,10 @@ static bool handle_forward_request_dht(const Forwarding *forwarding,
return route_packet(forwarding->dht, public_key, forwarding_packet, len) == len;
}
non_null(1, 2) nullable(3, 5)
static int handle_forward_request(void *object, const IP_Port *source, const uint8_t *packet, uint16_t length,
void *userdata)
static int handle_forward_request(void *_Nonnull object, const IP_Port *_Nonnull source, const uint8_t *_Nullable packet, uint16_t length,
void *_Nullable userdata)
{
const Forwarding *forwarding = (const Forwarding *)object;
uint8_t sendback_data[1 + MAX_PACKED_IPPORT_SIZE];
sendback_data[0] = SENDBACK_IPPORT;
@@ -191,12 +185,10 @@ static int handle_forward_request(void *object, const IP_Port *source, const uin
#define MIN_NONEMPTY_SENDBACK_SIZE TIMED_AUTH_SIZE
#define FORWARD_REPLY_MIN_PACKET_SIZE (1 + 1 + MIN_NONEMPTY_SENDBACK_SIZE)
non_null(1, 2) nullable(3, 5)
static int handle_forward_reply(void *object, const IP_Port *source, const uint8_t *packet, uint16_t length,
void *userdata)
static int handle_forward_reply(void *_Nonnull object, const IP_Port *_Nonnull source, const uint8_t *_Nullable packet, uint16_t length,
void *_Nullable userdata)
{
const Forwarding *forwarding = (const Forwarding *)object;
if (length < FORWARD_REPLY_MIN_PACKET_SIZE) {
return 1;
}
@@ -265,12 +257,10 @@ static int handle_forward_reply(void *object, const IP_Port *source, const uint8
#define FORWARDING_MIN_PACKET_SIZE (1 + 1)
non_null(1, 2) nullable(3, 5)
static int handle_forwarding(void *object, const IP_Port *source, const uint8_t *packet, uint16_t length,
void *userdata)
static int handle_forwarding(void *_Nonnull object, const IP_Port *_Nonnull source, const uint8_t *_Nullable packet, uint16_t length,
void *_Nullable userdata)
{
const Forwarding *forwarding = (const Forwarding *)object;
if (length < FORWARDING_MIN_PACKET_SIZE) {
return 1;
}
@@ -358,7 +348,7 @@ void set_callback_forward_reply(Forwarding *forwarding, forward_reply_cb *functi
forwarding->forward_reply_callback_object = object;
}
Forwarding *new_forwarding(const Logger *log, const Memory *mem, const Random *rng, const Mono_Time *mono_time, DHT *dht)
Forwarding *_Nullable new_forwarding(const Logger *log, const Memory *mem, const Random *rng, const Mono_Time *mono_time, DHT *dht)
{
if (log == nullptr || mono_time == nullptr || dht == nullptr) {
return nullptr;