Start

Video playback

Source VIDEO_HOWTO.md Synced 2026-11-30 · db53b016

A public YouTube video completed with decoded frames and non-silent virtual PCM on the October 3 QEMU development build. On the October 7 kernel, the embedded player also completed with captured audio in a repeat run, but the full youtube.com watch page remains unresponsive before playback. Local WebM and WebAudio tests pass. Physical speakers, higher resolutions, and reliable long-session browsing remain unverified. The current Chromium bundle is for private testing only; it still launches with --no-sandbox and incomplete credits.

October 7 final-kernel playback check#

An isolated 4-vCPU/8-GiB WHPX QEMU guest with kernel SHA-256 c9aac4f8ba974497e43b58f9744320a0a6d12b4b4b3f2bbc4ff04c7f1d675cc0 launched the private-test-only Chromium payload. The small diagnostic page at http://10.0.2.2:8765/youtube-embed.html loaded YouTube's official embedded player for jNQXAC9IVRw. A click advanced the streamed video to the end: the first capture shows a later visual frame, and the final capture shows the replay control and 0:19 / 0:19. The page is served by the host-only fixture; it does not save or relay YouTube media. Google's embedding guidance requires an HTTP Referer, so opening an embed URL directly in the address bar is not an equivalent test. The private browser still uses --no-sandbox and has incomplete generated credits, so this does not clear it for distribution.

Audio did not pass this run. The browser showed an audio indicator and ALSA accepted PCM writes, but build/youtube-embed-final-20261007/playback.wav was entirely silent: 471.97 seconds, zero nonzero samples. The ignored evidence is in that folder (shots/embed-page.png, shots/embed-play.png, shots/embed-final.png, serial.log, pcm-report.json). The video visibly completed; audible output, physical speakers, longer clips, and the Beelink remain unverified. An earlier fresh 2-vCPU/8-GiB run on kernel 2444b9167ee7c8a513f8d7488f517cb863d3cd8d6aafd19f6bde4b127ed89c23 passed a 2.744-second local VP8/Vorbis HTML5 clip (78 decoded frames, three dropped, 19,069 decoded audio bytes, 0.907 seconds of media-clock progress per 1.001 seconds wall time), then loaded the full YouTube watch page and thumbnail but stalled before playback. Its guarded CDP video query received no renderer response. That failed watch-page run is in build/youtube-current-20261007/.

October 7 follow-up: audio isolation and full watch pages#

A second isolated 4-vCPU/8-GiB WHPX run used diagnostic kernel SHA-256 75e6c20509eab20bb5a4efd55dd18afaa273892eafd20469d51b0649a839a4d2 and the same private Chromium payload. The generated 440 Hz tone reached ALSA as nonzero 16-bit samples (peak 6000) and QEMU captured 257,234 nonzero stereo sample values with a measured frequency of 440.000 Hz. This isolates the previous silent capture from a general HDA/ALSA device failure.

The official YouTube embed then played the public 19-second clip again. In the capture segment beginning at 200 seconds, 1,668,346 sample values were nonzero, with peak 28,548; audio was active for 18.964 seconds after the local tone had ended. The video visibly advanced and the browser showed its tab audio icon. This demonstrates virtual audio for the embed in this run, though the earlier embed capture was all zero and physical speakers remain untested. Evidence is in ignored build/youtube-audio-trace-20261007/ (serial.log, shots/embed-play.png, playback.wav); the short diagnostic sample trace was removed from the shared kernel source after the test.

The actual desktop https://www.youtube.com/watch?v=jNQXAC9IVRw page reached its player at 0:00 / 0:19 after about 40 seconds, but clicks on Play did not advance the timer. QMP input became delayed by several seconds; the serial log recorded Play pointer events, repeated HDA stream restarts, Chromium audio-read timeouts and a long compositor stall. A bounded renderer probe could not capture a free kernel lock. These are observations, not a proven root cause. Screenshots are shots/watch-later.png and shots/watch-actual-play.png in that folder.

