Browse Source

Timestamp video availability before receive worker scheduling

master
evgeny 3 days ago
parent
commit
eb43876bb6
  1. 1
      src/call/call_video.h
  2. 5
      src/call/call_video_port.c

1
src/call/call_video.h

@ -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);

5
src/call/call_video_port.c

@ -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);

Loading…
Cancel
Save