From fca780ffb85da75da805aac040d0886e954a7804 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 22 Feb 2021 16:42:53 +0100 Subject: Allow setting EDI UDP fragment spreading to 0 --- src/DabMux.cpp | 16 ++++++---------- src/zmq2edi/zmq2edi.cpp | 14 ++++++-------- 2 files changed, 12 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/DabMux.cpp b/src/DabMux.cpp index 70eee69..3938131 100644 --- a/src/DabMux.cpp +++ b/src/DabMux.cpp @@ -363,16 +363,12 @@ int main(int argc, char *argv[]) edi_conf.chunk_len = pt_edi.get("chunk_len", 207); int spread_percent = pt_edi.get("packet_spread", 95); - if (spread_percent != 0) { - if (spread_percent < 0) { - throw std::runtime_error("EDI output: negative packet_spread value is invalid."); - } - - edi_conf.fragment_spreading_factor = (double)spread_percent / 100.0; - - if (edi_conf.fragment_spreading_factor > 30000) { - throw std::runtime_error("EDI output: interleaving set for more than 30 seconds!"); - } + if (spread_percent < 0) { + throw std::runtime_error("EDI output: negative packet_spread value is invalid."); + } + edi_conf.fragment_spreading_factor = (double)spread_percent / 100.0; + if (edi_conf.fragment_spreading_factor > 30000) { + throw std::runtime_error("EDI output: interleaving set for more than 30 seconds!"); } edi_conf.tagpacket_alignment = pt_edi.get("tagpacket_alignment", 8); diff --git a/src/zmq2edi/zmq2edi.cpp b/src/zmq2edi/zmq2edi.cpp index bd5a3ae..cff16c7 100644 --- a/src/zmq2edi/zmq2edi.cpp +++ b/src/zmq2edi/zmq2edi.cpp @@ -274,15 +274,13 @@ int start(int argc, char **argv) case 'i': { int spread_percent = std::stoi(optarg); - if (spread_percent != 0) { - if (spread_percent < 0) { - throw std::runtime_error("EDI output: negative spread value is invalid."); - } + if (spread_percent < 0) { + throw std::runtime_error("EDI output: negative spread value is invalid."); + } - edi_conf.fragment_spreading_factor = (double)spread_percent / 100.0; - if (edi_conf.fragment_spreading_factor > 30000) { - throw std::runtime_error("EDI output: interleaving set for more than 30 seconds!"); - } + edi_conf.fragment_spreading_factor = (double)spread_percent / 100.0; + if (edi_conf.fragment_spreading_factor > 30000) { + throw std::runtime_error("EDI output: interleaving set for more than 30 seconds!"); } } break; -- cgit v1.2.3