In a separate fresh-profile guest, plain m.youtube.com/watch redirected to the desktop watch page. A test-only CDP mobile user-agent override returned success, and the genuine mobile watch URL painted a TAP TO UNMUTE player frame, but identical frames persisted for more than two minutes. Clicking the unmute control did not change the frame or produce HDA writes; a bounded renderer query did not return. Evidence is in ignored build/youtube-mobile-watch-20261007/ (shots/ua-mobile.png, shots/mobile-progress.png, shots/mobile-unmute.png, serial.log). No mobile user-agent flag or special YouTube launcher was added to the normal Web app. Neither full watch-page variant passed playback. The next work is to isolate the browser/OS scheduling stall, then repeat video-clock, controls, and PCM checks on the actual website before calling YouTube usable.

A further isolated 4-vCPU/8-GiB WHPX run used diagnostic kernel SHA-256 853a0742b38da3a52c34a55cdd4c2264be9c19982424cb0a053acdbfc447e470. Web followed youtu.be/jNQXAC9IVRw to the official desktop watch page, painted the 0:00 / 0:19 player, and recorded a Play pointer event. At guest time 534 seconds, the same player image and 0:00 timer remained. This bounded run did not reproduce the earlier unusually long ioctl under the big kernel lock: its maximum observed hold was syscall 232 (epoll_wait), about 0x1994184a TSC cycles. The earlier ioctl outlier is therefore not established as the watch-page stall's cause. Screenshots and serial evidence are in ignored build/youtube-ioctl-trace-20261007/ (shots/watch-click.png, shots/watch-final.png, serial.log). The temporary lock-timing probe was removed after capture; no speculative ioctl behavior change was made.

To reproduce the embed test, prepare the existing pinned media fixtures, run python tools/media-playback/server.py --port 8765, and open http://10.0.2.2:8765/youtube-embed.html from an isolated QEMU guest using user-mode networking. Click the player's red Play button and watch the timer reach 0:19 / 0:19. Use a separate test profile; do not use this host fixture as a production distribution path. The full watch page still needs a responsive-playback fix before calling YouTube usable.

Previous stability pass#

The later October 3 run used kernel 8583de8f5609, QEMU WHPX with four CPUs and 8 GiB RAM, and a fresh disposable FAT16 browser disk. All four local VP8/Vorbis and VP9/Opus HTML5/MSE cases passed clock, pause, seek, and ending checks again. Their run IDs are 1791052762093-d6a6aae53178f, 1791052860858-8b7b2be08d929, 1791052915035-90795f3b5b8f7, and 1791052955655-1b4c69ae67ac2 in the fixture telemetry.

The mapping hint table now coalesces overlapping records and preserves live edges when an unmap split cannot allocate metadata. This corrects reproduced bookkeeping failures; it does not establish stable browser memory use. The same guest grew to approximately 3,683 MiB committed with 18 address spaces after initial browsing, the four local cases, and a YouTube navigation. The YouTube document had no video element at the sampled point and retained the old displayed frame. Creating another tab raised committed memory above 4,100 MiB. The 30-minute responsive browsing/playback target was not met.

Evidence is under ignored build/browser-stability-qemu/: kernel/source hashes, serial log, individual navigation reports, memory samples, and screenshots. The automatic sampler stopped when a diagnostic operation held the QMP connection; subsequent manual samples are separate. Do not interpret that sampling gap as a constant-memory interval. Diagnostic pauses and production tracing also make this unsuitable as an FPS benchmark.

The memory audit separates implemented metadata fixes from remaining retention and lifetime problems. This pass did not retest physical speakers or the Beelink, change the browser sandbox flags, or establish YouTube controls and longer playback.

Earlier playback evidence#

The October 3, 2026 runs used the staged Chrome/Chromium 152 runtime, QEMU WHPX, a disposable guest disk, and the native XerisOS kernel. That build has SHA-256 prefix c1a29d; the four video combinations below passed on the preceding 741cd537 build. Clips are short and 320x240, so these results do not establish sustained FPS or high-resolution playback quality.

