summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-03-06 17:52:07 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-03-06 17:52:07 +0100
commit5bea9241b246cfc4b9abef3d265a96d52a377c37 (patch)
treeaab1fcb6b9a707c27283cc4f961e84244d1fe5bb /src
parent0bdd2960707a8abb5d9e435d1313aec4cf264ab1 (diff)
downloaddabmod-5bea9241b246cfc4b9abef3d265a96d52a377c37.tar.gz
dabmod-5bea9241b246cfc4b9abef3d265a96d52a377c37.tar.bz2
dabmod-5bea9241b246cfc4b9abef3d265a96d52a377c37.zip
Verify ETI FCT continuity before modulator
Diffstat (limited to 'src')
-rw-r--r--src/DabMod.cpp21
-rw-r--r--src/EtiReader.cpp16
-rw-r--r--src/EtiReader.h5
3 files changed, 36 insertions, 6 deletions
diff --git a/src/DabMod.cpp b/src/DabMod.cpp
index 80dc6b4..b32231a 100644
--- a/src/DabMod.cpp
+++ b/src/DabMod.cpp
@@ -102,7 +102,7 @@ struct modulator_data
enum class run_modulator_state_t {
failure, // Corresponds to all failures
normal_end, // Number of frames to modulate was reached
- again, // ZeroMQ overrun
+ again, // Restart the modulator part
reconfigure // Some sort of change of configuration we cannot handle happened
};
@@ -317,7 +317,7 @@ int launch_modulator(int argc, char* argv[])
while (not ediReader.isFrameReady()) {
bool success = ediUdpInput.rxPacket();
if (not success) {
- running = false;
+ running = 0;
break;
}
}
@@ -439,10 +439,8 @@ int launch_modulator(int argc, char* argv[])
}
#endif
else if (dynamic_pointer_cast<InputTcpReader>(inputReader)) {
- // Create a new input reader
- auto inputTcpReader = make_shared<InputTcpReader>();
- inputTcpReader->Open(mod_settings.inputName);
- inputReader = inputTcpReader;
+ // Keep the same inputReader, as there is no input buffer overflow
+ run_again = true;
}
break;
case run_modulator_state_t::reconfigure:
@@ -472,6 +470,7 @@ static run_modulator_state_t run_modulator(modulator_data& m)
auto ret = run_modulator_state_t::failure;
try {
bool first_frame = true;
+ int last_eti_fct = -1;
while (running) {
int framesize;
@@ -507,6 +506,16 @@ static run_modulator_state_t run_modulator(modulator_data& m)
}
}
+ // Check for ETI FCT continuity
+ const unsigned expected_fct = (last_eti_fct + 1) % 250;
+ const unsigned fct = m.etiReader->getFct();
+ if (last_eti_fct != -1 and expected_fct != fct) {
+ etiLog.level(info) << "ETI FCT discontinuity, expected " <<
+ expected_fct << " received " << m.etiReader->getFct();
+ return run_modulator_state_t::again;
+ }
+ last_eti_fct = fct;
+
m.flowgraph->run();
/* Check every once in a while if the remote control
diff --git a/src/EtiReader.cpp b/src/EtiReader.cpp
index d1c7110..56c0fbb 100644
--- a/src/EtiReader.cpp
+++ b/src/EtiReader.cpp
@@ -85,6 +85,14 @@ unsigned EtiReader::getFp()
return eti_fc.FP;
}
+unsigned EtiReader::getFct()
+{
+ if (not eti_fc_valid) {
+ throw std::runtime_error("Trying to access FCT before it is ready!");
+ }
+ return eti_fc.FCT;
+}
+
const std::vector<std::shared_ptr<SubchannelSource> > EtiReader::getSubchannels() const
{
@@ -329,6 +337,14 @@ unsigned EdiReader::getFp()
return m_fc.fp;
}
+unsigned EdiReader::getFct()
+{
+ if (not m_fc_valid) {
+ throw std::runtime_error("Trying to access FCT before it is ready!");
+ }
+ return m_fc.fct;
+}
+
const std::vector<std::shared_ptr<SubchannelSource> > EdiReader::getSubchannels() const
{
std::vector<std::shared_ptr<SubchannelSource> > sources;
diff --git a/src/EtiReader.h b/src/EtiReader.h
index 4db5004..dfbaaa9 100644
--- a/src/EtiReader.h
+++ b/src/EtiReader.h
@@ -59,6 +59,9 @@ public:
/* Get the current Frame Phase */
virtual unsigned getFp() = 0;
+ /* Get the current Frame Count */
+ virtual unsigned getFct() = 0;
+
/* Returns true if we have valid time stamps in the ETI*/
virtual bool sourceContainsTimestamp() = 0;
@@ -80,6 +83,7 @@ public:
virtual unsigned getMode();
virtual unsigned getFp();
+ virtual unsigned getFct();
/* Read ETI data from dataIn. Returns the number of bytes
* read from the buffer.
@@ -121,6 +125,7 @@ public:
virtual unsigned getMode();
virtual unsigned getFp();
+ virtual unsigned getFct();
virtual bool sourceContainsTimestamp();
virtual const std::vector<std::shared_ptr<SubchannelSource> > getSubchannels() const;