From 6d0b3d5bec8a0a90178e16fa0d2c42dcb5bba660 Mon Sep 17 00:00:00 2001 From: javis-bot Date: Wed, 11 Nov 2026 01:54:34 +0900 Subject: [PATCH] fix(m0): get a stopped or reloaded YouTube player going again and measure the window again On the gaming PC the player errored about 38 s into the first window with Jarvis off; the kit had no way to notice, so every later window measured a paused, empty player, and after the user reloaded the page the injected counters were gone and the snapshot script threw, ending the stage early. - The snapshot reports a lost page (counters gone, or the script could not run while the page loaded) and the player's own error screen (first line only, bracketed IDs removed) instead of throwing. - Before each window the kit presses play on a stopped player and loads the page again when that is not enough, or when the page was lost or errored. - A window the player spoilt (error, reload, pause, ad, seek, buffering, no frames) is measured again, up to 3 times in all, with the earlier attempts and the fixes kept in the row; a lower quality or frame rate is not, since a busy GPU can cause it. Co-Authored-By: Claude Opus 5.5 --- scripts/m0/README.md | 2 +- scripts/m0/m0lib/video.py | 118 +++++++++++++++++++++++++++++------- tests/test_m0_kit.py | 123 +++++++++++++++++++++++++++++++++++++- 3 files changed, 216 insertions(+), 27 deletions(-) diff --git a/scripts/m0/README.md b/scripts/m0/README.md index 163bff7..e8cc995 100644 --- a/scripts/m0/README.md +++ b/scripts/m0/README.md @@ -74,6 +74,6 @@ LLM 단계는 8080 포트를 씁니다. 다른 프로그램이 이 포트를 쓰 `run_m0_game_live.bat`을 더블클릭하면 실제 게임을 켠 상태로 잽니다(`gamemode_live`). 게임을 창 모드로 켜고 플레이 화면까지 들어간 뒤 Enter를 누르고 15초 안에 게임으로 돌아가면 됩니다. 게임 중 배치 4개(전문가 2GB·0GB, 음성 인식 GPU·CPU)를 차례로 재고 10~15분 걸리며, 끝나면 알림음이 울립니다. 게임 화면이나 게임 이름은 저장하지 않고 VRAM 사용량과 속도만 적습니다. 그래픽 메모리를 많이 쓰는 게임이면 배치가 켜지지 않을 수 있는데, 그것도 결과로 적습니다. -`run_m0_video.bat`을 더블클릭하면 Jarvis 옆에서 보는 영상이 끊기는지 잽니다(`video_drops`). 크롬(없으면 엣지)이 새 임시 프로필로 떠서 유튜브의 Blender 영상(Big Buck Bunny, 1080p 60fps, 소리 끔)을 틉니다. 광고가 나오면 건너뛸 수 있을 때 건너뛰고 끝날 때까지 기다립니다. 영상을 틀어 둔 채로 (1) Jarvis를 끈 상태 1분, (2) LLM(평소 배치, STT 자리와 여유 1GB)과 STT를 켜 두고 쉬는 상태 1분, (3) LLM이 답하고 STT가 10명 동시 전사를 쉬지 않고 하는 상태를 GPU 95% 제한 없이 두 번, 제한을 켜고 두 번, (4) 다시 Jarvis를 끈 상태 1분을 잽니다. 각각 끊긴 프레임 수(유튜브 "전문가용 통계"의 Dropped Frames와 같은 값)와, 화면에 프레임이 50ms·100ms 넘게 안 바뀐 횟수를 셉니다. 10~15분 걸립니다. 그동안 브라우저 창을 가리거나 최소화하지 말고 PC에 손대지 않으시면 됩니다. 광고, 일시정지, 버퍼링, 건너뛰기가 끼었거나 화질이 1080p 60fps가 아니었던 구간, 제한을 켰는데 Jarvis를 실제로 멈추지 못한 구간은 기록만 하고 비교에서는 뺍니다. +`run_m0_video.bat`을 더블클릭하면 Jarvis 옆에서 보는 영상이 끊기는지 잽니다(`video_drops`). 크롬(없으면 엣지)이 새 임시 프로필로 떠서 유튜브의 Blender 영상(Big Buck Bunny, 1080p 60fps, 소리 끔)을 틉니다. 광고가 나오면 건너뛸 수 있을 때 건너뛰고 끝날 때까지 기다립니다. 영상을 틀어 둔 채로 (1) Jarvis를 끈 상태 1분, (2) LLM(평소 배치, STT 자리와 여유 1GB)과 STT를 켜 두고 쉬는 상태 1분, (3) LLM이 답하고 STT가 10명 동시 전사를 쉬지 않고 하는 상태를 GPU 95% 제한 없이 두 번, 제한을 켜고 두 번, (4) 다시 Jarvis를 끈 상태 1분을 잽니다. 각각 끊긴 프레임 수(유튜브 "전문가용 통계"의 Dropped Frames와 같은 값)와, 화면에 프레임이 50ms·100ms 넘게 안 바뀐 횟수를 셉니다. 10~15분 걸립니다. 그동안 브라우저 창을 가리거나 최소화하지 말고 PC에 손대지 않으시면 됩니다. 광고, 일시정지, 버퍼링, 건너뛰기가 끼었거나 화질이 1080p 60fps가 아니었던 구간, 제한을 켰는데 Jarvis를 실제로 멈추지 못한 구간은 기록만 하고 비교에서는 뺍니다. 영상이 멈추거나 유튜브 오류가 뜨거나 페이지가 새로고침되면 키트가 알아서 다시 틀고(재생을 누르고, 안 되면 페이지를 다시 엽니다) 그 구간을 최대 3번까지 다시 잽니다. 직접 새로고침하지 않으셔도 됩니다. 화질이나 프레임 수가 떨어진 구간은 GPU 탓일 수 있어서 다시 재지 않습니다. 다 끝나고 필요 없으면 작업 폴더(`\JarvisM0`)를 통째로 지우면 됩니다. Python, 모델, Strata(엔진과 설정 포함)는 모두 그 안에 설치하도록 지정해 두었습니다. diff --git a/scripts/m0/m0lib/video.py b/scripts/m0/m0lib/video.py index 3335c6e..e6f8d02 100644 --- a/scripts/m0/m0lib/video.py +++ b/scripts/m0/m0lib/video.py @@ -18,6 +18,7 @@ from __future__ import annotations import base64 import json import os +import re import shutil import socket import struct @@ -43,6 +44,10 @@ SETTLE_S = 5 # after a quality change or a seek, before a window starts MIN_LEFT_S = 240 # a window that could reach the end starts the video again first GAP_MS = (50, 100) # a gap between shown frames this long is a visible hitch at 60 fps ROUNDS = ("busy", "busy_cap95", "busy_cap95_2", "busy_2") +# A window spoilt by the player (an error, a reload, a pause, an ad, buffering) is measured again, at most +# this many times in all; one spoilt by a lower quality or frame rate is not (a busy GPU can cause that). +ATTEMPTS = 3 +REPLAY_S = 30 # pressing play on a stopped player, before the page is loaded again # -------------------------------------------------------------------------- @@ -181,15 +186,22 @@ _INSTALL = """(() => { return true; })()""" % {"g0": GAP_MS[0], "g1": GAP_MS[1]} -_RESET = "(() => { const m = window.__m0; m.shown = 0; m.last = null; m.maxGap = 0; m.gaps = [0, 0]; " \ +_RESET = "(() => { const m = window.__m0; if (!m) return false; m.shown = 0; m.last = null; m.maxGap = 0; m.gaps = [0, 0]; " \ "m.waits = 0; m.pauses = 0; m.seeks = 0; m.ad = false; m.minH = m.maxH = m.v.videoHeight; return true; })()" +# ``lost`` when the counters are gone (the page was loaded again, or YouTube swapped the