From 20cd586670667d58fb918e29e27f9a011c238174 Mon Sep 17 00:00:00 2001 From: mobai Date: Wed, 21 Oct 2026 02:48:36 +0800 Subject: [PATCH] fix(HEL-722): prepare first audio and avatar inference before accepting peers Co-authored-by: multica-agent --- samples/companion/README.md | 30 +++++++ samples/companion/REPORT-HEL722.md | 80 +++++++++++++++++++ samples/companion/tools/check_driver_ready.py | 47 +++++++++++ samples/companion/tools/driver_ready.py | 64 +++++++++++++++ samples/companion/tools/patch_driver.py | 14 ++++ samples/companion/tools/trace_head.py | 20 +++++ 6 files changed, 255 insertions(+) create mode 100644 samples/companion/REPORT-HEL722.md create mode 100644 samples/companion/tools/check_driver_ready.py create mode 100644 samples/companion/tools/driver_ready.py diff --git a/samples/companion/README.md b/samples/companion/README.md index 3770a1f..038a00d 100644 --- a/samples/companion/README.md +++ b/samples/companion/README.md @@ -153,3 +153,33 @@ PCM哈希/RMS/门控、两块对应的渲染帧及RTP输出哈希/PTS,不由 `git show 415f837:samples/companion/tools/patch_driver.py`和同提交的 `driver_audio.py`重装HEL-718补丁,复用原avatar/权重。也可在候选启动前设 `HEL720_HEAD_RMS=0`关闭策略;该开关回滚保留代码但不闭唇。不要原地覆盖共享安装。 + +## HEL-722 启动准备(局部通过,整体同步仍未通过) + +`driver_ready.py` 与补丁一起携带。MuseTalk 在监听 HTTP 前依次执行真实文件 +解码/24k→16k 重采样、Whisper 特征提取/既有切窗、真实 avatar latent 的 +`inference_batch`。替换原固定张量的 `warm_up` 调用,不重复加载模型。 +探针仅引用已加载模型与 avatar,不构造 session/ASR/HeadGate/输出队列,不调用 +`put_audio_file`、TTS 或网络。预测结果丢弃,不生成真实话语的 start/end。 + +日志明确报告 preparing/ready/failed、各阶段和总耗时;失败抛异常并退出,HTTP +不会开始监听。成功后 `GET /hel722/ready` 返回本次准备状态与时间。这个状态只 +表示启动路径已准备,不表示音画同步验收通过。首次工作线程仍有约0.18秒模型 +调用,暖轮约0.08秒;已有批处理/排队/补静音的残差未在本轮修改。 + +```bash +python3 tools/prepare_driver.py --source /path/to/clean-c726943 --destination "$PRIVATE_DRIVER" +python3 tools/patch_driver.py "$PRIVATE_DRIVER" +/opt/hel715-verify/venv/bin/python tools/check_driver_ready.py "$PRIVATE_DRIVER" +/opt/hel715-verify/venv/bin/python tools/check_driver_head.py "$PRIVATE_DRIVER" +/opt/hel715-verify/venv/bin/python tools/check_driver_audio.py "$PRIVATE_DRIVER" +``` + +`trace_head.py` 诊断额外把原 PCM key/type/event 放在编码前 AVFrame 的 opaque +元数据中,区分真实全零 PCM 与合成静音;不改 PCM、事件、类型、队列策略或 RTP。 +仅显式诊断时加载,元数据不会进入网络编码。阶段计时包装和本轮完整命令随证据包。 + +回滚:停止自己的候选进程,在新建的 c726943 私有副本应用 +`77b7608` 的 `patch_driver.py`、`driver_audio.py`、`driver_head.py`,复用同 avatar +及权重,即恢复 HEL-720。不要原地去掉 readiness 而留其他混合版本。 +详见 `REPORT-HEL722.md`,不部署、不发布、不合并。 diff --git a/samples/companion/REPORT-HEL722.md b/samples/companion/REPORT-HEL722.md new file mode 100644 index 0000000..c31f611 --- /dev/null +++ b/samples/companion/REPORT-HEL722.md @@ -0,0 +1,80 @@ +HEL-722 一轮最小施工与验证,2026-10-21。基线 `hel-714-daily-talk@77b76083d05536893744d50ccf2a01c4a3c85a27`,原草稿 PR #2,base `main@1e9b08a`。 + +**结论:启动局部目标通过,交 in_review 复审;整体音画同步仍未通过,继续禁止部署、发布、合并。** 未调整门槛、PCM、特征窗、空闲视频队列或任何固定延迟。 + +## 已有预热缺口与最小修复 + +独立重现旧候选后,修正 HEL-721 的一项因果归因:约0.55秒并非全部是 MuseTalk 推理。首次 `/humanaudio` 在 aiohttp 主事件循环同步执行文件解码/重采样;`resampy.resample` 首次调用实测0.557秒,期间 WebRTC recv 停顿。首批真实模型推理另为0.201秒。旧启动 `warm_up` 只用固定 ones 特征和 latent 跑 pe/UNet/VAE,未跑上传重采样及 Whisper;会话的 `BaseASR.warm_up` 只填左右上下文,完全不提特征、不推理。固定张量与真实张量尺寸实际上均为 `(8,50,384)` / `(8,8,32,32)`,不是尺寸失配,不再沿用猜测。 + +旧候选本次实测:视频 recv 空洞0.574秒、render间隔0.632秒、视频时钟落后0.257秒,随后3个连续小于5ms的追赶间隔;视频深度39、音频深度93。首口部帧相对原第8块音频墙钟 vlag=-0.142秒,文件口径=-0.260秒。独立录端归零确实夸大偏差,但不能解释真实停顿。 + +`tools/patch_driver.py` 仅在 MuseTalk 的 HTTP 监听之前,改调用新 `driver_ready.prepare`: + +1. 用内部短 WAV 走原私有解码函数,覆盖相同24k→16k首次重采样路径。 +2. 使用同一已加载 Whisper、相同上下文长度及 `_feature2chunks([2,3],l/2,2)`。 +3. 用真实 avatar latent 调用原 `MuseReal.inference_batch`,丢弃预测。 + +没有重复加载模型。没有会话/ASR构造器、HeadGate、音频输入/输出队列、TTS、网络或 start/end,内部样本不进入真实话语。`preparing/ready/failed`、阶段和总耗时写日志;异常明确抛出,未监听 HTTP。成功后 `/hel722/ready` 返回状态。两次冷进程准备耗时0.968/0.973秒(重采样0.461/0.455、特征0.198/0.201、推理0.309/0.316);第二进程从创建到 ready 标志约13.0秒,包含导入、模型和avatar加载,监听观测另有1秒轮询量化,没有把准备耗时冒充完整启动耗时。 + +## 测量口径与关联可信度 + +固定音频原件24kHz/6.76秒、SHA256 `8c0c1ec943882d4aafbb4f8cda488f138a19231dabe2a58335777c0c42fff3dc`,未重合成、未裁头。检测脚本 SHA256 `081e40486793d9c57dbd9d682aacbefe58670eb07a9b22675953cd6b883f0ec6`,ROI `(271,341,180,220)`、服务端 motion/residual `3.1718642664/7.693739183`、浏览器 `4.294028549194336/10.492400400638578`,浏览器裁切 offset160、size640→512,全保留。 + +原PCM key→render两块配对→视频recv序号,使用同一主机 `time.monotonic/perf_counter`,原PCM SHA顺序匹配到编码前音频recv;接收端独立记录实际 recv 的同一单调时钟与两轨PTS。文件指标另列,不混作墙钟。服务端视频步进3600、音频320,序号配对无中途负延迟;未入RTP的尾部render分别17/18帧,均为关闭时未拉取的队尾;这些帧可在关闭前已入队,不能写成“全在teardown后才render”,详见原trace。冷2进一步在AVFrame opaque携带原key/type/event,338块/338唯一key全部哈希、类型、事件一致,含最后5块原始全零PCM,预热期间输入PCM数=0。 + +冷1与旧基线用顺序哈希;原块0/8/28均非零、可直接追踪。尾部333~337号全零块与合成静音字节相同,旧格式不能独立证明这5块身份,因此没有用零/低相关性的 placement 结果证明定位。新opaque证据补足冷2该风险;冷1的关键起点不依赖全零尾部。录端视频关联是顺序及连续性核验,不是逐帧像素指纹。没有宣称完整音素对应已验证。 + +## 六轮服务端原门槛 + +秒;差值=口部-响亮声音,负=嘴提前,绝对值≤0.15达标。S4为2秒打断的局部轮,不能当完整稳态样本。弱瞬态栏是原第8块内幅度>0.015的采样起点,按16k重采样后0.16925秒定位;原24k为0.169208秒,量化/录制误差约40ms视频、22ms主RMS。主RMS仍为0.015,不替换验收口径。 + +|轮/场景|文件口部-响亮|发送墙钟口部-响亮|弱瞬态差|原PCM首块差|墙钟/文件达标| +|---|---:|---:|---:|---:|---| +|S1 冷进程A首轮|-0.251|-0.240|+0.151|+0.319|否/否| +|S2 同peer空闲15秒|-0.148|-0.140|+0.270|+0.440|是/是| +|S3 暖连续轮|-0.091|-0.079|+0.312|+0.482|是/是| +|S4 说话中取消(104块)|-0.160|-0.159|+0.232|+0.560|否/否| +|S5 同peer取消后再送(诊断)|-0.091|-0.079|+0.311|+0.481|是/是| +|S6 冷进程B首轮|-0.193|-0.178|+0.272|+0.441|否/否| + +发送墙钟、文件均3/6;两次冷首轮仍未达整体同步门槛。接收端实际收帧墙钟口部-响亮依次为 -0.317/-0.198/-0.148/-0.212/-0.149/-0.259,记录的是 aiortc 解码接收时刻,不是浏览器扬声器时间,也不与发送端验收行偷换。 + +|轮|首口部帧vlag(相对所配原块)|首次推理|上传重采样|视频recv最大间隔*|render最大间隔*|音频补位块/内容跨度拉伸| +|---|---:|---:|---:|---:|---:|---| +|旧基线冷首轮|-0.142|0.201|0.557|0.574|0.632|0 / 0.00| +|S1|+0.160|0.178|0.083|0.134|0.342|0 / 0.00| +|S2|+0.280|0.080|0.085|0.128|0.426|2 / 0.04| +|S3|+0.322|0.082|0.086|0.116|0.339|6 / 0.12| +|S4|+0.241|0.084|0.092|0.148|0.385|8 / 0.16| +|S5|+0.320|0.079|0.084|0.133|0.342|8 / 0.16| +|S6|+0.281|0.178|0.090|0.111|0.343|3 / 0.06| + +*窗口为上传前0.2秒至后2秒,包含跨窗口起点的间隔,避免漏掉上传时的停顿。原批处理按8帧突发生产仍存在;没有宣称逐帧生产间距40ms。两次冷首轮时钟最大落后0.093/0.071秒,连续<5ms追赶间隔最多1个,已与暖轮0~1个同构,原0.24秒异常及连续追赶消失。冷首轮视频深度峰值16/14(暖轮约14~16),音频深度25/21,不是通过新增一秒排队取得结果。 + +冷工作线程首推仍约0.178秒,暖轮约0.08秒;预热没有声称覆盖所有线程局部初始化。原预渲染队列相位、每批边界和合成音频补位仍使冷暖/轮间差异浮动:例如S1第一口部render→recv为0.321秒,S6为0.506秒,S6弱到响亮之间另插入0.06秒音频补位。已有逐块墙钟表可以分解这些差异,不能将全部差异继续归咎弱头,也没有调阈值或补固定延迟抵消它们。 + +## 暖驱动新peer浏览器对照(单列) + +同驱动A已暖,新建peer、相同固定音频四轮。共同MediaRecorder文件的口部-响亮为 -0.234/-0.211/-0.220/-0.221秒,4/4过浏览器0.25门槛。驱动侧首口部对应原PCM对vlag为 +0.320/+0.301/+0.242/+0.321;第2/4轮是第7/8块混合对,保留预测画面符合既有规则。它们不证明冷驱动已热,故不冒充独立冷启动。浏览器文件弱瞬态口径另为 +0.144/+0.133/+0.114/+0.215秒(有损解码采样幅度>0.015,不代替主RMS门槛);原PCM首块在浏览器播放端未独立定位,不能用低相关性推算。浏览器音频通路额外延迟仍未独立标定,不批准固定补偿;文件采集也不冒充物理扬声器/屏幕或真人听感。 + +## HEL-721 统计纠错与残余风险 + +按原列值独立取绝对值,服务端S4/S6达标(2/6),浏览器第3/4轮达标(2/4);实时修正列同样是S4/S6,不是“仅S4”或“浏览器全超线”。附件 `HEL721-corrected-gates.json`逐轮列出,原复审zip原封保留,不沿用其错误gate文字。原结论整体未通过仍成立。 + +全部固定音频完整轮仅前8块闭唇、首个超门槛块后弱音保持;本轮全trace渲染标记0冲突。S4已输入338块,取消前实际输出104块,其余234块取消;S5新话语从新start重置,产品路径仍用销毁peer隔离。首轮嘴不再早于配对块,但相对响亮/弱瞬态仍有正负残差;稳态包络只是运动能量启发式,音素与真人感知未验。本卡只交局部修复复审,不盲调残差。 + +## 检查、隔离、重现与回滚 + +新增2项检查:禁止探针构造真实会话/写PCM/通知/触门控,准备成功只返回状态;注入解码/推理失败必须抛异常。另实跑进程级重采样故障,启动exit=1、明确failed日志,8010未监听。原4项HeadGate和4项队列/时钟检查全过。干净c726943副本应用及重复应用116个Python文件哈希一致,和私有运行候选一致。 + +`npm run build`、runtime/tools的ruff、diff检查通过。实际Chromium准备中/说话中取消、快速重入、断网/恢复/offer故障通过,pageerror为空,有页面状态、事件、截图和连续录像。历史快速重入并行首测超时仍未定位;本轮通过不关闭历史疑点。网关故障注入中仍有既有SSL断连回调异常,页面恢复成功,未扩范围修共享服务。核心人格/记忆模块未改,沿用既有核心检查,未机械重跑。 + +私有工作目录 `/opt/hel722-fix`,源代码、模型/权重/avatar只读复用材料,新建代码副本;不修改共享安装/配置/端口/数据。仓库CLI因未配置该项目资源拒绝checkout,改用明确仓库URL普通git clone,确认工作树干净、head/base与无并行运行;不新建PR。 + +实际完整命令在证据包 `diagnostic/supervisor.py`、services.json、逐轮analysis JSON及脚本中。baseline在打HEL-722补丁之前跑;cold1为 `record_driver.py --rounds 0,15,1 --post 9`;cold2为相同录制器移除打断段的 `record_once.py --rounds 0 --post 9`。先查8010/8014/8933空闲,再前台运行supervisor,发送record命令,收齐结果后stop,禁止留下运行中诊断。浏览器脚本按原README命令运行,需已有Playwright/Chromium库路径;全部文件随附件,无新依赖。`diagnostic/summarize.py`在证据包根运行产生逐轮JSON。`analyze.py`在私有远端执行检测,统一窗口和参数,固定检测器未改。 + +前台监督进程均已收回;对照Multica daemon PID44286后,只停止记录的自有精确PID;cleanup.json记录实际cmd/cwd/exit。8010/8014/8933释放,18080/18081/9880/10095等共享服务PID保持。无诊断留运行。 + +完整回滚:停止自己的候选,另建c726943私有副本,取 `77b7608:samples/companion/tools/{patch_driver.py,driver_audio.py,driver_head.py}` 应用,复用同avatar/权重;不要编辑共享安装。仓库本次提交可用 `git revert <本次提交>`撤回,提交号见本卡结果评论。只推原候选分支,不合并。 + +真人弱音听感、画面循环/切点/暖色/书本手部坐垫、自然抢话、手机真机、后台锁屏、共享TTS内部GPU即停仍逐项待验。本轮不访问4080、不新增依赖、不部署、不发布。 diff --git a/samples/companion/tools/check_driver_ready.py b/samples/companion/tools/check_driver_ready.py new file mode 100644 index 0000000..96cdbc2 --- /dev/null +++ b/samples/companion/tools/check_driver_ready.py @@ -0,0 +1,47 @@ +"""Startup failure must propagate; preparation must never touch live I/O or gates.""" + +import pathlib +import sys +import unittest +from types import SimpleNamespace +from unittest.mock import patch + +import numpy as np + +root = pathlib.Path(sys.argv.pop(1)).resolve() +sys.path.insert(0, str(root)) +from avatars.base_avatar import BaseAvatar # noqa: E402 +from avatars.hel720_head import HeadGate # noqa: E402 +from avatars.hel722_ready import prepare # noqa: E402 +from avatars.musetalk_avatar import MuseReal # noqa: E402 + + +class ReadyChecks(unittest.TestCase): + def test_decoder_failure_is_fatal_without_constructing_session(self): + with patch.object(MuseReal, '__init__', side_effect=AssertionError('live session')), \ + patch('resampy.resample', side_effect=ValueError('injected resampler failure')), \ + self.assertRaisesRegex(RuntimeError, 'decode_resample'): + prepare(SimpleNamespace(), None, None) + + def test_discard_predictions_and_no_pcm_events_or_gate_mutation(self): + opt = SimpleNamespace(fps=25, batch_size=8, l=10, r=10) + processor = SimpleNamespace(audio2feat=lambda x: np.zeros((1500, 5, 384), np.float16)) + avatar = [None, None, None, None, [np.zeros((1, 8, 32, 32))]] + model = [None, None, None, None, processor] + # Real decode/resample and feature slicing; deny all live-session entrypoints. + with patch.object(MuseReal, '__init__', side_effect=AssertionError('live session')), \ + patch.object(HeadGate, 'classify', side_effect=AssertionError('gate')), \ + patch.object(BaseAvatar, 'put_audio_file', side_effect=AssertionError('input')), \ + patch.object(BaseAvatar, 'notify', side_effect=AssertionError('event')), \ + patch.object(MuseReal, 'inference_batch', return_value=np.zeros((8, 4, 4, 3))) as infer: + status = prepare(opt, model, avatar) + self.assertEqual(status['state'], 'ready') + self.assertEqual(status['feature_shape'], [8, 50, 384]) + self.assertEqual(infer.call_count, 1) + self.assertNotIn('prediction', status) + with patch.object(MuseReal, 'inference_batch', side_effect=RuntimeError('GPU failed')), \ + self.assertRaisesRegex(RuntimeError, 'inference'): + prepare(opt, model, avatar) + + +unittest.main() diff --git a/samples/companion/tools/driver_ready.py b/samples/companion/tools/driver_ready.py new file mode 100644 index 0000000..4fdea64 --- /dev/null +++ b/samples/companion/tools/driver_ready.py @@ -0,0 +1,64 @@ +"""Warm the pinned MuseTalk file/feature/inference path before HTTP accepts peers. + +No avatar constructor, input/output queue, HeadGate, TTS or network is used. +The probe owns only model references and a private ASR helper; discard predictions. +""" + +import json +import time +from io import BytesIO + +import numpy as np +import soundfile as sf + + +def prepare(opt, model, avatar): + from avatars.audio_features.whisper import WhisperASR + from avatars.base_avatar import BaseAvatar + from avatars.musetalk_avatar import MuseReal + from utils.logger import logger + + started = time.monotonic() + state = {'state': 'preparing', 'started_wall': started, 'stages': {}} + logger.info('HEL-722 readiness %s', json.dumps(state)) + stage = 'decode_resample' + try: + # Match the actual upload decoder, including its first-use resampler JIT. + # These bytes are local, never passed to put_audio_file/put_audio_frame. + wav = BytesIO() + sf.write(wav, np.zeros(2400, np.float32), 24000, format='WAV', subtype='PCM_16') + wav.seek(0) + probe = MuseReal.__new__(MuseReal) + probe.sample_rate = 16000 + t = time.monotonic() + BaseAvatar._BaseAvatar__create_bytes_stream(probe, wav) + state['stages'][stage] = time.monotonic() - t + + probe.batch_size = opt.batch_size + probe.vae, probe.unet, probe.pe, probe.timesteps, probe.audio_processor = model + probe.input_latent_list_cycle = avatar[-1] + # __new__ avoids ASR queues/gates as well as session/output construction. + asr = WhisperASR.__new__(WhisperASR) + stage = 'features' + t = time.monotonic() + inputs = np.zeros((opt.l + opt.r + opt.batch_size * 2) * (16000 // (opt.fps * 2)), + dtype=np.float32) + features = probe.audio_processor.audio2feat(inputs) + chunks = asr._feature2chunks(features, opt.batch_size, [2, 3], opt.l / 2, 2) + state['stages'][stage] = time.monotonic() - t + state['feature_shape'] = list(np.stack(chunks).shape) + state['latent_shape'] = list(avatar[-1][0].shape) + stage = 'inference' + t = time.monotonic() + prediction = probe.inference_batch(0, chunks) + if len(prediction) != opt.batch_size or not np.isfinite(prediction).all(): + raise RuntimeError('Invalid startup inference output') + state['stages'][stage] = time.monotonic() - t + state.update(state='ready', elapsed=time.monotonic() - started) + logger.info('HEL-722 readiness %s', json.dumps(state)) + return state + except Exception as exc: + state.update(state='failed', stage=stage, error=str(exc), + elapsed=time.monotonic() - started) + logger.exception('HEL-722 readiness %s', json.dumps(state)) + raise RuntimeError(f'HEL-722 startup warmup failed at {stage}') from exc diff --git a/samples/companion/tools/patch_driver.py b/samples/companion/tools/patch_driver.py index 37b382d..7d57ce6 100644 --- a/samples/companion/tools/patch_driver.py +++ b/samples/companion/tools/patch_driver.py @@ -144,3 +144,17 @@ replace_once(p, " if audio_frames[0].type!=0 and audio_frames[1].type replace_once(p, " self.speaking = False\n audiotype = audio_frames[0].type", " self.speaking = current_speaking\n audiotype = audio_frames[0].type or 1") print("Installed HEL-720 per-PCM head-only render flags (candidate RMS 0.001; 0 disables)") + +# HEL-722: prepare actual upload + feature + avatar inference before listening. +(root / "avatars/hel722_ready.py").write_text( + Path(__file__).with_name("driver_ready.py").read_text() +) +p = root / "app.py" +replace_once(p, " warm_up(opt.batch_size,model) ", ''' from avatars.hel722_ready import prepare + hel722_ready = prepare(opt, model, global_avatars[opt.avatar_id])''') +replace_once(p, ' appasync["rtc_manager"] = rtc_manager', ''' appasync["rtc_manager"] = rtc_manager + if opt.model == 'musetalk': + async def hel722_readiness(request): + return web.json_response(hel722_ready) + appasync.router.add_get('/hel722/ready', hel722_readiness)''') +print("Installed HEL-722 fail-closed startup preparation; /hel722/ready after success") diff --git a/samples/companion/tools/trace_head.py b/samples/companion/tools/trace_head.py index 72c08ef..405f2b3 100644 --- a/samples/companion/tools/trace_head.py +++ b/samples/companion/tools/trace_head.py @@ -26,6 +26,22 @@ classify = HeadGate.classify init = BaseAvatar.__init__ push = webrtc.HumanPlayer.push_audio recv = webrtc.PlayerStreamTrack.recv +player_init = webrtc.HumanPlayer.__init__ + + +def init_player(self, avatar_session, *args, **kw): + player_init(self, avatar_session, *args, **kw) + put = self.audio._queue.put + def tagged_put(item, *args, **kw): + frame, eventpoint, kind = item + keys = getattr(avatar_session, 'hel722_trace_pair', []) + cursor = getattr(avatar_session, 'hel722_trace_cursor', 0) + frame.opaque = {'key': keys[cursor] if cursor < len(keys) else None, + 'origin_kind': kind, 'status': eventpoint, + 'sid': avatar_session.sessionid} + avatar_session.hel722_trace_cursor = cursor + 1 + return put(item, *args, **kw) + self.audio._queue.put = tagged_put def classify_trace(self, frame): @@ -46,6 +62,8 @@ def init_trace(self, opt): def render_get(*args, **kw): result = get(*args, **kw) image, frames, index = result + self.hel722_trace_pair = [getattr(f, 'hel720_trace', None) for f in frames] + self.hel722_trace_cursor = 0 write('render', sid=self.sessionid, index=index, closed=image is None, keys=[getattr(f, 'hel720_trace', None) for f in frames], flags=[getattr(f, 'hel720_head_closed', False) for f in frames], @@ -67,12 +85,14 @@ async def receive(self): fields = {'player': id(self._player), 'kind': self.kind, 'pts': frame.pts, 'tb': str(frame.time_base), 'depth': self._queue.qsize()} if self.kind == 'audio': + fields['origin'] = frame.opaque fields['pcm_sha256'] = digest(frame.to_ndarray()) fields['rms'] = float(np.sqrt(np.mean((frame.to_ndarray().astype(float)/32768)**2))) write('recv', **fields) return frame +webrtc.HumanPlayer.__init__ = init_player HeadGate.classify = classify_trace BaseAvatar.__init__ = init_trace webrtc.HumanPlayer.push_audio = push_audio