aboutsummaryrefslogtreecommitdiffstats
path: root/lib/edioutput/Transport.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2021-02-22 16:13:27 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2021-02-22 16:29:07 +0100
commit26065b4193006401f78a4afdf4e19cbd1db6c593 (patch)
tree9432ec6ca9ec33879e7e1098f9d70da3cce15f67 /lib/edioutput/Transport.h
parent6eca391865df488db1d71c0bbf44bf5f471ad862 (diff)
downloaddabmux-26065b4193006401f78a4afdf4e19cbd1db6c593.tar.gz
dabmux-26065b4193006401f78a4afdf4e19cbd1db6c593.tar.bz2
dabmux-26065b4193006401f78a4afdf4e19cbd1db6c593.zip
Common fc2902b and 4ad00b8: Update EDI output interleaver and spreading
Diffstat (limited to 'lib/edioutput/Transport.h')
-rw-r--r--lib/edioutput/Transport.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/edioutput/Transport.h b/lib/edioutput/Transport.h
index 56ded3b..3bcc2f4 100644
--- a/lib/edioutput/Transport.h
+++ b/lib/edioutput/Transport.h
@@ -31,13 +31,16 @@
#include "EDIConfig.h"
#include "AFPacket.h"
#include "PFT.h"
-#include "Interleaver.h"
#include "Socket.h"
#include <vector>
+#include <chrono>
+#include <map>
#include <unordered_map>
#include <stdexcept>
#include <fstream>
#include <cstdint>
+#include <thread>
+#include <mutex>
namespace edi {
@@ -46,10 +49,15 @@ namespace edi {
class Sender {
public:
Sender(const configuration_t& conf);
+ Sender(const Sender&) = delete;
+ Sender operator=(const Sender&) = delete;
+ ~Sender();
void write(const TagPacket& tagpacket);
private:
+ void run();
+
bool m_udp_fragmentation_warning_printed = false;
configuration_t m_conf;
@@ -61,12 +69,16 @@ class Sender {
// The AF Packet will be protected with reed-solomon and split in fragments
edi::PFT edi_pft;
- // To mitigate for burst packet loss, PFT fragments can be sent out-of-order
- edi::Interleaver edi_interleaver;
-
std::unordered_map<udp_destination_t*, std::shared_ptr<Socket::UDPSocket>> udp_sockets;
std::unordered_map<tcp_server_t*, std::shared_ptr<Socket::TCPDataDispatcher>> tcp_dispatchers;
std::unordered_map<tcp_client_t*, std::shared_ptr<Socket::TCPSendClient>> tcp_senders;
+
+ // PFT spreading requires sending UDP packets at specific time, independently of
+ // time when write() gets called
+ std::thread m_thread;
+ std::mutex m_mutex;
+ bool m_running = false;
+ std::map<std::chrono::steady_clock::time_point, edi::PFTFragment> m_pending_frames;
};
}