[Spice-devel] [PATCH spice-server 01/28] red_worker: stream agent - fix miscounting of frames

Yonit Halperin yhalperi at redhat.com
Tue Feb 26 10:03:47 PST 2013


Frames counting was skipped when the previous frame was already
sent completely to the client.
---
 server/red_worker.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index 11fa126..a4a369a 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -3118,22 +3118,30 @@ static inline void pre_stream_item_swap(RedWorker *worker, Stream *stream)
         if (pipe_item_is_linked(&dpi->dpi_pipe_item)) {
             ++agent->drops;
         }
+    }
+
 
+    WORKER_FOREACH_DCC(worker, ring_item, dcc) {
+        double drop_factor;
+
+        agent = &dcc->stream_agents[index];
         if (agent->frames / agent->fps < FPS_TEST_INTERVAL) {
             agent->frames++;
-            return;
+            continue;
         }
 
-        double drop_factor = ((double)agent->frames - (double)agent->drops) /
-                             (double)agent->frames;
-
+        drop_factor = ((double)agent->frames - (double)agent->drops) /
+            (double)agent->frames;
+        spice_debug("stream %d: #frames %u #drops %u", index, agent->frames, agent->drops);
         if (drop_factor == 1) {
             if (agent->fps < MAX_FPS) {
                 agent->fps++;
+                spice_debug("stream %d: fps++ %u", index, agent->fps);
             }
         } else if (drop_factor < 0.9) {
             if (agent->fps > 1) {
                 agent->fps--;
+                spice_debug("stream %d: fps--%u", index, agent->fps);
             }
         }
         agent->frames = 1;
-- 
1.8.1



More information about the Spice-devel mailing list