Skip to content

fix(mirror): install gtksink on Arch; cancel stale video receivers - #5

Open
X-Ryl669 wants to merge 1 commit into
zoir-dev:mainfrom
X-Ryl669:fix/screen-mirror-gtksink-and-stale-receiver
Open

fix(mirror): install gtksink on Arch; cancel stale video receivers#5
X-Ryl669 wants to merge 1 commit into
zoir-dev:mainfrom
X-Ryl669:fix/screen-mirror-gtksink-and-stale-receiver

Conversation

@X-Ryl669

Copy link
Copy Markdown

Screen mirroring does not work on Arch Linux KDE Desktop, due to missing gtksink GStreamer package and a bug in TCP video receiver. This was found and authored by Claude see below:

Two independent faults, both of which made screen mirroring look like it had frozen while actually reporting the reason only to the log.

  1. gtksink was never installed on Arch. Every mirror/second-screen/ camera pipeline ends in it (see ui-tauri mirror.rs), but Arch splits the GTK sink OUT of gst-plugins-good into gst-plugin-gtk, which the dependency list never asked for. The pipeline then fails to parse at all ("gst parse: no element gtksink"), the window opens on its spinner, and no picture ever arrives — with nothing in the UI to say why. Added the package, plus a post-install check that inspects for gtksink and prints the install command for the detected distro when it is missing. Only the Arch name is a hard dependency; the Debian/Fedora names are printed as hints rather than installed, because an unresolvable name is all-or-nothing fatal on apt and pacman (see the NODE_PKGS note above for the same trap).

  2. The TCP video receiver outlived its session. It was spawned with its JoinHandle dropped, so nothing could cancel it, and it retries the connect for as long as the phone's video server stays closed — which is exactly while the MediaProjection consent dialog is up. A second Start (double click, or the address-retry pass) therefore left the first receiver still looping; both then connected the instant the phone opened its server, each holding a media key derived from its OWN session's IK handshake hash. The phone encrypts for the session it honoured — it debounces the duplicate START, see Android VortexStack.kt — so the other receiver failed to open frame 0 ("AEAD open failed counter=0"), closed the socket, and took the whole stream down with it. The receiver is now tracked in VIDEO_RX_TASK and aborted from stop_mirror and on each new spawn.

Fault 2's phone-side debounce already hinted at the duplicate sessions; this fixes the laptop side that creates them.

Two independent faults, both of which made screen mirroring look like it
had frozen while actually reporting the reason only to the log.

1. `gtksink` was never installed on Arch. Every mirror/second-screen/
   camera pipeline ends in it (see ui-tauri `mirror.rs`), but Arch splits
   the GTK sink OUT of gst-plugins-good into `gst-plugin-gtk`, which the
   dependency list never asked for. The pipeline then fails to parse at
   all ("gst parse: no element gtksink"), the window opens on its
   spinner, and no picture ever arrives — with nothing in the UI to say
   why. Added the package, plus a post-install check that inspects for
   `gtksink` and prints the install command for the detected distro when
   it is missing. Only the Arch name is a hard dependency; the
   Debian/Fedora names are printed as hints rather than installed,
   because an unresolvable name is all-or-nothing fatal on apt and
   pacman (see the NODE_PKGS note above for the same trap).

2. The TCP video receiver outlived its session. It was spawned with its
   `JoinHandle` dropped, so nothing could cancel it, and it retries the
   connect for as long as the phone's video server stays closed — which
   is exactly while the MediaProjection consent dialog is up. A second
   Start (double click, or the address-retry pass) therefore left the
   first receiver still looping; both then connected the instant the
   phone opened its server, each holding a media key derived from its OWN
   session's IK handshake hash. The phone encrypts for the session it
   honoured — it debounces the duplicate START, see Android
   `VortexStack.kt` — so the other receiver failed to open frame 0
   ("AEAD open failed counter=0"), closed the socket, and took the whole
   stream down with it. The receiver is now tracked in `VIDEO_RX_TASK`
   and aborted from `stop_mirror` and on each new spawn.

Fault 2's phone-side debounce already hinted at the duplicate sessions;
this fixes the laptop side that creates them.
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.

2 participants