screenshot: Blocklist the current screencast pipeline if recorder failed

When gstreamer crashes during recording, it pulls the whole screencastService
down with it.

These crashes are typically caused by the gstreamer pipeline that's in use,
so to avoid running into them again and again, we can blocklist the last
used pipeline in case the recorder didn't shut down (aka crashed) last time.

To store this state, create a file (gnome-shell-screencast-pipeline-blocklist)
in the XDG runtime dir and store the ID of the current pipeline in that file
before we try to start.

Now when we crash while running the pipeline, the entry in that file will stay
around and we'll pick it up on the next start of the screencastService as a
blocklist.

When the recording was successful on the other hand, we'll call
`this._updateServiceCrashBlocklist([...this._blocklistFromPreviousCrashes])`
and remove the new entry from the file again before shutting down the recorder.

In addition to that, we can now encourage the user to try recording again
after a crash happened. Adjust the failure notification a bit to say
"please try again".

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6747

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2976>
This commit is contained in:
Jonas Dreßler
2023-10-19 16:09:00 +02:00
parent ce613f5d15
commit b6bfe07137
2 changed files with 63 additions and 8 deletions

View File

@ -2044,11 +2044,17 @@ export const ScreenshotUI = GObject.registerClass({
if (error.matches(ScreencastErrors, ScreencastError.OUT_OF_DISK_SPACE)) {
// Translators: notification title.
this._showNotification(_('Screencast ended: Out of disk space'));
return;
} else if (error.matches(ScreencastErrors, ScreencastError.SERVICE_CRASH)) {
// We can encourage user to try again on service crashes since the
// recorder will auto-blocklist the pipeline that crashed.
// Translators: notification title.
this._showNotification(_('Screencast ended unexpectedly, please try again'));
} else {
// Translators: notification title.
this._showNotification(_('Screencast ended unexpectedly'));
}
// Translators: notification title.
this._showNotification(_('Screencast ended unexpectedly'));
break;
}
}