summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2018-02-20 16:47:38 +0000
committerFrediano Ziglio <fziglio@redhat.com>2018-05-22 16:34:24 +0100
commitabd89d88c8d46382338b905e20a3b82b0de619d5 (patch)
tree5363272ec1b02ef2cb586606f99772da00735b1c
parente45d7e8b3e5c7d640ea5d15f1dd9a1b49d7d44e3 (diff)
Detect and handle exceptions creating capture engine
Currently exceptions from a plugin are not handled when creating a capture engine. Catch the exception and try to use another plugin instead of bailing out. This was tested with an experimental GStreamer plugin. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
-rw-r--r--src/concrete-agent.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/concrete-agent.cpp b/src/concrete-agent.cpp
index 58ce9c4..ca666d7 100644
--- a/src/concrete-agent.cpp
+++ b/src/concrete-agent.cpp
@@ -129,7 +129,14 @@ FrameCapture *ConcreteAgent::GetBestFrameCapture(const std::set<SpiceVideoCodecT
// check client supports the codec
if (codecs.find(plugin.second->VideoCodecType()) == codecs.end())
continue;
- FrameCapture *capture = plugin.second->CreateCapture();
+
+ FrameCapture *capture;
+ try {
+ capture = plugin.second->CreateCapture();
+ } catch (const std::exception &err) {
+ syslog(LOG_ERR, "Error creating capture engine: %s", err.what());
+ continue;
+ }
if (capture) {
return capture;
}