]> git.sesse.net Git - nageru/blobdiff - mixer.cpp
Fix compilation error.
[nageru] / mixer.cpp
index 4560bbb4976fc74b497c24e16ceee465f52c33db..89cfd5f06f1930298696d547b1d168b8276b001f 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -207,8 +207,6 @@ void QueueLengthPolicy::register_metrics(const vector<pair<string, string>> &lab
 
 void QueueLengthPolicy::update_policy(unsigned queue_length)
 {
-       metric_input_queue_length_frames = queue_length;
-
        if (queue_length == 0) {  // Starvation.
                if (been_at_safe_point_since_last_starvation && safe_queue_length < unsigned(global_flags.max_input_queue_frames)) {
                        ++safe_queue_length;
@@ -219,6 +217,7 @@ void QueueLengthPolicy::update_policy(unsigned queue_length)
                been_at_safe_point_since_last_starvation = false;
                ++metric_input_duped_frames;
                metric_input_queue_safe_length_frames = safe_queue_length;
+               metric_input_queue_length_frames = 0;
                return;
        }
        if (queue_length >= safe_queue_length) {
@@ -231,6 +230,7 @@ void QueueLengthPolicy::update_policy(unsigned queue_length)
                        card_index, safe_queue_length);
                frames_with_at_least_one = 0;
        }
+       metric_input_queue_length_frames = min(queue_length, safe_queue_length);  // The caller will drop frames for us if needed.
 }
 
 Mixer::Mixer(const QSurfaceFormat &format, unsigned num_cards)