From 6edb7a228b5e638e9846d3c418ea2bb15b79ffbc Mon Sep 17 00:00:00 2001 From: Green Sky Date: Tue, 15 Sep 2026 12:25:23 +0200 Subject: [PATCH] chore(toxav): ignore video rtp messages without payload Successfully encoded video frames always have data, so we can safely ignore those for video. --- toxav/rtp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/toxav/rtp.c b/toxav/rtp.c index 5335b573c..0298e1cdb 100644 --- a/toxav/rtp.c +++ b/toxav/rtp.c @@ -526,6 +526,11 @@ static void update_bwc_values(RTPSession *_Nonnull session, const struct RTPMess static int handle_video_packet(const Logger *_Nonnull log, RTPSession *_Nonnull session, const struct RTPHeader *_Nonnull header, const uint8_t *_Nonnull incoming_data, uint16_t incoming_data_length) { + if (incoming_data_length == 0) { + // video always has a payload, ignore + return -1; + } + // Full frame length in bytes. The frame may be split into multiple packets, // but this value is the complete assembled frame size. const uint32_t full_frame_length = header->data_length_full; @@ -634,7 +639,7 @@ void rtp_receive_packet(RTPSession *session, const uint8_t *data, size_t length) // Get the packet type. const uint8_t packet_type = data[0]; const uint8_t *payload = &data[1]; - // TODO(Zoff): is this ok? + assert(length - 1 < UINT16_MAX); const uint16_t payload_size = (uint16_t)length - 1; // Unpack the header.