First, there may be multiple tags per sample. Use “get_tags_in_range” or 
“get_tags_in_window” to get all the tags you need. Using “get_tags_in_window(0, 
noutput_items, …)” will get you all the tags associated with samples passed as 
your inputs. (Perhaps you know this already and were just choosing a toy 
example, but I wanted to make it clear).

There is a pruning routine in the scheduler that will toss out “old” tags, 
i.e., tags that have been accounted for based on “nitems_read”, which is 
updated when you call consume_each. So I think you will end up getting the last 
5 tags again on the next call to work. But you have already propagated them, so 
you will be adding duplicates. The solution is to only propagate tags in the 
range that you intend to tell the scheduler you’ve consumed.

(Caveat emptor: I haven’t tested this out, but I believe this is how it would 
work).

Sean

From: [email protected] 
[mailto:[email protected]] On Behalf 
Of Richard Bell
Sent: Monday, July 20, 2015 3:51 PM
To: [email protected]
Subject: [Discuss-gnuradio] Tag Propagation Question

If I set_tag_propagation policy(TPP_DONT) and then re-add all tags in range to 
the output, but only produce a portion of the input items to output, what 
effect does this have?
Here is a good corner case example of what I mean:
Suppose I'm given 10 items, and every item has a tag associated with it. I then 
make the following actions

set_tag_propagation policy(TPP_DONT)
for( ii = 0; ii < 9; ii++)
{
    add_item_tag(0, tags[ii].offset, tags[ii].key, tags[ii].value, 
tags[ii].srcid);
}
consume_each(5);
return 5;
I'm concerned this might cause tags to be added or lost.

Thanks,
Rich
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to