server: Simplify the MJPEG encoder's maximum framerate estimation

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@codeweavers.com>
This commit is contained in:
Francois Gouget 2015-12-03 18:50:25 +01:00 committed by Christophe Fergeau
parent 9b42aafe31
commit 4ce4c4a525

View File

@ -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;
}
static inline void mjpeg_encoder_reset_quality(MJpegEncoder *encoder,