enabled slowdown logic for sinks

This commit is contained in:
Devaev Maxim
2021-01-11 04:11:05 +03:00
parent 5aa9a4b7a0
commit 4bedf7d286
8 changed files with 30 additions and 34 deletions

View File

@@ -113,6 +113,7 @@ int memsink_server_put(memsink_s *sink, const frame_s *frame) {
COPY(grab_ts);
COPY(encode_begin_ts);
COPY(encode_end_ts);
sink->has_clients = (sink->mem->last_consumed_ts + 10 > get_now_monotonic());
memcpy(sink->mem->data, frame->data, frame->used);
# undef COPY
@@ -159,6 +160,7 @@ int memsink_client_get(memsink_s *sink, frame_s *frame) { // cppcheck-suppress u
COPY(grab_ts);
COPY(encode_begin_ts);
COPY(encode_end_ts);
sink->mem->last_consumed_ts = get_now_monotonic();
frame_set_data(frame, sink->mem->data, sink->mem->used);
# undef COPY
}

View File

@@ -56,6 +56,7 @@ typedef struct {
long double grab_ts;
long double encode_begin_ts;
long double encode_end_ts;
long double last_consumed_ts;
uint8_t data[MEMSINK_MAX_DATA];
} memsink_shared_s;
@@ -69,6 +70,7 @@ typedef struct {
int fd;
memsink_shared_s *mem;
uint64_t last_id;
bool has_clients; // Only for server
} memsink_s;