summaryrefslogtreecommitdiffstats
path: root/src/dabOutput/edi/Interleaver.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-02-03 14:21:45 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-02-03 14:21:45 +0100
commit3e5ce23aefb42a07f3b44086fe872f2de54e2804 (patch)
tree39a724907505134abb3331741b2038729eaaca96 /src/dabOutput/edi/Interleaver.cpp
parente010d6a4e8342cf3042fb96a94ef3df766eeda3d (diff)
downloaddabmux-3e5ce23aefb42a07f3b44086fe872f2de54e2804.tar.gz
dabmux-3e5ce23aefb42a07f3b44086fe872f2de54e2804.tar.bz2
dabmux-3e5ce23aefb42a07f3b44086fe872f2de54e2804.zip
Do not lose fragments in EDI interleaver
Diffstat (limited to 'src/dabOutput/edi/Interleaver.cpp')
-rw-r--r--src/dabOutput/edi/Interleaver.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/dabOutput/edi/Interleaver.cpp b/src/dabOutput/edi/Interleaver.cpp
index 83f2512..810e76f 100644
--- a/src/dabOutput/edi/Interleaver.cpp
+++ b/src/dabOutput/edi/Interleaver.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2016
+ Copyright (C) 2017
Matthias P. Braendli, matthias.braendli@mpb.li
http://www.opendigitalradio.org
@@ -50,16 +50,17 @@ Interleaver::fragment_vec Interleaver::Interleave(fragment_vec &fragments)
auto& last_buffer = m_buffer.back();
- const bool last_buffer_is_complete =
- (last_buffer.size() >= m_fragment_count * m_latency);
+ for (auto& fragment : fragments) {
+ const bool last_buffer_is_complete =
+ (last_buffer.size() >= m_fragment_count * m_latency);
- if (last_buffer_is_complete) {
- m_buffer.emplace_back();
- last_buffer = m_buffer.back();
- }
+ if (last_buffer_is_complete) {
+ m_buffer.emplace_back();
+ last_buffer = m_buffer.back();
+ }
- std::move(fragments.begin(), fragments.end(),
- std::back_inserter(last_buffer));
+ last_buffer.push_back(std::move(fragment));
+ }
fragments.clear();