aboutsummaryrefslogtreecommitdiffstats
path: root/src/dabOutput
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-02-03 14:47:37 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-02-03 14:47:37 +0100
commit4ee1e821f2ea6d7cd3c30d6cff2e631bc7f89dfd (patch)
treed4213454364e5b414e63c2e2671269aefdd5497c /src/dabOutput
parent3e5ce23aefb42a07f3b44086fe872f2de54e2804 (diff)
downloaddabmux-4ee1e821f2ea6d7cd3c30d6cff2e631bc7f89dfd.tar.gz
dabmux-4ee1e821f2ea6d7cd3c30d6cff2e631bc7f89dfd.tar.bz2
dabmux-4ee1e821f2ea6d7cd3c30d6cff2e631bc7f89dfd.zip
Make EDI fragment interleaver less bursty
Diffstat (limited to 'src/dabOutput')
-rw-r--r--src/dabOutput/edi/Interleaver.cpp14
-rw-r--r--src/dabOutput/edi/Interleaver.h5
2 files changed, 16 insertions, 3 deletions
diff --git a/src/dabOutput/edi/Interleaver.cpp b/src/dabOutput/edi/Interleaver.cpp
index 810e76f..e31326b 100644
--- a/src/dabOutput/edi/Interleaver.cpp
+++ b/src/dabOutput/edi/Interleaver.cpp
@@ -64,8 +64,6 @@ Interleaver::fragment_vec Interleaver::Interleave(fragment_vec &fragments)
fragments.clear();
- std::vector<PFTFragment> interleaved_frags;
-
while ( not m_buffer.empty() and
(m_buffer.front().size() >= m_fragment_count * m_latency)) {
@@ -89,7 +87,7 @@ Interleaver::fragment_vec Interleaver::Interleave(fragment_vec &fragments)
for (size_t i = 0; i < m_fragment_count; i++) {
const size_t ix = m_interleave_offset + m_fragment_count * m_stride;
- interleaved_frags.push_back(first_buffer.at(ix));
+ m_interleaved_fragments.push_back(first_buffer.at(ix));
m_stride += 1;
if (m_stride >= m_latency) {
@@ -105,6 +103,16 @@ Interleaver::fragment_vec Interleaver::Interleave(fragment_vec &fragments)
}
}
+ std::vector<PFTFragment> interleaved_frags;
+
+ const size_t n = std::min(m_fragment_count, m_interleaved_fragments.size());
+ std::move(m_interleaved_fragments.begin(),
+ m_interleaved_fragments.begin() + n,
+ std::back_inserter(interleaved_frags));
+ m_interleaved_fragments.erase(
+ m_interleaved_fragments.begin(),
+ m_interleaved_fragments.begin() + n);
+
return interleaved_frags;
}
diff --git a/src/dabOutput/edi/Interleaver.h b/src/dabOutput/edi/Interleaver.h
index f94219e..f1cff30 100644
--- a/src/dabOutput/edi/Interleaver.h
+++ b/src/dabOutput/edi/Interleaver.h
@@ -64,6 +64,11 @@ class Interleaver {
/* Buffer that accumulates enough fragments to interleave */
std::deque<fragment_vec> m_buffer;
+
+ /* Buffer that contains fragments that have been interleaved,
+ * to avoid that the interleaver output is too bursty
+ */
+ std::deque<PFTFragment> m_interleaved_fragments;
};
}