dbusServices/screencast: Handle pipeline failures gracefully

If parsing the pipeline fails for some reason, we currently end up
with a zombie session that leads to a stuck recording indicator in
gnome-shell.

Instead, properly tear down the session to allow mutter and gnome-shell
to correctly update their state.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1878>
This commit is contained in:
Florian Müllner 2021-06-09 16:42:52 +02:00 committed by Marge Bot
parent bed0f43967
commit dc0491ade8

View File

@ -136,7 +136,8 @@ var Recorder = class {
} }
_startPipeline(nodeId) { _startPipeline(nodeId) {
this._ensurePipeline(nodeId); if (!this._ensurePipeline(nodeId))
return;
const bus = this._pipeline.get_bus(); const bus = this._pipeline.get_bus();
bus.add_watch(bus, this._onBusMessage.bind(this)); bus.add_watch(bus, this._onBusMessage.bind(this));
@ -234,9 +235,15 @@ var Recorder = class {
filesink location="${this._filePath}"`; filesink location="${this._filePath}"`;
fullPipeline = this._substituteThreadCount(fullPipeline); fullPipeline = this._substituteThreadCount(fullPipeline);
try {
this._pipeline = Gst.parse_launch_full(fullPipeline, this._pipeline = Gst.parse_launch_full(fullPipeline,
null, null,
Gst.ParseFlags.FATAL_ERRORS); Gst.ParseFlags.FATAL_ERRORS);
} catch (e) {
log(`Failed to create pipeline: ${e}`);
this._notifyStopped();
}
return !!this._pipeline;
} }
}; };