[Spice-devel] [PATCH spice 1/11] server: Convert a couple of rate control checks into asserts in the mjpeg video encoder.

Marc-André Lureau marcandre.lureau at gmail.com
Tue May 19 06:05:11 PDT 2015


ack

On Wed, May 13, 2015 at 10:25 PM, Francois Gouget <fgouget at codeweavers.com>
wrote:

> 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.
> ---
>
> This patch makes sense independently from the rest of the series.
>
>  server/mjpeg_encoder.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/server/mjpeg_encoder.c b/server/mjpeg_encoder.c
> index 12447da..95d841f 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 &&
> --
> 2.1.4
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>



-- 
Marc-André Lureau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150519/b5df92b7/attachment.html>


More information about the Spice-devel mailing list