Check Observed result
VP8/Vorbis and VP9/Opus, HTML5 Both passed clock-rate, pause, seek, and ending checks
VP8/Vorbis and VP9/Opus, Media Source Extensions (MSE) Both passed clock-rate, pause, seek, and ending checks
Local-fixture fullscreen Enter and exit worked in QEMU; YouTube fullscreen remains unverified
Fully downloaded three-second WAV, played from a Blob URL Clock advanced 0.918373 s in 1.0017 s; reached its end; captured 440 Hz PCM
WebAudio oscillator Clock advanced 2.0053 s in 2.002 s; captured 440 Hz PCM
ALSA device discovery Before: zero hints. After: one real playback hint, hw:CARD=XerisHDA,DEV=0, which opened successfully
Guest libasound device setup All 16 rate/channel/device configurations passed after negotiation fixes
Guest PCM handle lifetime Passed: closing an older stream preserves the replacement's prepared state; snd_pcm_drop succeeds
YouTube website/player Public 19.021 s clip completed at 320x240, unmuted at volume 1; 288 total frames, 13 dropped, and captured PCM

Evidence is local and ignored by Git:

  • build/media-playback/telemetry.jsonl contains the four video runs and Blob WAV run 1791009088381-fde2edd70689b8, including clock measurements.
  • build/youtube-qemu/blob-tone-pcm.json records 264,550 nonzero sample values across both channels, spanning 3.179274 s from first to last active sample.
  • build/youtube-qemu/hints-webaudio-pcm.json records 171,216 nonzero sample values across both channels, spanning 1.965 s. Both captures are stereo, 44.1 kHz, with a measured tone near 440 Hz.
  • build/youtube-qemu/alsa-hints-before.log and alsa-hints-after.log preserve the discovery comparison and guest probe results.
  • build/youtube-qemu/youtube-hints-pcm.json records 1,667,826 nonzero sample values and 19.1814 s from first to last active sample. The actual website test used https://www.youtube.com/watch?v=jNQXAC9IVRw; bounded one-second samples showed approximately normal clock progress through ended: true, with 251,930 decoded audio bytes. This was website playback, not a downloaded test asset. The separate YouTube controls attempt did not complete because a later page load stalled.
  • build/youtube-qemu/youtube-success-and-oom.log preserves that successful playback and the later fault after further navigation. The kernel reported committed=4862MB dry=1 before the failure in the 8 GiB guest. The broader out-of-memory/page-table rollback repair was not applied. A separate earlier loading stall remained in a Blink hash-table insertion loop; its cause has not been established.
  • build/youtube-qemu/youtube-controls-loading-stall.log records a fresh-run loading stall without physical pool exhaustion (dry=0). A bounded 9.74 s observation found no recurrence of the earlier Blink loop. The cause remains unverified; it must not be attributed solely to the out-of-memory failure.

Physical speaker output has not been verified. Frame counters include seeking and are not a frame-pacing benchmark. Earlier PCM completion records used the video element's state by mistake; use the newer element-specific clock records and separate PCM captures. An empty capture segment is not evidence of silence being submitted to the device.

These results follow fixes for expired scheduler waits, ALSA negotiation and status/control ioctls, per-handle playback ownership, and HDA consumption across ring wrap and underruns. ALSA readiness now honors the negotiated buffer and avail_min; protected BSP maintenance clears consumed samples. Adding a hint for the real hardware PCM also corrected WebAudio's device discovery: its earlier clock advanced through Chromium's fake output path without producing any captured PCM.

Prepare a disposable runtime#

Use a separate test disk/profile and a kernel/symbol pair from the same build. The browser and its runtime libraries are separate inputs; they are not included by these test tools. Keep the tested browser version and launch arguments with the run's evidence.

Before creating the guest data image, ensure its staged payload includes:

  • FONTS/UI.TTF, copied from the repository's Inter-Regular.ttf, with its font license retained in any distributed package.
  • XKBMAP.TXT, copied from assets/XKBMAP.TXT, with assets/xkb-data.copyright retained when distributing it.
  • The complete existing browser/runtime payload, including its loader and required shared libraries.

