Overrun or Underrun due to two Blocks in a GNU Radio Flow Graph that are no 100 % in Sync

I have noticed a problem when there are several blocks in a flow graph that have a fixed rate. This is typically the case if a Software Defined Radio (SDR) is the source in the flow graph, and the audio device on the computer is the sink of the flow graph. If the clocks on the SDR and the audio device are not in 100% sync (which is nearly always the case), they will drift and eventually there will either be an underrun (not enough samples produced for the audio device) or an overrun (too many samples produced by the SDR). This then typically causes annoying sounds every now and then in the loud speakers.

In order to “work around” this problem, I started on a new block to analyze the situation. The idea is to have a fairly big FIFO in a block and then monitor the fill rate of this FIFO. The block can be found here: https://github.com/rubund/capture-tools/blob/master/gr-capture_tools/lib/xrun_monitor_ff_impl.cc

It will print out the fill rate of the FIFO. When starting up, it tries to fill it to about 50% before passing the real samples on to the output. It produces zeros until it reaches 50% fill rate. Then if the fill rate later drops below 30%, it halts and fills up to 50% again before starting to pass samples over.

The plan is to later automatically inject single samples here and there to make the problem almost invisble/inaudible.

Leave a Reply

Your email address will not be published. Required fields are marked *