fixed a bug where active_worst_quality could be set
below active_best_quality which could result in an
infinite loop.
Change-Id: I93c229c3bc5bff2a82b4c33f41f8acf4dd194039
buff_lvl_step = (cpi->oxcf.maximum_buffer_size - cpi->oxcf.optimal_buffer_level) / Adjustment;
if (buff_lvl_step)
- {
Adjustment = (cpi->buffer_level - cpi->oxcf.optimal_buffer_level) / buff_lvl_step;
- cpi->active_worst_quality -= Adjustment;
- }
- }
- else
- {
- cpi->active_worst_quality -= Adjustment;
+ else
+ Adjustment = 0;
}
+
+ cpi->active_worst_quality -= Adjustment;
+
+ if(cpi->active_worst_quality < cpi->active_best_quality)
+ cpi->active_worst_quality = cpi->active_best_quality;
}
}