mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-07-23 12:12:05 +00:00
enabled slowdown logic for sinks
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user