aboutsummaryrefslogtreecommitdiffstats
path: root/lib/edioutput/Transport.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2021-02-24 10:23:55 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2021-02-24 10:23:55 +0100
commitcdeded18deb9ef2a12bf5206757f235e3925c848 (patch)
treed704e6cf917fb4b9d77343305155db918da8395e /lib/edioutput/Transport.h
parent4516c0079dabc46d6787eeb037fd7b054ce8c81b (diff)
downloadODR-SourceCompanion-cdeded18deb9ef2a12bf5206757f235e3925c848.tar.gz
ODR-SourceCompanion-cdeded18deb9ef2a12bf5206757f235e3925c848.tar.bz2
ODR-SourceCompanion-cdeded18deb9ef2a12bf5206757f235e3925c848.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;
};
}