discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Is it safe to use get_tags_in_range within foreca


From: Andy Walls
Subject: Re: [Discuss-gnuradio] Is it safe to use get_tags_in_range within forecast?
Date: Tue, 16 Jan 2018 08:37:20 -0500

> From:         Markus Wirsing
> Date:         Tue, 16 Jan 2018 10:24:50 +0100

> Hello,
> 
> I am trying to write a block that produces a different amount of
> output 
> depending on the tags.
> For that I would need to access the tags in the forecast function.
> Would it be 
> safe to do that?

Yes, for the tags.  However, you will be introducing inefficiency.

The block executor calls forecast() multiple times in an effort to give
the block a number of input samples that will produce some output.  So
forecast() can be called many times before general_work(), and you will
have to refetch and process the tags on every call to forecast().

Be careful with your return value from forecast().  If you're smart
about it, you can probably minimize the number of time you go around in
the 'try_again' loop in the scheduler.

https://github.com/gnuradio/gnuradio/blob/master/gnuradio-runtime/lib/block_executor.cc#L397


I'll ask some leading questions:

What happens if there are no tags on input?  Do you say you can't
produce output?  If so, what if the input buffer is full, such that no
new tags will ever appear, until some input is drained?


> Or can the tags still change in between the call to forecast and the
> call to 
> general_work?

Yes, they can.  In the small window of time between the final call to
forecast() and the call general_work(), you can get additional tags;
tags won't be removed.

-Andy

> I was not able to find information about that in the documentation.
> And I don't 
> have sufficient knowledge of gnuradio's inner workings to certainly
> answer that 
> question myself.
> 
> Thanks for any help.
> 
> Markus




reply via email to

[Prev in Thread] Current Thread [Next in Thread]