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