]> git.sesse.net Git - nageru/blobdiff - mixer.cpp
Fix an issue where we'd count jitter history from the wrong side.
[nageru] / mixer.cpp
index f502eb0e4590c86092588841bd04298e1f4f4600..4deba02ac52e97554257bbb109684451a3de6ea9 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -239,7 +239,7 @@ double JitterHistory::estimate_max_jitter() const
        if (percentile <= 0.5) {
                return *next(orders.begin(), elem_idx) * multiplier;
        } else {
-               return *prev(orders.end(), elem_idx + 1) * multiplier;
+               return *prev(orders.end(), orders.size() - elem_idx) * multiplier;
        }
 }
 
@@ -1390,7 +1390,7 @@ void Mixer::render_one_frame(int64_t duration)
        live_frame.ready_fence = fence;
        live_frame.input_frames = {};
        live_frame.temp_textures = { y_display_tex, cbcr_display_tex };
-       output_channel[OUTPUT_LIVE].output_frame(live_frame);
+       output_channel[OUTPUT_LIVE].output_frame(move(live_frame));
 
        // Set up preview and any additional channels.
        for (int i = 1; i < theme->get_num_channels() + 2; ++i) {
@@ -1401,7 +1401,7 @@ void Mixer::render_one_frame(int64_t duration)
                display_frame.ready_fence = fence;
                display_frame.input_frames = move(chain.input_frames);
                display_frame.temp_textures = {};
-               output_channel[i].output_frame(display_frame);
+               output_channel[i].output_frame(move(display_frame));
        }
 }
 
@@ -1521,7 +1521,7 @@ Mixer::OutputChannel::~OutputChannel()
        }
 }
 
-void Mixer::OutputChannel::output_frame(DisplayFrame frame)
+void Mixer::OutputChannel::output_frame(DisplayFrame &&frame)
 {
        // Store this frame for display. Remove the ready frame if any
        // (it was seemingly never used).