Commit 279e03c5 authored by Mickaël Turnel's avatar Mickaël Turnel

Fix best video configuration algorithm not picking the best one in some cases

parent b7e4901f
......@@ -1021,12 +1021,15 @@ MSVideoConfiguration ms_video_find_best_configuration_for_size_and_bitrate(const
int pixels=vconf_it->vsize.width*vconf_it->vsize.height;
int score=abs(pixels-ref_pixels);
if (cpu_count>=vconf_it->mincpu){
if (score<min_score){
if (score<min_score) {
best_vconf=*vconf_it;
min_score=score;
if (bitrate <= vconf_it->bitrate_limit && bitrate >= vconf_it->required_bitrate) last_good_vconf=&best_vconf;
}else if (score==min_score) {
if (bitrate <= vconf_it->bitrate_limit && bitrate >= vconf_it->required_bitrate)
last_good_vconf=&best_vconf;
else
last_good_vconf = NULL;
} else if (score==min_score) {
if (bitrate <= vconf_it->bitrate_limit && bitrate >= vconf_it->required_bitrate) {
if (last_good_vconf == NULL || last_good_vconf->fps < vconf_it->fps) {
best_vconf=*vconf_it;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment