[Spice-commits] server/mjpeg_encoder.c

Jonathon Jongsma jjongsma at kemper.freedesktop.org
Fri May 30 11:50:45 PDT 2014


 server/mjpeg_encoder.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 284cca2a5ebc98257275585083321a7100fb89b3
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Fri May 30 13:45:02 2014 -0500

    Fix assert in mjpeg_encoder_adjust_params_to_bit_rate()
    
    If mjpeg_encoder_reset_quality() is called with the same quality as currently
    set, it will not reset last_enc_size but not reset num_recent_enc_frames,
    violating some assumptions in _adjust_params_to_bit_rate(). To avoid aborting
    the server, simply return early from this function.
    
    Resolves: rhbz#1086820

diff --git a/server/mjpeg_encoder.c b/server/mjpeg_encoder.c
index f465d88..12447da 100644
--- a/server/mjpeg_encoder.c
+++ b/server/mjpeg_encoder.c
@@ -625,7 +625,10 @@ static void mjpeg_encoder_adjust_params_to_bit_rate(MJpegEncoder *encoder)
         return;
     }
 
-    spice_assert(rate_control->num_recent_enc_frames);
+    if (!rate_control->num_recent_enc_frames) {
+        spice_debug("No recent encoded frames");
+        return;
+    }
 
     if (rate_control->num_recent_enc_frames < MJPEG_AVERAGE_SIZE_WINDOW &&
         rate_control->num_recent_enc_frames < rate_control->fps) {


More information about the Spice-commits mailing list