Commit da39e505 authored by John Koleszar's avatar John Koleszar Committed by Code Review
Browse files

Merge "Fixed rate histogram calculation"

parents e68894fa fd41cb84
...@@ -1339,6 +1339,11 @@ static void init_rate_histogram(struct rate_hist *hist, ...@@ -1339,6 +1339,11 @@ static void init_rate_histogram(struct rate_hist *hist,
* adjustment (5/4) to account for alt-refs * adjustment (5/4) to account for alt-refs
*/ */
hist->samples = cfg->rc_buf_sz * 5 / 4 * fps->num / fps->den / 1000; hist->samples = cfg->rc_buf_sz * 5 / 4 * fps->num / fps->den / 1000;
// prevent division by zero
if (hist->samples == 0)
hist->samples=1;
hist->pts = calloc(hist->samples, sizeof(*hist->pts)); hist->pts = calloc(hist->samples, sizeof(*hist->pts));
hist->sz = calloc(hist->samples, sizeof(*hist->sz)); hist->sz = calloc(hist->samples, sizeof(*hist->sz));
for(i=0; i<RATE_BINS; i++) for(i=0; i<RATE_BINS; i++)
......
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