Skip to content

Commit 07bfd53

Browse files
committed
Simplify Android input handling
1 parent f8ec2fa commit 07bfd53

5 files changed

Lines changed: 172 additions & 367 deletions

File tree

docs/api/rest.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -213,24 +213,15 @@ Android, the server reads raw frames from the emulator gRPC `streamScreenshot`
213213
API, encodes them through VideoToolbox, and writes the resulting H.264 samples
214214
to the same WebRTC video track.
215215

216+
Loopback Android clients may pass `"transport": "rgba"` in the offer payload.
217+
That keeps the same WebRTC endpoint and control channels, but sends raw RGBA
218+
frames over the `simdeck-rgba` data channel instead of creating a media track.
219+
Non-loopback Android clients use encoded H.264.
220+
216221
The browser also opens `simdeck-control` and `simdeck-telemetry` data channels.
217222
In addition to input messages, clients can request a keyframe or tune the
218223
stream attached to that peer:
219224

220-
### `GET /api/simulators/{udid}/android/frames`
221-
222-
Android-only WebSocket stream backed by the emulator gRPC `streamScreenshot`
223-
API. This is retained as a raw-frame diagnostic/fallback path; the browser live
224-
view uses the WebRTC H.264 endpoint by default. The server sends binary raw RGBA
225-
frames with a small SimDeck header, already flipped into top-down row order for
226-
canvas rendering.
227-
Query parameters:
228-
229-
| Query parameter | Default | Notes |
230-
| --------------- | ------- | ------------------------------------------ |
231-
| `maxEdge` | `960` | Longest output edge requested from gRPC. |
232-
| `maxFps` | `30` | Max frames per second forwarded to client. |
233-
234225
```json
235226
{ "type": "streamControl", "forceKeyframe": true }
236227
```

docs/guide/architecture.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ Owns the public CLI shape (`simdeck`, `simdeck ui`, `daemon`, `boot`, `shutdown`
2020

2121
Key modules:
2222

23-
| Module | Responsibility |
24-
| ----------------------------------- | ----------------------------------------------------------------------------------------------------------- |
25-
| `server/src/main.rs` | CLI entrypoint, project daemon management, AppKit main-thread shim, tokio runtime bootstrap. |
26-
| `server/src/api/routes.rs` | Every `/api/*` route, including simulator control, accessibility, and inspector proxy. |
27-
| `server/src/android.rs` | Android AVD discovery, emulator lifecycle, emulator gRPC input/video, screenshots, UIAutomator, and logcat. |
28-
| `server/src/transport/webrtc.rs` | WebRTC offer/answer endpoint for H.264 browser video. |
29-
| `server/src/transport/packet.rs` | Shared encoded frame type used between simulator sessions and transports. |
30-
| `server/src/inspector.rs` | WebSocket hub for the NativeScript runtime inspector. |
31-
| `server/src/simulators/registry.rs` | Per-UDID session registry with lazy attachment to the native bridge. |
32-
| `server/src/simulators/session.rs` | Frame broadcast channel, keyframe gating, refresh requests. |
33-
| `server/src/metrics/counters.rs` | Atomic counters and per-client stream stats accepted from stream transports or `/api/client-stream-stats`. |
34-
| `server/src/logs.rs` | `os_log` log streaming and filtering. |
23+
| Module | Responsibility |
24+
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
25+
| `server/src/main.rs` | CLI entrypoint, project daemon management, AppKit main-thread shim, tokio runtime bootstrap. |
26+
| `server/src/api/routes.rs` | Every `/api/*` route, including simulator control, accessibility, and inspector proxy. |
27+
| `server/src/android.rs` | Android AVD discovery, emulator lifecycle, ADB input, emulator gRPC video, screenshots, UIAutomator, and logcat. |
28+
| `server/src/transport/webrtc.rs` | WebRTC offer/answer endpoint for H.264 browser video. |
29+
| `server/src/transport/packet.rs` | Shared encoded frame type used between simulator sessions and transports. |
30+
| `server/src/inspector.rs` | WebSocket hub for the NativeScript runtime inspector. |
31+
| `server/src/simulators/registry.rs` | Per-UDID session registry with lazy attachment to the native bridge. |
32+
| `server/src/simulators/session.rs` | Frame broadcast channel, keyframe gating, refresh requests. |
33+
| `server/src/metrics/counters.rs` | Atomic counters and per-client stream stats accepted from stream transports or `/api/client-stream-stats`. |
34+
| `server/src/logs.rs` | `os_log` log streaming and filtering. |
3535

3636
The Rust server runs the tokio runtime on a worker thread while the AppKit main loop spins on the main thread. The native bridge needs the main loop to deliver display callbacks and HID events.
3737

0 commit comments

Comments
 (0)