summaryrefslogtreecommitdiffstats
path: root/src/ModPlugin.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-01-07 09:21:25 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-01-07 09:21:25 +0100
commit23b369e1145c5652778345827b7df9c33e09d0e8 (patch)
treed734d0ce91141883124cd693ccad840e452108f8 /src/ModPlugin.cpp
parent1d833b718845b97a5b1d90f33b547b1772bc0708 (diff)
downloaddabmod-23b369e1145c5652778345827b7df9c33e09d0e8.tar.gz
dabmod-23b369e1145c5652778345827b7df9c33e09d0e8.tar.bz2
dabmod-23b369e1145c5652778345827b7df9c33e09d0e8.zip
Add metadata latency for all PipelinedModCodec
Diffstat (limited to 'src/ModPlugin.cpp')
-rw-r--r--src/ModPlugin.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/ModPlugin.cpp b/src/ModPlugin.cpp
index c39d883..f86bfb2 100644
--- a/src/ModPlugin.cpp
+++ b/src/ModPlugin.cpp
@@ -74,9 +74,9 @@ int ModOutput::process(
PipelinedModCodec::PipelinedModCodec() :
ModCodec(),
- m_number_of_runs(0),
m_input_queue(),
m_output_queue(),
+ m_metadata_fifo(),
m_running(false),
m_thread()
{
@@ -107,7 +107,7 @@ int PipelinedModCodec::process(Buffer* dataIn, Buffer* dataOut)
m_input_queue.push(inbuffer);
- if (m_number_of_runs > 0) {
+ if (m_ready_to_output_data) {
std::shared_ptr<Buffer> outbuffer;
m_output_queue.wait_and_pop(outbuffer);
@@ -116,13 +116,26 @@ int PipelinedModCodec::process(Buffer* dataIn, Buffer* dataOut)
else {
dataOut->setLength(dataIn->getLength());
memset(dataOut->getData(), 0, dataOut->getLength());
- m_number_of_runs++;
+ m_ready_to_output_data = true;
}
return dataOut->getLength();
}
+meta_vec_t PipelinedModCodec::process_metadata(const meta_vec_t& metadataIn)
+{
+ m_metadata_fifo.push_back(metadataIn);
+ if (m_metadata_fifo.size() == 2) {
+ auto r = std::move(m_metadata_fifo.front());
+ m_metadata_fifo.pop_front();
+ return r;
+ }
+ else {
+ return {};
+ }
+}
+
void PipelinedModCodec::process_thread()
{
set_thread_name(name());