[PATCH v6 5/5] video-stream: Don't stop a stream associated with gl_draw (v2)

Vivek Kasireddy vivek.kasireddy at intel.com
Mon Mar 4 10:45:47 UTC 2024


We do not want to stop a stream associated with gl_draw as a result
of timeout because we may not get another opportunity to create a
new stream if the current one gets stopped. However, when the
stream does get stopped for other reasons, we need to clear the
gl_draw_stream pointer associated with the relevant DC.

v2: (suggestions from Frediano)
- Don't stop the stream regardless of whether gl_draw is ongoing
  or not

Cc: Frediano Ziglio <freddy77 at gmail.com>
Cc: Gerd Hoffmann <kraxel at redhat.com>
Cc: Marc-André Lureau <marcandre.lureau at redhat.com>
Cc: Dongwon Kim <dongwon.kim at intel.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy at intel.com>
Acked-by: Frediano Ziglio <freddy77 at gmail.com>
---
 server/video-stream.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/server/video-stream.cpp b/server/video-stream.cpp
index 29143c24..a5cddb0e 100644
--- a/server/video-stream.cpp
+++ b/server/video-stream.cpp
@@ -117,6 +117,9 @@ void video_stream_stop(DisplayChannel *display, VideoStream *stream)
         dcc->pipe_add(video_stream_destroy_item_new(stream_agent));
         video_stream_agent_stats_print(stream_agent);
 
+        if (stream == display->priv->gl_draw_stream) {
+            display->priv->gl_draw_stream = nullptr;
+        }
         if (stream->drm_dma_buf_fd > 0) {
             close(stream->drm_dma_buf_fd);
             stream->drm_dma_buf_fd = -1;
@@ -1074,7 +1077,8 @@ void video_stream_timeout(DisplayChannel *display)
     while (item) {
         VideoStream *stream = SPICE_CONTAINEROF(item, VideoStream, link);
         item = ring_next(ring, item);
-        if (now >= (stream->last_time + RED_STREAM_TIMEOUT)) {
+        if (now >= (stream->last_time + RED_STREAM_TIMEOUT) &&
+            stream != display->priv->gl_draw_stream) {
             detach_video_stream_gracefully(display, stream, nullptr);
             video_stream_stop(display, stream);
         }
-- 
2.43.0



More information about the Spice-devel mailing list