diff options
author | Tom Rondeau <tom@trondeau.com> | 2013-10-23 17:02:47 -0400 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2013-10-29 12:10:59 -0400 |
commit | dabe6f1187adc3e2953d14a8d0a1b4ad66044c47 (patch) | |
tree | 55748e63df316d48ae08830adf9d541b8d5471ea /gnuradio-runtime/lib/block_executor.cc | |
parent | f1a75ec23c045e7fe35b82576dbb1278ec70b60c (diff) |
runtime: executor uses information about the numer items produced/consumed to update the relative rate. This makes sure tags are being propagated by all blocks correctly. Needed for pfb_clock_sync to use the correlate_and_sync block's tags.
Diffstat (limited to 'gnuradio-runtime/lib/block_executor.cc')
-rw-r--r-- | gnuradio-runtime/lib/block_executor.cc | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/gnuradio-runtime/lib/block_executor.cc b/gnuradio-runtime/lib/block_executor.cc index 7a14c17431..85cf4bb2ab 100644 --- a/gnuradio-runtime/lib/block_executor.cc +++ b/gnuradio-runtime/lib/block_executor.cc @@ -192,6 +192,7 @@ namespace gr { int max_noutput_items; int new_alignment = 0; int alignment_state = -1; + double rrate; block *m = d_block.get(); block_detail *d = m->detail().get(); @@ -450,17 +451,27 @@ namespace gr { m->set_is_unaligned(m->unaligned() != 0); } - if(!propagate_tags(m->tag_propagation_policy(), d, - d_start_nitems_read, m->relative_rate(), - d_returned_tags, m->unique_id())) - goto were_done; - if(n == block::WORK_DONE) goto were_done; if(n != block::WORK_CALLED_PRODUCE) d->produce_each (n); // advance write pointers + // Wait til after we've consumed and produced and recalculate + // the relative rate. + if(!d->sink_p() && !d->source_p()) { + rrate = ((double)m->nitems_written(0)) / ((double)m->nitems_read(0)); + if(rrate > 0) + m->set_relative_rate(rrate); + } + + // Now propagate the tags based on the new relative rate + if(!propagate_tags(m->tag_propagation_policy(), d, + d_start_nitems_read, m->relative_rate(), + d_returned_tags, m->unique_id())) + goto were_done; + + if(d->d_produce_or > 0) // block produced something return READY; |