diff options
author | Francois Gouget <fgouget@codeweavers.com> | 2015-06-10 17:33:01 +0200 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2015-06-22 19:47:58 +0200 |
commit | f017d7a42163c50af240c444b5de26f5fae9ea9f (patch) | |
tree | 7ad7e62b196980810aa3f112533ea34588975cef /server/mjpeg_encoder.c | |
parent | 03af3f382d9200757ad1a8bedce0ff57d0762606 (diff) | |
download | spice-f017d7a42163c50af240c444b5de26f5fae9ea9f.tar.gz spice-f017d7a42163c50af240c444b5de26f5fae9ea9f.tar.xz spice-f017d7a42163c50af240c444b5de26f5fae9ea9f.zip |
mjpeg: Convert rate control checks to asserts in encoder
The checks would lead the reader to think these functions can be called
when bit rate control is off when in fact they are only called when it
is active.
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Diffstat (limited to 'server/mjpeg_encoder.c')
-rw-r--r-- | server/mjpeg_encoder.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/server/mjpeg_encoder.c b/server/mjpeg_encoder.c index 12447dac..95d841f9 100644 --- a/server/mjpeg_encoder.c +++ b/server/mjpeg_encoder.c @@ -607,9 +607,7 @@ static void mjpeg_encoder_adjust_params_to_bit_rate(MJpegEncoder *encoder) uint32_t latency = 0; uint32_t src_fps; - if (!encoder->rate_control_is_active) { - return; - } + spice_assert(encoder->rate_control_is_active); rate_control = &encoder->rate_control; quality_eval = &rate_control->quality_eval_data; @@ -694,9 +692,8 @@ static void mjpeg_encoder_adjust_fps(MJpegEncoder *encoder, uint64_t now) MJpegEncoderRateControl *rate_control = &encoder->rate_control; uint64_t adjusted_fps_time_passed; - if (!encoder->rate_control_is_active) { - return; - } + spice_assert(encoder->rate_control_is_active); + adjusted_fps_time_passed = (now - rate_control->adjusted_fps_start_time) / 1000 / 1000; if (!rate_control->during_quality_eval && |