perf(android): queue fragmented scrcpy video packets (#20230)

* perf(android): queue fragmented scrcpy video packets

* fix(android): release consumed scrcpy chunk storage

* fix(android): bound queued scrcpy fragment count

- Coalesce pending video fragments once more than MAX_PENDING_CHUNKS
  (1024) are queued, so a large frame delivered in tiny socket chunks
  cannot retain millions of Buffer objects below the 16 MiB byte guard.
- Add a regression test feeding a 256 KiB frame one byte at a time and
  asserting the retained fragment count stays bounded.

---------

Co-authored-by: m4air <m4air@Mac.localdomain>
Co-authored-by: Neil <neil@stably.ai>
This commit is contained in:
OrcaWin
2026-09-12 19:39:40 -07:00
committed by GitHub
co-authored by m4air Neil
parent fee47fdb09
commit 35a5259ccd
6 changed files with 440 additions and 41 deletions
+4
View File
@@ -7,6 +7,10 @@ export class RelayFrameBuffer {
return this.bytes
}
get chunkCount(): number {
return this.chunks.length - this.head
}
append(chunk: Buffer): void {
this.chunks.push(chunk)
this.bytes += chunk.length