> On 1 Mar 2018, at 18:19, Jonathon Jongsma <jjong...@redhat.com> wrote:
> 
> On Wed, 2018-02-28 at 16:43 +0100, Christophe de Dinechin wrote:
>> From: Christophe de Dinechin <dinec...@redhat.com>
>> 
>> Until we have a proper separation of input messages, it makes sense
>> to
>> have the Stream class deal with this flag.
>> 
>> Signed-off-by: Christophe de Dinechin <dinec...@redhat.com>
>> ---
>> 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 403e65c..8494a8b 100644
>> --- a/src/spice-streaming-agent.cpp
>> +++ b/src/spice-streaming-agent.cpp
>> @@ -84,6 +84,7 @@ public:
>>     }
>> 
>>     const codecs_t &client_codecs() { return codecs; }
>> +    bool streaming_requested() { return is_streaming; }
> 
> const?

yes

> 
>> 
>>     int read_command(bool blocking);
>>     size_t write_all(const void *buf, const size_t len);
>> @@ -101,14 +102,14 @@ private:
>>     void read_command_from_device(void);
>> 
>> private:
>> -    int streamfd = -1;
>>     std::mutex mutex;
>>     codecs_t codecs;
>> +    int streamfd = -1;
> 
> unrelated change

Moved to original patch.
> 
>> +    bool is_streaming = false;
>> };
>> 
>> }} // namespace spice::streaming_agent
>> 
>> -static bool streaming_requested = false;
>> static bool quit_requested = false;
>> static bool log_binary = false;
>> 
>> @@ -141,9 +142,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]);
>> @@ -423,7 +424,7 @@ do_capture(Stream &stream, const char
>> *streamport, FILE *f_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;
>> @@ -442,7 +443,7 @@ do_capture(Stream &stream, const char
>> *streamport, FILE *f_log)
>>             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);
>>             }
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to