aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-12-25 05:08:14 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-12-25 05:08:14 +0100
commit2a199ca830cb1338b5c52ca5f147ebef26330d22 (patch)
tree27cb32b7371a97160dcd1dc1f794312074c18b81 /src
parent626cfba78e2885200450ff8b4f4cf09ff6d0b830 (diff)
downloaddabmod-2a199ca830cb1338b5c52ca5f147ebef26330d22.tar.gz
dabmod-2a199ca830cb1338b5c52ca5f147ebef26330d22.tar.bz2
dabmod-2a199ca830cb1338b5c52ca5f147ebef26330d22.zip
Do not use out_of_range for multiplex reconfiguration error
Diffstat (limited to 'src')
-rw-r--r--src/DabMod.cpp15
-rw-r--r--src/FrameMultiplexer.cpp4
-rw-r--r--src/FrameMultiplexer.h10
3 files changed, 19 insertions, 10 deletions
diff --git a/src/DabMod.cpp b/src/DabMod.cpp
index dfefb53..b6f2dee 100644
--- a/src/DabMod.cpp
+++ b/src/DabMod.cpp
@@ -36,6 +36,7 @@
#include "InputMemory.h"
#include "OutputFile.h"
#include "FormatConverter.h"
+#include "FrameMultiplexer.h"
#if defined(HAVE_OUTPUT_UHD)
# include "OutputUHD.h"
#endif
@@ -534,17 +535,19 @@ run_modulator_state_t run_modulator(modulator_data& m)
running = 0;
ret = run_modulator_state_t::normal_end;
}
- } catch (zmq_input_overflow& e) {
+ }
+ catch (const zmq_input_overflow& e) {
// The ZeroMQ input has overflowed its buffer
etiLog.level(warn) << e.what();
ret = run_modulator_state_t::again;
- } catch (std::out_of_range& e) {
- // One of the DSP blocks has detected an invalid change
- // or value in some settings. This can be due to a multiplex
- // reconfiguration.
+ }
+ catch (const FrameMultiplexerError& e) {
+ // The FrameMultiplexer saw an error or a change in the size of a
+ // subchannel. This can be due to a multiplex reconfiguration.
etiLog.level(warn) << e.what();
ret = run_modulator_state_t::reconfigure;
- } catch (std::exception& e) {
+ }
+ catch (const std::exception& e) {
etiLog.level(error) << "Exception caught: " << e.what();
ret = run_modulator_state_t::failure;
}
diff --git a/src/FrameMultiplexer.cpp b/src/FrameMultiplexer.cpp
index 4cee0b2..5dc6dca 100644
--- a/src/FrameMultiplexer.cpp
+++ b/src/FrameMultiplexer.cpp
@@ -74,7 +74,7 @@ int FrameMultiplexer::process(std::vector<Buffer*> dataIn, Buffer* dataOut)
// Write subchannel
const auto subchannels = m_etiSource.getSubchannels();
if (subchannels.size() != dataIn.size() - 1) {
- throw std::out_of_range(
+ throw FrameMultiplexerError(
"FrameMultiplexer detected subchannel size change from " +
std::to_string(dataIn.size() - 1) + " to " +
std::to_string(subchannels.size()));
@@ -82,7 +82,7 @@ int FrameMultiplexer::process(std::vector<Buffer*> dataIn, Buffer* dataOut)
auto subchannel = subchannels.begin();
while (in != dataIn.end()) {
if ((*subchannel)->framesizeCu() * 8 != (*in)->getLength()) {
- throw std::out_of_range(
+ throw FrameMultiplexerError(
"FrameMultiplexer detected invalid subchannel size! " +
std::to_string((*subchannel)->framesizeCu() * 8) + " != " +
std::to_string((*in)->getLength()));
diff --git a/src/FrameMultiplexer.h b/src/FrameMultiplexer.h
index 680cdc7..4d68d88 100644
--- a/src/FrameMultiplexer.h
+++ b/src/FrameMultiplexer.h
@@ -38,12 +38,18 @@
#include <sys/types.h>
+class FrameMultiplexerError : public std::runtime_error {
+ public:
+ FrameMultiplexerError(const char* msg) :
+ std::runtime_error(msg) {}
+ FrameMultiplexerError(const std::string& msg) :
+ std::runtime_error(msg) {}
+};
class FrameMultiplexer : public ModMux
{
public:
- FrameMultiplexer(
- const EtiSource& etiSource);
+ FrameMultiplexer(const EtiSource& etiSource);
int process(std::vector<Buffer*> dataIn, Buffer* dataOut);
const char* name() { return "FrameMultiplexer"; }