# Stream tagging at iregular periods of time

**URL:** <https://www.ruby-forum.com/t/stream-tagging-at-iregular-periods-of-time/234399>\
**Category:** GNU Radio\
**Created:** [March 2, 2015, 1:10pm UTC](https://www.ruby-forum.com/t/stream-tagging-at-iregular-periods-of-time/234399 "2015-03-02T13:10:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [March 2, 2015, 1:10pm UTC](https://www.ruby-forum.com/t/stream-tagging-at-iregular-periods-of-time/234399/1 "2015-03-02T13:10:14Z")

</div>

Hello,

I am a little confused about stream tagging. I read in the documentation  
that one tag can be appended to any sample in the data stream so it can  
be  
something that happens once in a while and it doesn’t have to be at  
regular  
intervals. That is pretty useful.

Then, when reading about Tagged Stream Blocks it says:

“On the first item of a streamed PDU, there _must_ be a tag with a  
specific  
key, which stores the length of the PDU as a PMT integer. If anything  
else,  
or no tag, is on this first item, this will cause the flow graph to  
crash!”.

Is it only for the first item or is it PDU after PDU? I mean, a new tag  
with the key and length must arrive immediately after one whole PDU is  
completed?

If the answer is “yes” I understand it like a vector streaming. What is  
the  
difference? Then, when is stream tagging useful? I don’t get that from  
the  
documentation.

What if my custom burst each of them identified with a tag come at  
non-defined periods of time? Do I have to develop the block as a  
basic/sync  
block that read tags of each sample instead and forget about tagged  
stream  
blocks?

Many thanks in advance. This is a really good community!

Jorge.

PS: At the beginning I found confusing that a Tagged File Sink is not a  
Tagged Stream Block given its name but it is only my personal opinion

---

<div class="post-metadata">

**Author:** ![jorgegetafe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/eada6e/32.png) [@jorgegetafe](https://www.ruby-forum.com/u/jorgegetafe)\
**Post date:** [March 2, 2015, 1:18pm UTC](https://www.ruby-forum.com/t/stream-tagging-at-iregular-periods-of-time/234399/2 "2015-03-02T13:18:21Z")

</div>

Hi Jorge,  
tagged stream blocks are a specific architecture built atop of the  
streaming infrastructure. Not every block that uses tags is a tagged  
stream block.  
TSB’s are vastly helpful if you’re actually dealin with bursty/packeted  
data; the difference to vector processing is that these burst can have  
variable length, and that “normal” blocks, which are unaware of the  
bursty/PDU nature of the items going through, still work (eg. you can  
still multiply a tagged stream block stream with the normal  
multiply\_const etc).  
If you just want to say “hey, this is the sample where XY happened”, no  
need to convert your block into a tagged stream block.

Now, regarding your question: yes, when using tagged stream blocks, all  
samples must be part of a burst/PDU that started with a tag describing  
the PDU’s length. Everything else is illegal.

The motivation behind TSBs was to be able to define blocks that care  
about the bursty/packeted nature of items, whilst the rest could  
continue to work as it used to.

Best regards,  
Marcus

---

<div class="post-metadata">

**Author:** ![jorgegetafe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/eada6e/32.png) [@jorgegetafe](https://www.ruby-forum.com/u/jorgegetafe)\
**Post date:** [March 2, 2015, 7:32pm UTC](https://www.ruby-forum.com/t/stream-tagging-at-iregular-periods-of-time/234399/3 "2015-03-02T19:32:18Z")

</div>

Hey Jorge,

I think Marcus answered your question, but some additional infos:

On 02.03.2015 04:08, Jorge G. wrote:

> What if my custom burst each of them identified with a tag come at  
> non-defined periods of time? Do I have to develop the block as a  
> basic/sync block that read tags of each sample instead and forget about  
> tagged stream blocks?

If tags follow the TSB standard practice, all you need to do is derive  
your block from tagged\_stream\_block. It’ll provide you with convenience  
functions to handle it.

> Many thanks in advance. This is a really good community!
> 
> Jorge.
> 
> PS: At the beginning I found confusing that a Tagged File Sink is not a  
> Tagged Stream Block given its name but it is only my personal opinion

The name isn’t perfect, and the ‘tagged stream blocks’ where named such  
after the ‘tagged file sink’ existed. Also, you can have streams that  
are tagged that are not ‘tagged streams’ in this specific definition.  
But this nomenclature just stuck, and we didn’t have anything better at  
the time. Names are one of the hardest thing to get right in SW dev,  
after all 🙂

M
