One of my latest GnuRadio projects uses a custom source block.
The quick description of this block is that it takes a packet
off of the network stack, wraps it in HDLC/Frame-relay, and
streams the unpacked bits out of the block. The catch is that
when there is no network packet ready, the block inserts HDLC “Flag”
bytes into the output stream as an idle pattern.
The output of this block, after some further manipulation,
goes into a GMSK modulator and then to a usrp_sink for transmission.
The problem I’m having is that I’m getting HUGE latency, on the
order of 10 seconds, between when a network packet arrives
and when the associated bits are radiated.
I suspect that this delay is due to GnuRadio’s inter-block
buffering. The custom block gets called by the scheduler, and is
asked to produce enough samples to fill a 32k buffer. This block,
and the next three blocks in the chain, are operating at
9600 samples/sec. So 32k bits / 9600 bits/sec = 3.4 seconds
for each buffer, times 3 buffers equals just over 10 seconds.
The stream is upsampled after this point to 250k samples/sec,
and the additional latency produced by the rest of the flowgraph
is less than a second.
My initial thought was to reduce the inter-block buffer size
everywhere. I believe this can be done by changing the
constant value GR_FIXED_BUFFER_SIZE in the file
from 32k to maybe 4k.
But this would have an impact on performance. The
reveive side of this flowgraph (not discussed) runs at
4 Msamples/sec and needs all the performance it can get.
So, my question (finally!) is:
Is there any way to selectively adjust the buffer size for
particular connections on the flowgraph, while leaving the
others at their 32k size?