diff options
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_buffer.cc | 9 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_buffer.h | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 0b2eb52a0..0bff0271a 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -80,7 +80,8 @@ minimum_buffer_items (long type_size, long page_size) gr_buffer::gr_buffer (int nitems, size_t sizeof_item, gr_block_sptr link) : d_base (0), d_bufsize (0), d_vmcircbuf (0), d_sizeof_item (sizeof_item), d_link(link), - d_write_index (0), d_abs_write_offset(0), d_done (false) + d_write_index (0), d_abs_write_offset(0), d_done (false), + d_last_min_items_read(0) { if (!allocate_buffer (nitems, sizeof_item)) throw std::bad_alloc (); @@ -162,7 +163,9 @@ gr_buffer::space_available () min_items_read = std::min(min_items_read, d_readers[i]->nitems_read()); } - prune_tags(min_items_read); + //prune_tags(min_items_read); + prune_tags(d_last_min_items_read); + d_last_min_items_read = min_items_read; // The -1 ensures that the case d_write_index == d_read_index is // unambiguous. It indicates that there is no data for the reader @@ -241,7 +244,6 @@ gr_buffer::prune_tags(uint64_t max_time) */ //gruel::scoped_lock guard(*mutex()); - int n = 0; uint64_t item_time; std::deque<pmt::pmt_t>::iterator itr = d_item_tags.begin(); @@ -249,7 +251,6 @@ gr_buffer::prune_tags(uint64_t max_time) item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); if(item_time < max_time) { d_item_tags.pop_front(); - n++; } itr++; } diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index fe0e7585d..aa26f1e09 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -135,7 +135,7 @@ class gr_buffer { uint64_t d_abs_write_offset; // num items written since the start bool d_done; std::deque<pmt::pmt_t> d_item_tags; - + uint64_t d_last_min_items_read; unsigned index_add (unsigned a, unsigned b) |