MCPcopy Create free account
hub / github.com/modelscope/FunASR / async_vad

Function async_vad

runtime/python/websocket/funasr_wss_server.py:539–553  ·  view source on GitHub ↗
(websocket, audio_in: bytes)

Source from the content-addressed store, hash-verified

537# ===================== 推理:全部改为“线程池 + 限流” =====================
538
539async def async_vad(websocket, audio_in: bytes):
540 # model_vad.generate 是阻塞的,必须 offload
541 out = await run_blocking(_generate_sync, model_vad, audio_in, websocket.status_dict_vad, sem=SEM_VAD)
542 segments_result = out[0].get("value", [])
543
544 speech_start = -1
545 speech_end = -1
546
547 if len(segments_result) == 0 or len(segments_result) > 1:
548 return speech_start, speech_end
549 if segments_result[0][0] != -1:
550 speech_start = segments_result[0][0]
551 if segments_result[0][1] != -1:
552 speech_end = segments_result[0][1]
553 return speech_start, speech_end
554
555
556def _sv_and_match_sync(audio_in: bytes, reload_sec: int):

Callers 1

ws_serveFunction · 0.85

Calls 1

run_blockingFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…