Hi all-
I am testing out the blks2.mod_pkts & blks2.demod_pkts with something
similar to what is in the benchmark_loopback example, only I do not use
the
USRP at all. Basically, I am transfering the contents of one audio file
to
another by way of a mod/demod packet chain, and hoping to see the same
complete, intact audio file come out the other side. Relevant code
follows:
class gmsk_tester(gr.top_block):
def init(self, rx_callback):
gr.top_block.init(self, “gmsk_tester”)
self.mod = gmsk_mod()
self.pkt_tx = mod_pkts(self.mod)
self.demod = gmsk_demod()
self.pkt_rx = demod_pkts(self.demod, callback=rx_callback)
self.connect(self.pkt_tx, self.pkt_rx)
def main():
src_fn = ‘data.ogg’
dst_fn = ‘data2.ogg’
src_file = file(src_fn, 'r')
src_data = src_file.read()
src_file.close()
global dst_file
dst_file = file(dst_fn, 'w')
def rx_callback(ok, payload):
global dst_file
dst_file.write(payload)
gt = gmsk_tester(rx_callback)
gt.start()
try:
i = 0
pkt_size = 800
pkt_data = src_data[i:i+pkt_size]
while len(pkt_data) > 0:
print len(pkt_data)
gt.pkt_tx.send_pkt(pkt_data)
i = i+pkt_size
pkt_data = src_data[i:i+pkt_size]
except:
pass
gt.pkt_tx.send_pkt('')
gt.pkt_tx.send_pkt(eof=True)
gt.wait()
#time.sleep(1)
dst_file.flush()
if name == ‘main’:
main()
Sometimes this code runs to completion without complaint, sometimes at
the
end I get:
Exception in thread Thread-1 (most likely raised during interpreter
shutdown):
Traceback (most recent call last):
File “threading.py”, line 460, in __bootstrap
File
“/usr/local/lib/python2.5/site-packages/gnuradio/blksimpl2/pkt.py”,
line 153, in run
<type ‘exceptions.AttributeError’>: ‘NoneType’ object has no attribute
‘unmake_packet’
Unhandled exception in thread started by
Error in sys.excepthook:
Original exception was:
If I uncomment the sleep, I never see this message. So:
Q1) Any idea what this error is all about? Is this a race condition that
needs to be addressed, or am I doing something wrong?
Q2) The original audio file is 350.0KB. Sometimes the resulting audio
file
is complete, other times it never gets the last few KB (ends up 341.0KB,
for
example). How do I ensure that all the bytes make it across
successfully?
Q3) What is the effect of packet size? Is there an optimum size? A max
size?
For USRP, packets need to be padded to a multiple of XXX?
Q4) Some examples use gr.enable_realtime_scheduling(). What is the
effect of
this, and do I need it? I note that it requires a sudo.
Thanks for your time!
-Steven