UI: Add low latency audio buffering mode to UI

This feature is meant to reduce maximum audio buffering and turn off
dynamic buffering mode. This allows the lowest possible consistent
latency for audio buffering, which is useful for the decklink and NDI
outputs which cannot rely on audio timestamps for synchronization.

This can have a negative effect of making audio segments (partial or in
full) cut out. So audio glitching or audio loss can occur if this is
enabled.
This commit is contained in:
jp9000
2022-07-18 14:25:06 -07:00
committed by Jim
parent 9025d92f7a
commit 0a218e06b7
5 changed files with 115 additions and 15 deletions

View File

@@ -4409,7 +4409,7 @@ bool OBSBasic::ResetAudio()
{
ProfileScope("OBSBasic::ResetAudio");
struct obs_audio_info ai;
struct obs_audio_info2 ai = {};
ai.samples_per_sec =
config_get_uint(basicConfig, "Audio", "SampleRate");
@@ -4431,7 +4431,14 @@ bool OBSBasic::ResetAudio()
else
ai.speakers = SPEAKERS_STEREO;
return obs_reset_audio(&ai);
bool lowLatencyAudioBuffering = config_get_bool(
GetGlobalConfig(), "Audio", "LowLatencyAudioBuffering");
if (lowLatencyAudioBuffering) {
ai.max_buffering_ms = 20;
ai.fixed_buffering = true;
}
return obs_reset_audio2(&ai);
}
extern char *get_new_source_name(const char *name, const char *format);