From: Christophe de Dinechin <dinechin@xxxxxxxxxx> Signed-off-by: Christophe de Dinechin <dinechin@xxxxxxxxxx> --- src/spice-streaming-agent.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp index 26fa910..4e3a21c 100644 --- a/src/spice-streaming-agent.cpp +++ b/src/spice-streaming-agent.cpp @@ -75,6 +75,7 @@ public: } const codecs_t &client_codecs() { return codecs; } + bool streaming_requested() { return is_streaming; } int have_something_to_read(int timeout); void handle_stream_start_stop(uint32_t len); @@ -99,9 +100,10 @@ public: size_t write_all(const char *what, const void *buf, const size_t len); private: - int streamfd = -1; std::mutex mutex; codecs_t codecs; + int streamfd = -1; + bool is_streaming = false; }; @@ -319,7 +321,6 @@ void X11CursorThread::cursor_changes() }} // namespace spice::streaming_agent -static bool streaming_requested = false; static bool quit_requested = false; int Stream::have_something_to_read(int timeout) @@ -351,9 +352,9 @@ void Stream::handle_stream_start_stop(uint32_t len) throw std::runtime_error("read command from device FAILED -- read " + std::to_string(n) + " expected " + std::to_string(len)); } - streaming_requested = (msg[0] != 0); /* num_codecs */ + is_streaming = (msg[0] != 0); /* num_codecs */ syslog(LOG_INFO, "GOT START_STOP message -- request to %s streaming\n", - streaming_requested ? "START" : "STOP"); + is_streaming ? "START" : "STOP"); codecs.clear(); for (int i = 1; i <= msg[0]; ++i) { codecs.insert((SpiceVideoCodecType) msg[i]); @@ -491,7 +492,7 @@ void ConcreteAgent::CaptureLoop(Stream &stream, FrameLog &frame_log) { unsigned int frame_count = 0; while (!quit_requested) { - while (!quit_requested && !streaming_requested) { + while (!quit_requested && !stream.streaming_requested()) { if (stream.read_command(true) < 0) { syslog(LOG_ERR, "FAILED to read command\n"); return; @@ -509,7 +510,7 @@ void ConcreteAgent::CaptureLoop(Stream &stream, FrameLog &frame_log) if (!capture) throw std::runtime_error("cannot find a suitable capture system"); - while (!quit_requested && streaming_requested) { + while (!quit_requested && stream.streaming_requested()) { if (++frame_count % 100 == 0) { syslog(LOG_DEBUG, "SENT %d frames\n", frame_count); } -- 2.13.5 (Apple Git-94) _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel