summaryrefslogtreecommitdiffstats
path: root/src/FrameMultiplexer.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-01-31 22:35:17 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-01-31 22:35:17 +0100
commit5ac4621df043666836107e0e0aaa3df709fb866e (patch)
treeb11ea1bff6c671597adcc46ed8dfe2593fee38a9 /src/FrameMultiplexer.cpp
parentf607e5406666dbd1646b427af9b46c956829a773 (diff)
downloaddabmod-5ac4621df043666836107e0e0aaa3df709fb866e.tar.gz
dabmod-5ac4621df043666836107e0e0aaa3df709fb866e.tar.bz2
dabmod-5ac4621df043666836107e0e0aaa3df709fb866e.zip
Restart when FrameMultiplexer sees a different configuration
Diffstat (limited to 'src/FrameMultiplexer.cpp')
-rw-r--r--src/FrameMultiplexer.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/FrameMultiplexer.cpp b/src/FrameMultiplexer.cpp
index efd43f3..ffae2ca 100644
--- a/src/FrameMultiplexer.cpp
+++ b/src/FrameMultiplexer.cpp
@@ -77,11 +77,17 @@ int FrameMultiplexer::process(std::vector<Buffer*> dataIn, Buffer* dataOut)
memcpy(out, (*in)->getData(), (*in)->getLength());
++in;
// Write subchannel
- assert(mySubchannels->size() == dataIn.size() - 1);
+ if (mySubchannels->size() != dataIn.size() - 1) {
+ throw std::out_of_range(
+ "FrameMultiplexer detected subchannel size change!");
+ }
std::vector<std::shared_ptr<SubchannelSource> >::const_iterator subchannel =
mySubchannels->begin();
while (in != dataIn.end()) {
- assert((*subchannel)->framesizeCu() * 8 == (*in)->getLength());
+ if ((*subchannel)->framesizeCu() * 8 != (*in)->getLength()) {
+ throw std::out_of_range(
+ "FrameMultiplexer detected invalid subchannel size!");
+ }
size_t offset = (*subchannel)->startAddress() * 8;
memcpy(&out[offset], (*in)->getData(), (*in)->getLength());
++in;