With this patch, spice-streaming-agent exits the frame-sending loop when START/STOP requests are received. This allows the recomputation of the most suitable capture/encoding plugin, that may have been updated with START/STOP message. --- src/spice-streaming-agent.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp index 49f5dc4..3626ecc 100644 --- a/src/spice-streaming-agent.cpp +++ b/src/spice-streaming-agent.cpp @@ -126,6 +126,7 @@ private: }; static bool streaming_requested = false; +static bool reset_requested = false; static bool quit_requested = false; static std::set<SpiceVideoCodecType> client_codecs; @@ -169,6 +170,7 @@ static void read_command_from_device(StreamPort &stream_port) StartStopMessage msg = in_message.get_payload<StartStopMessage>(); streaming_requested = msg.start_streaming; client_codecs = msg.client_codecs; + reset_requested = true; syslog(LOG_INFO, "GOT START_STOP message -- request to %s streaming", streaming_requested ? "START" : "STOP"); @@ -240,13 +242,16 @@ do_capture(StreamPort &stream_port, FrameLog &frame_log, ConcreteAgent &agent) if (quit_requested) { return; } + reset_requested = false; syslog(LOG_INFO, "streaming starts now"); uint64_t time_last = 0; std::unique_ptr<FrameCapture> capture(agent.GetBestFrameCapture(client_codecs)); if (!capture) { - throw std::runtime_error("cannot find a suitable capture system"); + syslog(LOG_ERR, "Error cannot find a suitable capture system"); + streaming_requested = false; + continue; } std::vector<DeviceDisplayInfo> display_info; @@ -275,7 +280,7 @@ do_capture(StreamPort &stream_port, FrameLog &frame_log, ConcreteAgent &agent) syslog(LOG_ERR, "Empty device display info from the plugin"); } - while (!quit_requested && streaming_requested) { + while (!quit_requested && streaming_requested && !reset_requested) { if (++frame_count % 100 == 0) { syslog(LOG_DEBUG, "SENT %d frames", frame_count); } -- 2.21.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel