summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/gras/block.hpp5
-rw-r--r--lib/block.cpp6
2 files changed, 7 insertions, 4 deletions
diff --git a/include/gras/block.hpp b/include/gras/block.hpp
index ba09377..4c09cac 100644
--- a/include/gras/block.hpp
+++ b/include/gras/block.hpp
@@ -251,11 +251,12 @@ struct GRAS_API Block : Element
* This is the same buffer pointed to by output_items[which].
* This function must be called during the call to work().
* Use this to get a pool of buffers for datagram message ports.
+ * This function removes the output buffer from the internal queue.
*
* \param which_output the output port index
- * \return a const reference to the buffer
+ * \return a reference counted copy of the buffer
*/
- const SBuffer &get_output_buffer(const size_t which_output) const;
+ SBuffer pop_output_buffer(const size_t which_output);
/*!
* Post the given output buffer to the downstream.
diff --git a/lib/block.cpp b/lib/block.cpp
index 0521490..469a233 100644
--- a/lib/block.cpp
+++ b/lib/block.cpp
@@ -203,9 +203,11 @@ const SBuffer &Block::get_input_buffer(const size_t which_input) const
return (*this)->block->input_queues.front(which_input);
}
-const SBuffer &Block::get_output_buffer(const size_t which_output) const
+SBuffer Block::pop_output_buffer(const size_t which_output)
{
- return (*this)->block->output_queues.front(which_output);
+ SBuffer buff = (*this)->block->output_queues.front(which_output);
+ (*this)->block->output_queues.pop(which_output);
+ return buff;
}
void Block::post_output_buffer(const size_t which_output, const SBuffer &buffer)