Skip to content

orbiscreen | feat: stream USB video over AOA Annex-B - #82

Open
sentinelt wants to merge 9 commits into
shadow-x78:mainfrom
sentinelt:feat/usb-aoa-annexb
Open

sentinelt wants to merge 9 commits into
shadow-x78:mainfrom
sentinelt:feat/usb-aoa-annexb

Conversation

@sentinelt

Copy link
Copy Markdown
Contributor

Summary

USB video no longer depends on adb reverse. The host sends length-prefixed H.264 access units on the Android Open Accessory bulk pipe, and the tablet decodes them with MediaCodec. HTTP session and input still ride the accessory TCP proxy. MPEG-TS/ExoPlayer stays the Wi-Fi path through the LAN TLS proxy.

The second commit keeps that proxy from being mistaken for USB. LAN login also uses 127.0.0.1, so Annex-B over USB runs only when the port is the accessory proxy.

Test plan

  • Both Tab S5e devices (R52M70X9DNM, R52N40APCBZ) stream over USB with kind=Aoa, toolbar vaapi · USB, and a live picture. adb reverse --list is empty. Health reports usb_devices: 2.
  • Web client at https://127.0.0.1:8790/client/ opens a session, draws a 2560×1600 canvas, and shows VAAPI delay 3ms.
  • Both tablets over Wi-Fi (192.168.39.191) pair and play with ExoPlayer, not the USB player.
  • UsbLoopbackTest and AOA frame unit tests pass.

Drop adb reverse. Accessory bulk carries length-prefixed H.264 access units
into MediaCodec, and every tablet's HTTP tunnel uses the daemon port.
LAN login terminates on 127.0.0.1 just like the AOA proxy. Annex-B over USB
runs only when that port is the accessory proxy, so Wi-Fi keeps ExoPlayer.
stopAccessory closes accepted sockets while their reader may still be
starting. getInputStream then threw outside the read try, and Android
killed the process. The read loop now treats a closed socket as end of
stream.
The stream watchdog treated one failed GET /health on the accessory proxy
as a dead host and closed the session about two minutes in. USB video does
not use that HTTP call, so an active AOA player now ignores those misses.
Other transports wait for three failures. The idle reaper also leaves a
display up while a video subscriber is still attached.
Show delay, frame age, bitrate, and I/P/D on web and Android. The toolbar
frame-age field stays a fixed width. Debug builds skip the update prompt.
Label USB Annex-B, USB HTTP /au, UDP Annex-B, MPEG-TS, WebTransport, and
HTTPS /au in the overlay and toolbar. A Wi-Fi session on the local TLS
proxy is no longer titled USB.
Mint a short-lived AES-256-GCM key over the pinned host proxy and seal every ORB1 datagram. Cleartext shared-token hellos no longer join. Android Wi-Fi sends video to the LAN host on UDP 8789 while session and input stay on the TLS proxy.
A Cauchy block with 253 or more data shards divided by zero and panicked the debug UDP sender. Cap each code at 252 data shards and split a larger access unit into several blocks. Android and the web client reassemble those blocks.
The 10-minute deadline was measured from mint time, so a playing tablet lost pongs and disconnected. Each accepted packet now moves that deadline forward. An unused key still expires, and a key that is already expired stays rejected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant