diff options
author | Jonas Dreßler <verdre@v0yd.nl> | 2022-01-29 00:40:24 +0100 |
---|---|---|
committer | Jonas Dreßler <verdre@v0yd.nl> | 2023-04-25 18:57:47 +0200 |
commit | 42af7e53a2aaa995840bb8cd9baf233feaac7c1f (patch) | |
tree | f378b2661b9b8414d4a52f36731c16cbfd5eaf2e | |
parent | cbfbdc4be51ffdfaf722b10d3320fa394a054a5e (diff) | |
download | gnome-shell-42af7e53a2aaa995840bb8cd9baf233feaac7c1f.tar.gz |
screencastService: Handle more gstreamer errors
Gstreamer can produce various errors, we shouldn't pretend those don't
exist and go on as usual when one happens. Instead, when an error
happens, tear down the pipeline, set our PipelineState to the new ERROR
state and bail out with a proper error message.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2197>
-rw-r--r-- | js/dbusServices/screencast/screencastService.js | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/js/dbusServices/screencast/screencastService.js b/js/dbusServices/screencast/screencastService.js index 7267673a5..497b7d206 100644 --- a/js/dbusServices/screencast/screencastService.js +++ b/js/dbusServices/screencast/screencastService.js @@ -231,12 +231,26 @@ var Recorder = class { _onBusMessage(bus, message, _) { switch (message.type) { case Gst.MessageType.EOS: - this._teardownPipeline(); - switch (this._pipelineState) { + case PipelineState.STOPPED: + case PipelineState.ERROR: + // In these cases there should be no pipeline, so should never happen + break; + + case PipelineState.PLAYING: + this._addRecentItem(); + this._handleFatalPipelineError('Unexpected EOS message'); + break; + + case PipelineState.INIT: + this._handleFatalPipelineError( + 'Unexpected EOS message while in state INIT'); + break; + case PipelineState.FLUSHING: this._addRecentItem(); + this._teardownPipeline(); this._unwatchSender(); this._stopSession(); @@ -248,6 +262,28 @@ var Recorder = class { } break; + + case Gst.MessageType.ERROR: + switch (this._pipelineState) { + case PipelineState.STOPPED: + case PipelineState.ERROR: + // In these cases there should be no pipeline, so should never happen + break; + + case PipelineState.INIT: + case PipelineState.PLAYING: + case PipelineState.FLUSHING: + // Everything else we can't handle, so error out + this._handleFatalPipelineError( + `GStreamer error while in state ${this._pipelineState}: ${message.parse_error()[0].message}`); + break; + + default: + break; + } + + break; + default: break; } |