aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/edioutput/EDIConfig.h3
-rw-r--r--lib/edioutput/Transport.cpp16
-rw-r--r--lib/fec/decode_rs.h12
-rw-r--r--src/DabMux.cpp8
4 files changed, 24 insertions, 15 deletions
diff --git a/lib/edioutput/EDIConfig.h b/lib/edioutput/EDIConfig.h
index 7016e87..de4217f 100644
--- a/lib/edioutput/EDIConfig.h
+++ b/lib/edioutput/EDIConfig.h
@@ -27,6 +27,7 @@
#pragma once
+#include <optional>
#include <vector>
#include <string>
#include <memory>
@@ -60,7 +61,7 @@ struct udp_destination_t : public destination_t {
uint16_t dest_port = 0;
std::string source_addr;
uint16_t source_port = 0;
- uint8_t ttl = 10;
+ std::optional<uint8_t> ttl = std::nullopt;
};
// TCP server that can accept multiple connections
diff --git a/lib/edioutput/Transport.cpp b/lib/edioutput/Transport.cpp
index e9559b5..6707a90 100644
--- a/lib/edioutput/Transport.cpp
+++ b/lib/edioutput/Transport.cpp
@@ -41,10 +41,15 @@ void configuration_t::print() const
if (auto udp_dest = dynamic_pointer_cast<edi::udp_destination_t>(edi_dest)) {
etiLog.level(info) << " UDP to " << udp_dest->dest_addr << ":" << udp_dest->dest_port;
if (not udp_dest->source_addr.empty()) {
- etiLog.level(info) << " source " << udp_dest->source_addr;
- etiLog.level(info) << " ttl " << udp_dest->ttl;
+ etiLog.level(info) << " source address=" << udp_dest->source_addr;
}
- etiLog.level(info) << " source port " << udp_dest->source_port;
+ if (udp_dest->ttl) {
+ etiLog.level(info) << " ttl=" << (int)(*udp_dest->ttl);
+ }
+ else {
+ etiLog.level(info) << " ttl=(default)";
+ }
+ etiLog.level(info) << " source port=" << udp_dest->source_port;
}
else if (auto tcp_dest = dynamic_pointer_cast<edi::tcp_server_t>(edi_dest)) {
etiLog.level(info) << " TCP listening on port " << tcp_dest->listen_port;
@@ -80,7 +85,10 @@ Sender::Sender(const configuration_t& conf) :
if (not udp_dest->source_addr.empty()) {
udp_socket.setMulticastSource(udp_dest->source_addr.c_str());
- udp_socket.setMulticastTTL(udp_dest->ttl);
+ }
+
+ if (udp_dest->ttl) {
+ udp_socket.setMulticastTTL(*udp_dest->ttl);
}
auto sender = make_shared<udp_sender_t>(
diff --git a/lib/fec/decode_rs.h b/lib/fec/decode_rs.h
index c165cf3..647b885 100644
--- a/lib/fec/decode_rs.h
+++ b/lib/fec/decode_rs.h
@@ -145,15 +145,15 @@
count++;
}
if (count != no_eras) {
- printf("count = %d no_eras = %d\n lambda(x) is WRONG\n",count,no_eras);
+ fprintf(stderr, "count = %d no_eras = %d\n lambda(x) is WRONG\n",count,no_eras);
count = -1;
goto finish;
}
#if DEBUG >= 2
- printf("\n Erasure positions as determined by roots of Eras Loc Poly:\n");
+ fprintf(stderr, "\n Erasure positions as determined by roots of Eras Loc Poly:\n");
for (i = 0; i < count; i++)
- printf("%d ", loc[i]);
- printf("\n");
+ fprintf(stderr, "%d ", loc[i]);
+ fprintf(stderr, "\n");
#endif
#endif
}
@@ -227,7 +227,7 @@
continue; /* Not a root */
/* store root (index-form) and error location number */
#if DEBUG>=2
- printf("count %d root %d loc %d\n",count,i,k);
+ fprintf(stderr, "count %d root %d loc %d\n",count,i,k);
#endif
root[count] = i;
loc[count] = k;
@@ -279,7 +279,7 @@
}
#if DEBUG >= 1
if (den == 0) {
- printf("\n ERROR: denominator = 0\n");
+ fprintf(stderr, "\n ERROR: denominator = 0\n");
count = -1;
goto finish;
}
diff --git a/src/DabMux.cpp b/src/DabMux.cpp
index bf525c1..75788d8 100644
--- a/src/DabMux.cpp
+++ b/src/DabMux.cpp
@@ -352,10 +352,9 @@ int main(int argc, char *argv[])
pft_settings.enable_pft = pt.get<bool>("enable_pft", default_enable_pft);
pft_settings.fec = pt.get<unsigned int>("fec", default_fec);
pft_settings.fragment_spreading_factor = default_spreading_factor;
- auto override_spread_percent = pt.get_optional<int>("packet_spread");
- if (override_spread_percent) {
+ if (auto override_spread_percent = pt.get_optional<int>("packet_spread"))
pft_settings.fragment_spreading_factor = check_spreading_factor(*override_spread_percent);
- }
+
pft_settings.verbose = pt.get<bool>("verbose", edi_conf.verbose);
};
@@ -364,7 +363,8 @@ int main(int argc, char *argv[])
if (proto == "udp") {
auto dest = make_shared<edi::udp_destination_t>();
dest->dest_addr = pt_edi_dest.second.get<string>("destination");
- dest->ttl = pt_edi_dest.second.get<unsigned int>("ttl", 1);
+ if (auto ttl = pt_edi_dest.second.get_optional<unsigned int>("ttl"))
+ dest->ttl = *ttl;
dest->source_addr = pt_edi_dest.second.get<string>("source", "");
dest->source_port = pt_edi_dest.second.get<unsigned int>("sourceport");