~vcs-imports/theora/trunk

Viewing all changes in revision 1384.

  • Committer: tterribe
  • Date: 2015-10-11 04:35:13 UTC
  • Revision ID: svn-v4:0101bb08-14d6-0310-b084-bc0e0c8e3800:trunk/theora:19507
Fix some broken clamping in rate control.

If we have some dupe frames right near the end of the buffer, our
 metric window can be slightly larger than the buffer.
However, the clamping we use to determine how many frames' worth of
 metrics to add to the buffer had a mix of signed and unsigned
 types, so if that number when negative, instead of clamping
 against zero, it would ask for all remaining frames in the file.
That would cause an infinite loop when we tried to find the last
 keyframe in the circular buffer in oc_enc_select_qi() (which was
 not big enough to actually hold that many frames).

This patch changes the clamp to a form that works with all unsigned
 values.

Thanks to Brion Vibber for the report.

Fixes #2229

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: