mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 11:40:22 +00:00
hd-rum-translator: add new_message callback
if no data is comming, the messages are not dispatched Maybe not a big problem, it would be dispatched when some data arives. The potential problem, however, can be if added huge number of participants at that time, the queue may overflow and further message dropped. (Current max queue len is 10 - maybe it can be extended later.)
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
* compresses and sends frame to receiver
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2013-2025 CESNET
|
||||
* Copyright (c) 2013-2026 CESNET, zájmové sdružení právnických osob
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -103,6 +103,8 @@ set_replica_mod_name(size_t buflen, char *buf, const char *addr,
|
||||
assert(len < buflen); // len >= buflen means overflow
|
||||
}
|
||||
|
||||
static void new_message_received(struct module *);
|
||||
|
||||
struct replica {
|
||||
replica(const char *addr, uint16_t rx_port, uint16_t tx_port, int bufsize, struct module *parent, int force_ip_version) {
|
||||
magic = REPLICA_MAGIC;
|
||||
@@ -122,6 +124,7 @@ struct replica {
|
||||
mod.cls = MODULE_CLASS_PORT;
|
||||
set_replica_mod_name(sizeof mod.name, mod.name, addr, tx_port);
|
||||
mod.priv_data = this;
|
||||
mod.new_message = new_message_received;
|
||||
module_register(&mod, parent);
|
||||
type = replica::type_t::NONE;
|
||||
}
|
||||
@@ -537,6 +540,16 @@ static void *writer(void *arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
new_message_received(struct module *m)
|
||||
{
|
||||
auto *s = (struct hd_rum_translator_state *) m->priv_data;
|
||||
pthread_mutex_lock(&s->qempty_mtx);
|
||||
s->qempty = 0;
|
||||
pthread_mutex_unlock(&s->qempty_mtx);
|
||||
pthread_cond_signal(&s->qempty_cond);
|
||||
}
|
||||
|
||||
static void usage(const char *progname) {
|
||||
col() << "Usage:\n\t"
|
||||
<< SBOLD(SRED(progname)
|
||||
|
||||
Reference in New Issue
Block a user