Skip to content

Commit 12e3d9b

Browse files
committed
hd-rum-translator: warn if fec spec w/o compress
Warn if FEC is specified without compression. In this case, packet-forwarding is created and no FEC is added. This behavior has there been all the time - either we use simple packet forwarding or do the whole re-compression/re-packetization stuff. We'd need also the compression specified (there is AFAIK no pass-through keeping compression). the same also for capture filter
1 parent 34804de commit 12e3d9b

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

src/hd-rum-translator/hd-rum-translator.cpp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ struct hd_rum_translator_state {
184184
vector<replica *> replicas;
185185
std::shared_ptr<socket_udp> server_socket;
186186
void *decompress = nullptr;
187+
bool capture_filter_set = false;
187188
struct state_recompress *recompress = nullptr;
188189
};
189190

@@ -331,6 +332,23 @@ static VOID CALLBACK wsa_deleter(DWORD /* dwErrorCode */,
331332
}
332333
#endif
333334

335+
/// prints a warning if there is a setting not applicable on forward-only port
336+
static void
337+
print_unapplied_config_warns(const char *fec, bool cap_filter_used)
338+
{
339+
if (fec != nullptr) {
340+
MSG(WARNING, "Requested FEC for forwarding-only port "
341+
"won't be applied, compression "
342+
"specification required alongside!\n");
343+
handle_error(1); // exit if user requested strict error handling
344+
}
345+
if (cap_filter_used) {
346+
MSG(WARNING, "Requested capture filter won't be applied for "
347+
"forwarding-only output port.\n");
348+
handle_error(1); // exit if user requested strict error handling
349+
}
350+
}
351+
334352
static int create_output_port(struct hd_rum_translator_state *s,
335353
const char *addr, int rx_port, int tx_port, int bufsize,
336354
struct rxtx_params *opts,const char *compression, const char *fec,
@@ -351,7 +369,11 @@ static int create_output_port(struct hd_rum_translator_state *s,
351369
}
352370
s->replicas.push_back(rep);
353371

354-
rep->type = compression ? replica::type_t::RECOMPRESS : replica::type_t::USE_SOCK;
372+
rep->type = replica::type_t::RECOMPRESS;
373+
if (compression == nullptr) {
374+
rep->type = replica::type_t::USE_SOCK;
375+
print_unapplied_config_warns(fec, s->capture_filter_set);
376+
}
355377
int idx = recompress_add_port(s->recompress,
356378
addr, compression ? compression : "none",
357379
0, tx_port, opts, &rep->mod, fec, bitrate);
@@ -1104,6 +1126,7 @@ int main(int argc, char **argv)
11041126
if(!state.decompress) {
11051127
EXIT(EXIT_FAIL_DECODER);
11061128
}
1129+
state.capture_filter_set = params.capture_filter != nullptr;
11071130

11081131
if(params.server_port > 0){
11091132
state.server_socket = std::shared_ptr<socket_udp>(udp_init("localhost", params.server_port, 0, 255, 0, false), udp_exit);
@@ -1131,7 +1154,7 @@ int main(int argc, char **argv)
11311154

11321155
int idx = create_output_port(&state,
11331156
h.addr, rx_port, tx_port, state.bufsize, &h.rxtx_opts,
1134-
h.compression, h.compression ? h.fec : nullptr, h.bitrate);
1157+
h.compression, h.fec, h.bitrate);
11351158
if(idx < 0) {
11361159
EXIT(EXIT_FAILURE);
11371160
}

0 commit comments

Comments
 (0)