Timestamp video availability before receive worker scheduling

This commit is contained in:
evgeny committed 2026-10-15 15:57:05 +02:00
1 parent 408c0be021
commit eb43876bb6
2 files changed
+5 -1

No files matched your search

+1
View File
@@ -50,6 +50,7 @@ struct call_video_frame {
uint32_t size, offset, length;
uint8_t flags;
const uint8_t *data;
int64_t received_us; // Только локальная RX port метка MONOTONIC; по сети не передаётся.
};
int call_video_caps_valid(const struct call_video_caps *caps);
+4 -1
View File
@@ -1,4 +1,5 @@
#include "call_video_port.h"
#include "call_video_playout.h"
#include "call_video_transport.h"
#include "call_priv.h"
#include "../chat/chat_setting.h"
@@ -53,11 +54,13 @@ static int ready(void *arg, uint32_t bytes) {
pthread_mutex_unlock(&lock); return result;
}
static void frame(void *arg, const struct call_video_frame *f) {
int64_t received = call_video_playout_now_us();
pthread_mutex_lock(&lock);
if (port.id == (uint64_t)(uintptr_t)arg && port.count < 8 && f->size <= 4u * 1024u * 1024u - port.bytes) {
uint8_t *data = u_malloc(f->size);
if (data) {
memcpy(data, f->data, f->size); port.rx[port.count] = *f; port.rx[port.count++].data = data; port.bytes += f->size;
memcpy(data, f->data, f->size); port.rx[port.count] = *f;
port.rx[port.count].received_us = received; port.rx[port.count++].data = data; port.bytes += f->size;
} else { DEBUG_ERROR(DEBUG_CATEGORY_CALL, "video port RX allocation failed bytes=%u", f->size); port.key = 1; schedule(); }
} else { DEBUG_WARN(DEBUG_CATEGORY_CALL, "video port RX changed during delivery"); port.key = 1; schedule(); }
pthread_mutex_unlock(&lock);