diff options
-rw-r--r-- | gr-blocks/lib/selector_impl.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gr-blocks/lib/selector_impl.cc b/gr-blocks/lib/selector_impl.cc index d8f5aa8958..d71e6cd35a 100644 --- a/gr-blocks/lib/selector_impl.cc +++ b/gr-blocks/lib/selector_impl.cc @@ -48,6 +48,8 @@ selector_impl::selector_impl(size_t itemsize, message_port_register_in(pmt::mp("oindex")); set_msg_handler(pmt::mp("oindex"), [this](pmt::pmt_t msg) { this->handle_msg_output_index(msg); }); + + set_tag_propagation_policy(TPP_CUSTOM); } selector_impl::~selector_impl() {} @@ -149,8 +151,20 @@ int selector_impl::general_work(int noutput_items, const uint8_t** in = (const uint8_t**)&input_items[0]; uint8_t** out = (uint8_t**)&output_items[0]; + gr::thread::scoped_lock l(d_mutex); if (d_enabled) { + auto nread = nitems_read(d_input_index); + auto nwritten = nitems_written(d_output_index); + + std::vector<tag_t> tags; + get_tags_in_window(tags, d_input_index, 0, noutput_items); + + for (auto tag : tags) { + tag.offset -= (nread - nwritten); + add_item_tag(d_output_index, tag); + } + std::copy(in[d_input_index], in[d_input_index] + noutput_items * d_itemsize, out[d_output_index]); |