]> git.sesse.net Git - nageru/blobdiff - mixer.cpp
Make the resampling audio queue length adjustable with a flag.
[nageru] / mixer.cpp
index a4ae1aab50c1a68baf623a03ce04b8990c158554..f7ef46e160d251e6ec89ee4dee611f86fac74262 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -870,7 +870,7 @@ void Mixer::render_one_frame(int64_t duration)
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 
-       const int64_t av_delay = TIMEBASE / 10;  // Corresponds to the fixed delay in resampling_queue.h. TODO: Make less hard-coded.
+       const int64_t av_delay = lrint(global_flags.audio_queue_length_ms * 0.001 * TIMEBASE);  // Corresponds to the delay in ResamplingQueue.
        RefCountedGLsync fence = video_encoder->end_frame(pts_int + av_delay, duration, theme_main_chain.input_frames);
 
        // The live frame just shows the RGBA texture we just rendered.