Fix frame interval: 54ms->60ms (DMR standard) + absolute timing on all voice functions to eliminate micro-cuts

pull/26/head
Joaquin Madrid Belando 2 weeks ago
parent 0c3d1bc710
commit f6dfa9f05b

@ -711,13 +711,16 @@ def sendSpeech(self,speech):
_nine = bytes_3(9)
_source_id = bytes_3(5000)
_slot = systems[system].STATUS[2]
_next_time = time()
while True:
try:
pkt = next(speech)
except StopIteration:
break
#Packet every 60ms
sleep(0.058)
_next_time += 0.060
_delay = _next_time - time()
if _delay > 0.001:
sleep(_delay)
reactor.callFromThread(sendVoicePacket,self,pkt,_source_id,_nine,_slot)
logger.debug('(%s) Sendspeech thread ended',self._system)
@ -749,17 +752,20 @@ def disconnectedVoice(system):
sleep(1)
_slot = systems[system].STATUS[2]
_next_time = time()
while True:
try:
pkt = next(speech)
except StopIteration:
break
#Packet every 60ms
sleep(0.058)
_next_time += 0.060
_delay = _next_time - time()
if _delay > 0.001:
sleep(_delay)
_stream_id = pkt[16:20]
_pkt_time = time()
reactor.callFromThread(sendVoicePacket,systems[system],pkt,_source_id,_nine,_slot)
logger.debug('(%s) disconnected voice thread end',system)
logger.debug('(%s) disconnected voice thread end',system)
def playFileOnRequest(self,fileNumber):
system = self._system
@ -797,7 +803,7 @@ def playFileOnRequest(self,fileNumber):
pkt = next(speech)
except StopIteration:
break
_next_time += 0.058
_next_time += 0.060
_delay = _next_time - time()
if _delay > 0.001:
sleep(_delay)
@ -881,13 +887,16 @@ def ident():
sleep(1)
_slot = systems[system].STATUS[2]
_next_time = time()
while True:
try:
pkt = next(speech)
except StopIteration:
break
#Packet every 60ms
sleep(0.058)
_next_time += 0.060
_delay = _next_time - time()
if _delay > 0.001:
sleep(_delay)
_stream_id = pkt[16:20]
_pkt_time = time()
@ -905,7 +914,7 @@ _voice_cfg_config_file = ''
_ann_tasks = {}
_tts_tasks = {}
_FRAME_INTERVAL = 0.054
_FRAME_INTERVAL = 0.060
_broadcast_queue = []
_broadcast_active = False

Loading…
Cancel
Save

Powered by TurnKey Linux.