Now FFTS is sent and it does not (always) hang everything. Sometimes the loop hangs in loopstat=10 while we are blocking waiting for audio but tee cannot keep up feeding the secondary demods
This commit is contained in:
parent
71d92c6767
commit
953f24b301
15
csdr.py
15
csdr.py
@ -78,7 +78,7 @@ class dsp:
|
|||||||
chain_begin=any_chain_base+"csdr shift_addition_cc --fifo {shift_pipe} | csdr fir_decimate_cc {decimation} {ddc_transition_bw} HAMMING | csdr bandpass_fir_fft_cc --fifo {bpf_pipe} {bpf_transition_bw} HAMMING | csdr squelch_and_smeter_cc --fifo {squelch_pipe} --outfifo {smeter_pipe} 5 1 | "
|
chain_begin=any_chain_base+"csdr shift_addition_cc --fifo {shift_pipe} | csdr fir_decimate_cc {decimation} {ddc_transition_bw} HAMMING | csdr bandpass_fir_fft_cc --fifo {bpf_pipe} {bpf_transition_bw} HAMMING | csdr squelch_and_smeter_cc --fifo {squelch_pipe} --outfifo {smeter_pipe} 5 1 | "
|
||||||
if self.secondary_demodulator:
|
if self.secondary_demodulator:
|
||||||
chain_begin+="tee {iqtee_pipe} | "
|
chain_begin+="tee {iqtee_pipe} | "
|
||||||
# chain_begin+="tee {iqtee2_pipe} | " #TODO digimodes
|
# chain_begin+="tee {iqtee2_pipe} | " #TODO digimodes, and yes, tee sometimes hangs everything
|
||||||
chain_end = ""
|
chain_end = ""
|
||||||
if self.audio_compression=="adpcm":
|
if self.audio_compression=="adpcm":
|
||||||
chain_end = " | csdr encode_ima_adpcm_i16_u8"
|
chain_end = " | csdr encode_ima_adpcm_i16_u8"
|
||||||
@ -87,7 +87,6 @@ class dsp:
|
|||||||
elif which == "ssb": return chain_begin + "csdr realpart_cf | csdr old_fractional_decimator_ff {last_decimation} | csdr agc_ff | csdr limit_ff | csdr convert_f_s16"+chain_end
|
elif which == "ssb": return chain_begin + "csdr realpart_cf | csdr old_fractional_decimator_ff {last_decimation} | csdr agc_ff | csdr limit_ff | csdr convert_f_s16"+chain_end
|
||||||
|
|
||||||
def secondary_chain(self, which):
|
def secondary_chain(self, which):
|
||||||
return "cat {input_pipe}" #TODO digimodes
|
|
||||||
secondary_chain_base="cat {input_pipe} | "
|
secondary_chain_base="cat {input_pipe} | "
|
||||||
if which == "fft":
|
if which == "fft":
|
||||||
return secondary_chain_base+"csdr realpart_cf | csdr fft_fc {secondary_fft_size} {secondary_fft_block_size} | csdr logpower_cf -70 | csdr fft_one_side_ff {secondary_fft_size}" + (" | csdr compress_fft_adpcm_f_u8 {secondary_fft_size}" if self.fft_compression=="adpcm" else "")
|
return secondary_chain_base+"csdr realpart_cf | csdr fft_fc {secondary_fft_size} {secondary_fft_block_size} | csdr logpower_cf -70 | csdr fft_one_side_ff {secondary_fft_size}" + (" | csdr compress_fft_adpcm_f_u8 {secondary_fft_size}" if self.fft_compression=="adpcm" else "")
|
||||||
@ -154,16 +153,16 @@ class dsp:
|
|||||||
if self.csdr_print_bufsizes: my_env["CSDR_PRINT_BUFSIZES"]="1";
|
if self.csdr_print_bufsizes: my_env["CSDR_PRINT_BUFSIZES"]="1";
|
||||||
self.secondary_process_fft = subprocess.Popen(secondary_command_fft, stdout=subprocess.PIPE, shell=True, preexec_fn=os.setpgrp, env=my_env)
|
self.secondary_process_fft = subprocess.Popen(secondary_command_fft, stdout=subprocess.PIPE, shell=True, preexec_fn=os.setpgrp, env=my_env)
|
||||||
print "[openwebrx-dsp-plugin:csdr] Popen on secondary command (fft)"
|
print "[openwebrx-dsp-plugin:csdr] Popen on secondary command (fft)"
|
||||||
self.secondary_process_demod = subprocess.Popen(secondary_command_demod, stdout=subprocess.PIPE, shell=True, preexec_fn=os.setpgrp, env=my_env)
|
# self.secondary_process_demod = subprocess.Popen(secondary_command_demod, stdout=subprocess.PIPE, shell=True, preexec_fn=os.setpgrp, env=my_env) #TODO digimodes
|
||||||
print "[openwebrx-dsp-plugin:csdr] Popen on secondary command (demod)"
|
# print "[openwebrx-dsp-plugin:csdr] Popen on secondary command (demod)" #TODO digimodes
|
||||||
self.secondary_processes_running = True
|
self.secondary_processes_running = True
|
||||||
|
|
||||||
#open control pipes for csdr and send initialization data
|
#open control pipes for csdr and send initialization data
|
||||||
if self.secondary_shift_pipe != None:
|
# if self.secondary_shift_pipe != None: #TODO digimodes
|
||||||
self.secondary_shift_pipe_file=open(self.secondary_shift_pipe,"w")
|
# self.secondary_shift_pipe_file=open(self.secondary_shift_pipe,"w") #TODO digimodes
|
||||||
self.set_secondary_offset_freq(self.secondary_offset_freq)
|
# self.set_secondary_offset_freq(self.secondary_offset_freq) #TODO digimodes
|
||||||
|
|
||||||
self.set_pipe_nonblocking(self.secondary_process_demod.stdout)
|
# self.set_pipe_nonblocking(self.secondary_process_demod.stdout) #TODO digimodes
|
||||||
self.set_pipe_nonblocking(self.secondary_process_fft.stdout)
|
self.set_pipe_nonblocking(self.secondary_process_fft.stdout)
|
||||||
|
|
||||||
def set_secondary_offset_freq(self, value):
|
def set_secondary_offset_freq(self, value):
|
||||||
|
14
openwebrx.py
14
openwebrx.py
@ -469,13 +469,11 @@ class WebRXHandler(BaseHTTPRequestHandler):
|
|||||||
dsp.nc_port=cfg.iq_server_port
|
dsp.nc_port=cfg.iq_server_port
|
||||||
apply_csdr_cfg_to_dsp(dsp)
|
apply_csdr_cfg_to_dsp(dsp)
|
||||||
myclient.dsp=dsp
|
myclient.dsp=dsp
|
||||||
|
do_secondary_demod=False
|
||||||
access_log("Started streaming to client: "+self.client_address[0]+"#"+myclient.id+" (users now: "+str(len(clients))+")")
|
access_log("Started streaming to client: "+self.client_address[0]+"#"+myclient.id+" (users now: "+str(len(clients))+")")
|
||||||
|
|
||||||
myclient.loopstat=0
|
|
||||||
do_secondary_demod=False
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
myclient.loopstat=0
|
||||||
if myclient.closed[0]:
|
if myclient.closed[0]:
|
||||||
print "[openwebrx-httpd:ws] client closed by other thread"
|
print "[openwebrx-httpd:ws] client closed by other thread"
|
||||||
break
|
break
|
||||||
@ -518,6 +516,7 @@ class WebRXHandler(BaseHTTPRequestHandler):
|
|||||||
|
|
||||||
# ========= send secondary =========
|
# ========= send secondary =========
|
||||||
if do_secondary_demod:
|
if do_secondary_demod:
|
||||||
|
myclient.loopstat=41
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
secondary_spectrum_data=dsp.read_secondary_fft(dsp.get_secondary_fft_bytes_to_read())
|
secondary_spectrum_data=dsp.read_secondary_fft(dsp.get_secondary_fft_bytes_to_read())
|
||||||
@ -525,6 +524,7 @@ class WebRXHandler(BaseHTTPRequestHandler):
|
|||||||
print "len(secondary_spectrum_data)", len(secondary_spectrum_data) #TODO digimodes
|
print "len(secondary_spectrum_data)", len(secondary_spectrum_data) #TODO digimodes
|
||||||
rxws.send(self, secondary_spectrum_data, "FFTS")
|
rxws.send(self, secondary_spectrum_data, "FFTS")
|
||||||
except: break
|
except: break
|
||||||
|
myclient.loopstat=42
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
secondary_demod_data=dsp.read_secondary_demod(1)
|
secondary_demod_data=dsp.read_secondary_demod(1)
|
||||||
@ -536,8 +536,9 @@ class WebRXHandler(BaseHTTPRequestHandler):
|
|||||||
while True:
|
while True:
|
||||||
myclient.loopstat=50
|
myclient.loopstat=50
|
||||||
rdata=rxws.recv(self, False)
|
rdata=rxws.recv(self, False)
|
||||||
if not rdata: break
|
myclient.loopstat=51
|
||||||
#try:
|
#try:
|
||||||
|
if not rdata: break
|
||||||
elif rdata[:3]=="SET":
|
elif rdata[:3]=="SET":
|
||||||
print "[openwebrx-httpd:ws,%d] command: %s"%(client_i,rdata)
|
print "[openwebrx-httpd:ws,%d] command: %s"%(client_i,rdata)
|
||||||
pairs=rdata[4:].split(" ")
|
pairs=rdata[4:].split(" ")
|
||||||
@ -594,6 +595,7 @@ class WebRXHandler(BaseHTTPRequestHandler):
|
|||||||
dsp.set_bpf(*new_bpf)
|
dsp.set_bpf(*new_bpf)
|
||||||
#code.interact(local=locals())
|
#code.interact(local=locals())
|
||||||
except:
|
except:
|
||||||
|
myclient.loopstat=990
|
||||||
exc_type, exc_value, exc_traceback = sys.exc_info()
|
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||||
print "[openwebrx-httpd:ws] exception: ",exc_type,exc_value
|
print "[openwebrx-httpd:ws] exception: ",exc_type,exc_value
|
||||||
traceback.print_tb(exc_traceback) #TODO digimodes
|
traceback.print_tb(exc_traceback) #TODO digimodes
|
||||||
@ -606,6 +608,7 @@ class WebRXHandler(BaseHTTPRequestHandler):
|
|||||||
# traceback.print_tb(exc_traceback)
|
# traceback.print_tb(exc_traceback)
|
||||||
|
|
||||||
#stop dsp for the disconnected client
|
#stop dsp for the disconnected client
|
||||||
|
myclient.loopstat=991
|
||||||
try:
|
try:
|
||||||
dsp.stop()
|
dsp.stop()
|
||||||
del dsp
|
del dsp
|
||||||
@ -613,6 +616,7 @@ class WebRXHandler(BaseHTTPRequestHandler):
|
|||||||
print "[openwebrx-httpd] error in dsp.stop()"
|
print "[openwebrx-httpd] error in dsp.stop()"
|
||||||
|
|
||||||
#delete disconnected client
|
#delete disconnected client
|
||||||
|
myclient.loopstat=992
|
||||||
try:
|
try:
|
||||||
cma("do_GET /ws/ delete disconnected")
|
cma("do_GET /ws/ delete disconnected")
|
||||||
id_to_close=get_client_by_id(myclient.id,False)
|
id_to_close=get_client_by_id(myclient.id,False)
|
||||||
|
Loading…
Reference in New Issue
Block a user