[Spice-devel] [PATCH spice-streaming-agent v2] Detect and handle exception creating capture engine
Jonathon Jongsma
jjongsma at redhat.com
Tue May 22 15:17:59 UTC 2018
On Mon, 2018-05-21 at 11:41 +0100, Frediano Ziglio wrote:
> Currently exception from a plugin are not handled when creating
exception -> exceptions
> a capture engine.
> Capture the exception and try to use another plugin instead of
Capture -> Catch
> bailing out.
> This was tested with an experimental GStreamer plugin.
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> src/concrete-agent.cpp | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/src/concrete-agent.cpp b/src/concrete-agent.cpp
> index 58ce9c4..3d5282e 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 getting capture engine: %s",
> err.what());
Maybe "Error creating..." instead of "Error getting..."?
It's a little bit unfortunate that we can't easily indicate here which
plugin failed. Something like:
syslog(LOG_ERR, "Error creating capture engine for %s: %s",
plugin.second->name(), err.what())
> + continue;
> + }
> if (capture) {
> return capture;
> }
Ack with commit log changes.
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
More information about the Spice-devel
mailing list