aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2022-08-22 17:14:23 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2022-08-22 17:14:23 +0200
commit210336e55efa9ccc6295f8767935570532e80a41 (patch)
treea45201636c81474a7966692551a59efc0e78df2d
parente2929565c4a0d2bcacae1d30a126d72a45061501 (diff)
downloaddabmux-210336e55efa9ccc6295f8767935570532e80a41.tar.gz
dabmux-210336e55efa9ccc6295f8767935570532e80a41.tar.bz2
dabmux-210336e55efa9ccc6295f8767935570532e80a41.zip
Add pre-roll burst config setting
This includes Common 306b5fc
-rw-r--r--doc/example.mux13
-rw-r--r--lib/edioutput/EDIConfig.h6
-rw-r--r--lib/edioutput/Transport.cpp4
-rw-r--r--src/DabMux.cpp8
4 files changed, 18 insertions, 13 deletions
diff --git a/doc/example.mux b/doc/example.mux
index 6682f0a..03fb3f0 100644
--- a/doc/example.mux
+++ b/doc/example.mux
@@ -50,6 +50,11 @@ general {
; your file is still valid.
tist false
+ ; On startup, the timestamp is initialised to system time. If you want
+ ; to add an offset, uncomment the following line and give a number
+ ; in seconds.
+ ; tist_offset 0
+
; The URLs used to fetch the TAI bulletin can be overridden if needed.
; URLs are given as a pipe-separated list, and the default value is:
;tai_clock_bulletins "https://www.ietf.org/timezones/data/leap-seconds.list|https://raw.githubusercontent.com/eggert/tz/master/leap-seconds.list"
@@ -285,13 +290,15 @@ outputs {
edi {
; Example EDI-over-TCP output
; If TIST is enabled, requires leap-second information
- ;
- ; When a new client connects, it will receive a pre-roll of 1.5x tist_offset seconds
- ; worth of EDI data, so that it can quickly fill its buffers.
destinations {
example_tcp {
protocol tcp
listenport 13000
+ ; (Optional) When a new client connects, it will receive a pre-roll burst of EDI data, so that it can quickly fill
+ ; its buffers. The value given is the duration of the pre-roll in seconds.
+ ; It makes sense to have a value slightly larger than tist-offset to ensure the destination will receive
+ ; data that will allow it to start transmitting immediately.
+ ;preroll-burst 2.0
}
}
}
diff --git a/lib/edioutput/EDIConfig.h b/lib/edioutput/EDIConfig.h
index a7225a7..1997210 100644
--- a/lib/edioutput/EDIConfig.h
+++ b/lib/edioutput/EDIConfig.h
@@ -53,6 +53,9 @@ struct udp_destination_t : public destination_t {
struct tcp_server_t : public destination_t {
unsigned int listen_port = 0;
size_t max_frames_queued = 1024;
+
+ // The TCP Server output can preroll a fixed number of previous buffers each time a new client connects.
+ size_t tcp_server_preroll_buffers = 0;
};
// TCP client that connects to one endpoint
@@ -74,9 +77,6 @@ struct configuration_t {
// Spread transmission of fragments in time. 1.0 = 100% means spreading over the whole duration of a frame (24ms)
// Above 100% means that the fragments are spread over several 24ms periods, interleaving the AF packets.
- // TCP Server output can preroll a fixed number of previous buffers each time a new client connects.
- size_t tcp_server_preroll_buffers = 0;
-
bool enabled() const { return destinations.size() > 0; }
void print() const;
diff --git a/lib/edioutput/Transport.cpp b/lib/edioutput/Transport.cpp
index a870aa0..8ebb9fc 100644
--- a/lib/edioutput/Transport.cpp
+++ b/lib/edioutput/Transport.cpp
@@ -66,7 +66,7 @@ Sender::Sender(const configuration_t& conf) :
edi_pft(m_conf)
{
if (m_conf.verbose) {
- etiLog.level(info) << "Setup EDI Output, TCP output preroll " << m_conf.tcp_server_preroll_buffers;
+ etiLog.level(info) << "Setup EDI Output";
}
for (const auto& edi_dest : m_conf.destinations) {
@@ -82,7 +82,7 @@ Sender::Sender(const configuration_t& conf) :
}
else if (auto tcp_dest = dynamic_pointer_cast<edi::tcp_server_t>(edi_dest)) {
auto dispatcher = make_shared<Socket::TCPDataDispatcher>(
- tcp_dest->max_frames_queued, m_conf.tcp_server_preroll_buffers);
+ tcp_dest->max_frames_queued, tcp_dest->tcp_server_preroll_buffers);
dispatcher->start(tcp_dest->listen_port, "0.0.0.0");
tcp_dispatchers.emplace(tcp_dest.get(), dispatcher);
diff --git a/src/DabMux.cpp b/src/DabMux.cpp
index 4373265..f6a69bb 100644
--- a/src/DabMux.cpp
+++ b/src/DabMux.cpp
@@ -348,6 +348,9 @@ int main(int argc, char *argv[])
auto dest = make_shared<edi::tcp_server_t>();
dest->listen_port = pt_edi_dest.second.get<unsigned int>("listenport");
dest->max_frames_queued = pt_edi_dest.second.get<size_t>("max_frames_queued", 500);
+ double preroll = pt_edi_dest.second.get<double>("preroll-burst", 0.0);
+ dest->tcp_server_preroll_buffers = ceil(preroll / 24e-3);
+
edi_conf.destinations.push_back(dest);
}
else {
@@ -355,11 +358,6 @@ int main(int argc, char *argv[])
}
}
- const auto tist_offset = pt.get<int>("general.tist_offset", 0);
- // By keeping 1.5 x tist_offset worth of EDI in the pre-roll buffer, we ensure that a new client can
- // immediately send out frames according to their timestamp.
- edi_conf.tcp_server_preroll_buffers = ceil(1.5 * (tist_offset / 24e-3));
-
edi_conf.dump = pt_edi.get<bool>("dump", false);
edi_conf.enable_pft = pt_edi.get<bool>("enable_pft", false);
edi_conf.verbose = pt_edi.get<bool>("verbose", false);