FS-11922: [core] improve switch_calc_bitrate

This commit is contained in:
Mike Jerris 2019-07-08 19:09:50 -04:00 committed by Andrey Volk
parent b29fa06d20
commit 382ecb6612
1 changed files with 16 additions and 8 deletions

View File

@ -1056,18 +1056,26 @@ SWITCH_DECLARE(char *) switch_util_quote_shell_arg_pool(const char *string, swit
#define SWITCH_READ_ACCEPTABLE(status) (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK || status == SWITCH_STATUS_INUSE)
static inline int32_t switch_calc_bitrate(int w, int h, int quality, double fps)
static inline int32_t switch_calc_bitrate(int w, int h, float quality, double fps)
{
int r;
if (quality == 0) {
quality = 1;
}
/* KUSH GAUGE*/
if (!fps) fps = 15;
r = (int32_t)((double)(w * h * fps * (quality ? quality : 1)) * 0.07) / 1000;
r = (int32_t)((double)(w * h * fps * quality) * 0.07) / 1000;
if (!quality) r /= 2;
if (quality < 0.0f) {
r = (int) ((float)r * quality);
}
return r;
}