diff options
author | Yonit Halperin <yhalperi@redhat.com> | 2013-01-24 13:24:20 -0500 |
---|---|---|
committer | Yonit Halperin <yhalperi@redhat.com> | 2013-04-22 11:45:58 -0400 |
commit | 317471fc0b54472876cd054afb531d96796cb54e (patch) | |
tree | 73ed107bba99d7f180ba7328e5657bcece10a95c | |
parent | 38999db39bd9d03bd37be6fc4acb268c295027d6 (diff) | |
download | spice-317471fc0b54472876cd054afb531d96796cb54e.tar.gz spice-317471fc0b54472876cd054afb531d96796cb54e.tar.xz spice-317471fc0b54472876cd054afb531d96796cb54e.zip |
red_worker: stream agent - fix miscounting of frames
Frames counting was skipped when the previous frame was already
sent completely to the client.
-rw-r--r-- | server/red_worker.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/server/red_worker.c b/server/red_worker.c index 4842ad61..e6128e97 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; |