feat: refactor vocoder engine for software transcoding and multi-tenancy
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import socket
|
||||
import time
|
||||
|
||||
# Questo è uno dei frame AMBE reali estratti dal tuo log
|
||||
ambe_frame = bytes.fromhex("88 1D 2E 13 85 CD 00")
|
||||
server = ('127.0.0.1', 2470)
|
||||
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
sock.settimeout(2.0)
|
||||
|
||||
test_cases = {
|
||||
"1_Busta_Little_Endian": b'\x00\x07\x00' + ambe_frame,
|
||||
"2_Busta_Big_Endian": b'\x00\x00\x07' + ambe_frame,
|
||||
"3_Dati_Raw_Senza_Busta": ambe_frame,
|
||||
"4_Busta_Tipo_1": b'\x01\x07\x00' + ambe_frame,
|
||||
"5_Busta_Tipo_1_Big": b'\x01\x00\x07' + ambe_frame,
|
||||
}
|
||||
|
||||
print("Inizio test diagnostico UDP verso AMBEServer3003 sulla porta 2470...\n")
|
||||
|
||||
for name, pkt in test_cases.items():
|
||||
print(f"---> Eseguo test: [{name}]")
|
||||
|
||||
# Inviamo 3 frame identici in rapida successione.
|
||||
# (Alcuni chip AMBE hardware bufferizzano 2-3 frame prima di sputare fuori il primo pacchetto PCM)
|
||||
for _ in range(3):
|
||||
sock.sendto(pkt, server)
|
||||
time.sleep(0.02)
|
||||
|
||||
try:
|
||||
# Attendiamo la risposta
|
||||
resp, addr = sock.recvfrom(2048)
|
||||
print(f" BINGO! Risposta ricevuta ({len(resp)} bytes): {resp[:12].hex(' ')}...\n")
|
||||
except socket.timeout:
|
||||
print(" FALLITO: Nessuna risposta dal server.\n")
|
||||
|
||||
sock.close()
|
||||
Reference in New Issue
Block a user