Skip to content

Finalize recording cleanly when screencast session is closed externally - #391

Open
timemrah wants to merge 1 commit into
SeaDve:mainfrom
timemrah:fix/panel-stop-not-negotiated
Open

timemrah wants to merge 1 commit into
SeaDve:mainfrom
timemrah:fix/panel-stop-not-negotiated

Conversation

@timemrah

Copy link
Copy Markdown

Fixes #309

What

When recording is stopped via the GNOME Shell top bar screen-recording indicator (or any other control outside Kooha's own window) instead of Kooha's stop button, the portal session is closed directly, bypassing Kooha's normal stop flow. The video source's pipewiresrc then dies with a not-negotiated stream error before Kooha ever finds out, and the recording is reported as failed even though most of the footage was actually captured.

Fix

  • Subscribe to the session's Closed D-Bus signal so Kooha notices when the session is torn down externally while still recording.
  • Inject eos directly into the encoder queues (kooha-videoenc-queue / kooha-audioenc-queue), bypassing the now-dead source whose task is stuck after the stream error and can't forward an ordinary eos on its own, so the encoder/muxer/filesink downstream still finalize the file correctly.
  • Treat the bus error that follows from the dead source as expected instead of a recording failure.

Testing

Built and tested this on Debian 13 (based on the 2.3.0 tag, since that's what's packaged there). Stopping from the top bar indicator no longer shows an error, and the recorded file plays back fine. I wasn't able to build current main locally (Debian 13's libglib2.0/libadwaita are older than what main currently requires), so I'm relying on CI here to confirm it still builds/passes on the current toolchain — happy to fix up anything that comes up.

…ernally

When the recording is stopped from the GNOME Shell top bar indicator
(or any other control outside Kooha's own window), the portal session
is torn down directly, bypassing Kooha's own stop flow. The video
source's pipewiresrc then dies with a not-negotiated stream error
before Kooha ever finds out, and the recording is reported as failed
even though most of the footage was captured fine.

Subscribe to the session's Closed D-Bus signal so Kooha notices this
happening while still recording. Inject eos directly into the encoder
queues (bypassing the now-dead source, whose task is stuck after the
stream error and can no longer forward an ordinary eos on its own) so
the encoder/muxer/filesink downstream of it still finalize the file
normally, and treat the bus error that follows from the dead source as
expected rather than a recording failure.

Tested on Debian 13 (v2.3.0): stopping from the top bar indicator no
longer shows an error and the recorded file plays back correctly.

Fixes SeaDve#309
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.

Error if I stop recording with button on the panel

1 participant