summaryrefslogtreecommitdiff
authorJonathon Jongsma <jjongsma@redhat.com>2014-05-30 18:45:02 (GMT)
committer Jonathon Jongsma <jjongsma@redhat.com>2014-05-30 18:45:02 (GMT)
commit284cca2a5ebc98257275585083321a7100fb89b3 (patch) (side-by-side diff)
tree96a6401ad2ccc277b9ed3af8796dba77c33f96dd
parente7db94d833e848b63fdd9956ba51ce2c5917cb25 (diff)
downloadspice-master.zip
spice-master.tar.gz
Fix assert in mjpeg_encoder_adjust_params_to_bit_rate()HEADmaster
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
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--server/mjpeg_encoder.c5
1 files changed, 4 insertions, 1 deletions
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) {