[Spice-devel] [spice v2] server: Simplify the MJPEG encoder's maximum framerate estimation

Christophe Fergeau cfergeau at redhat.com
Tue Dec 8 07:21:42 PST 2015


On Thu, Dec 03, 2015 at 06:50:25PM +0100, Francois Gouget wrote:
> Note that if frame_size == bytes_per_sec == 0 this now returns
> MJPEG_MAX_FPS but this should not happen anyway.
> 
> Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
> ---
>  server/mjpeg_encoder.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/server/mjpeg_encoder.c b/server/mjpeg_encoder.c
> index 9b331c1..0529232 100644
> --- a/server/mjpeg_encoder.c
> +++ b/server/mjpeg_encoder.c
> @@ -341,15 +341,7 @@ static inline uint32_t mjpeg_encoder_get_latency(MJpegEncoder *encoder)
>  
>  static uint32_t get_max_fps(uint64_t frame_size, uint64_t bytes_per_sec)
>  {
> -    double fps;
> -    double send_time_ms;
> -
> -    if (!bytes_per_sec) {
> -        return 0;
> -    }
> -    send_time_ms = frame_size * 1000.0 / bytes_per_sec;
> -    fps = send_time_ms ? 1000 / send_time_ms : MJPEG_MAX_FPS;
> -    return fps;
> +    return frame_size ? bytes_per_sec / frame_size : MJPEG_MAX_FPS;
>  }

Acked-by: Christophe Fergeau <cfergeau at redhat.com>

I'm pushing this now.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20151208/4bc3a9cb/attachment-0001.sig>


More information about the Spice-devel mailing list