]> git.sesse.net Git - nageru/commitdiff
Fix an integer wraparound issue.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 2 Apr 2016 18:17:30 +0000 (20:17 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 2 Apr 2016 19:36:24 +0000 (21:36 +0200)
mixer.cpp

index 2802329b136c60c69b9f760ce812150bb7fa49a7..84335aa7f39be226750a013e58d0bf7736a27554 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -123,7 +123,7 @@ void QueueLengthPolicy::update_policy(int queue_length)
                return;
        }
        if (queue_length > 0) {
-               if (++frames_with_at_least_one >= 50) {
+               if (++frames_with_at_least_one >= 50 && safe_queue_length > 0) {
                        --safe_queue_length;
                        fprintf(stderr, "Card %u: Spare frames for more than 50 frames, reducing safe limit to %u frames\n",
                                card_index, safe_queue_length);