Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(clients): paint the Android device stream instead of looping on reset-video #14664

ClosedJorrinKievit(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/14664/headopened View on GitHub

Showing 2 changed files with 142 additions and 13 deletions.

x
0 of 2 viewed, 2 left
91 additions and 0 deletionspackages/client-runtime/src/device/stream.test.tsModified
View file
@@ -474,6 +474,97 @@
​
+describe("Android keyframe handshake", () => {
+ afterEach(() => {
+ vi.useRealTimers();
+ vi.unstubAllGlobals();
+ });
+​
+ const videoSession = (width: number, height: number) =>
+ JSON.stringify({ type: "video-session", size: { width, height } });
+ const delta = new Uint8Array([0, 0, 0, 1, 0x41, 0x9a, 0x02]).buffer;
+​
+ it("decodes the SPS keyframe instead of asking serve-emu for another one", async () => {
+ const { client, sockets, decoders, events, decodedFrame, sps } = recoveryFixture(
+ "android",
+ false,
+ );
+ client.start();
+ const socket = sockets[0]!;
+ socket.onopen?.();
+ socket.onmessage?.({ data: videoSession(576, 1280) });
+ socket.onmessage?.({ data: sps });
+ await vi.advanceTimersByTimeAsync(0);
+​
+ expect(decoders).toHaveLength(1);
+ expect(decoders[0]!.state).toBe("configured");
+ // `reset-video` here restarts the encoder, which is what looped forever.
+ expect(socket.send).not.toHaveBeenCalled();