Missing fonts can make the browser render incorrectly. Missing XKBMAP.TXT prevents the Wayland keyboard map from being supplied. Check the serial log for font activation and for keymap: no /XKBMAP.TXT before debugging codecs. Use QEMU user-mode networking for the host fixture address below, and an HDA device plus an audio backend when testing sound. Record audio to a disposable WAV if useful; check its samples for actual non-silent output, not merely that a file exists.

Run the local baseline#

From the repository root with Python 3; Node.js is needed only for the JavaScript regression checks:

python tools/media-playback/server.py --download --prepare
python tools/media-playback/test_server.py
node tools/media-playback/test_clock.js
node tools/media-playback/test_blob_tone.js
python tools/media-playback/server.py --port 8765

The downloader uses pinned official Chromium test clips and generates a 440 Hz WAV. Downloads, their license/provenance, and telemetry stay under ignored build/media-playback/; no YouTube content is downloaded. The server binds only host loopback and serves an explicit list of test resources.

Open these in the guest browser:

URL Test
http://10.0.2.2:8765/?auto=1 VP8/Vorbis HTML5
http://10.0.2.2:8765/?auto=1&clip=vp9 VP9/Opus HTML5
http://10.0.2.2:8765/?auto=mse VP8/Vorbis MSE
http://10.0.2.2:8765/?auto=mse&clip=vp9 VP9/Opus MSE

Run all four when validating a change. For audio without network delivery during playback, click Download WAV baseline, wait for a successful download, then click Play downloaded WAV. The URL tone remains a separate network-path check; a full buffered range alone does not prove all bytes remain cached. Use the sound, tone, and fullscreen buttons with a real click. Tone results have scope: progress-only and audibleOutput: unverified: a moving media clock does not prove audio reached the device. Listen or validate captured PCM separately. Stop the server with Ctrl+C when finished. See the fixture README for telemetry details and limitations.

Remaining work and acceptance criteria#

  1. Resolve intermittent page-loading stalls and memory-pressure failures. Retain the passing playback baseline while diagnosing each failure; neither the earlier hash-table loop nor hint-table pressure explains every stall.
  2. Complete YouTube pause/resume, seeking, fullscreen enter/exit, and quality change checks. Preserve player state, selected codecs, browser diagnostics, and captured PCM alongside the completed 19-second website playback run.
  3. Test more videos and longer playback. Investigate network buffering separately from the passing Blob WAV baseline; the earlier URL tone still had delivery stalls. Do not substitute downloaded/converted YouTube content for website tests.
  4. Repeat longer clips, browser navigation, and simultaneous activity while measuring frame pacing, dropped frames, and audio/video sync. The IPC, keyboard-locking, timer, and audio regressions do not replace runtime tests.
  5. Repeat on the Beelink at realistic resolutions and verify physical speaker output. Keep production tracing disabled during timing measurements.

Relevant host regressions (a host C compiler is required; pass --cc if needed):

python tools/test_abi_audio.py
python tools/test_abi_fionread.py
python tools/test_hda_stream_ring.py
python tools/test_bsp_audio.py
python tools/test_scheduler_deadlines.py
python tools/test_scm_send.py
python tools/test_socket_shutdown.py
python tools/test_wayland_fullscreen.py
python tools/test_wayland_keys.py

For the real-libasound regression, build tools/build_alsa_guest_probe.ps1 against the staged runtime, stage its ALSAPROBE.ELF beside the loader/libraries, and run /ALSAPROBE.ELF in the disposable guest. Its default run checks device discovery and opening, handle lifetime, and all 16 format configurations.

The native Video app remains a separate, silent MJPEG player with an 8 MiB file cap and 512x512 frame limit. Its VIDEO.MJP path is not the browser/YouTube playback path.

This page mirrors the file in the XerisOS repository. Changes go there. Edit on GitHub