summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2023-05-03 15:24:33 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2023-05-03 15:24:33 +0200
commit966a696e55f2112bb44d95b2b22a7e20423d1bad (patch)
treefca6c4a47c4f83bc397353b015e8d97a8c8ce3f2
parent7c6dac7fa29ccd84da890aee7a0b1004dcd93d8b (diff)
downloaddabmux-966a696e55f2112bb44d95b2b22a7e20423d1bad.tar.gz
dabmux-966a696e55f2112bb44d95b2b22a7e20423d1bad.tar.bz2
dabmux-966a696e55f2112bb44d95b2b22a7e20423d1bad.zip
Ensure EDI inserts ESTn tags in the config file order
Even though the spec says EDI decoders shall not assume any particular ordering, we've seen some that misbehave
-rw-r--r--src/DabMultiplexer.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp
index a658262..fb5ec45 100644
--- a/src/DabMultiplexer.cpp
+++ b/src/DabMultiplexer.cpp
@@ -408,7 +408,7 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
// For EDI, save ETI(LI) Management data into a TAG Item DETI
edi::TagDETI edi_tagDETI;
edi::TagStarPTR edi_tagStarPtr("DETI");
- map<DabSubchannel*, edi::TagESTn> edi_subchannelToTag;
+ vector<edi::TagESTn> edi_est_tags;
// The above Tag Items will be assembled into a TAG Packet
edi::TagPacket edi_tagpacket(edi_conf.tagpacket_alignment);
@@ -541,7 +541,7 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
tag_ESTn.mst_data = nullptr;
assert(subchannel->getSizeByte() % 8 == 0);
- edi_subchannelToTag[subchannel.get()] = tag_ESTn;
+ edi_est_tags.push_back(std::move(tag_ESTn));
index += 4;
}
@@ -619,8 +619,8 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
****** Input Data Reading *******************************************
**********************************************************************/
- for (auto subchannel : ensemble->subchannels) {
- edi::TagESTn& tag = edi_subchannelToTag[subchannel.get()];
+ for (size_t i = 0; i < ensemble->subchannels.size(); i++) {
+ auto& subchannel = ensemble->subchannels[i];
int sizeSubchannel = subchannel->getSizeByte();
// no need to check enableTist because we always increment the timestamp
@@ -634,7 +634,7 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
}
// save pointer to Audio or Data Stream into correct TagESTn for EDI
- tag.mst_data = &etiFrame[index];
+ edi_est_tags[i].mst_data = &etiFrame[index];
index += sizeSubchannel;
}
@@ -746,8 +746,8 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
edi_tagpacket.tag_items.push_back(&edi_tagStarPtr);
edi_tagpacket.tag_items.push_back(&edi_tagDETI);
- for (auto& tag : edi_subchannelToTag) {
- edi_tagpacket.tag_items.push_back(&tag.second);
+ for (auto& tag : edi_est_tags) {
+ edi_tagpacket.tag_items.push_back(&tag);
}
edi_sender->write(edi_tagpacket);