diff options
author | Chris Robinson <[email protected]> | 2019-03-26 17:03:31 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-03-26 17:03:31 -0700 |
commit | 095a0b9bebf8395a00faa85d7acc5e43ef03640d (patch) | |
tree | 4224c755326d8663e7232f2458cb70a42c910ebb /Alc/backends/pulseaudio.cpp | |
parent | 608e4e916e19cc1902cde006a743e50e6fec478d (diff) |
Set the EARLY_REQUESTS flag for PulseAudio when possible
Diffstat (limited to 'Alc/backends/pulseaudio.cpp')
-rw-r--r-- | Alc/backends/pulseaudio.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Alc/backends/pulseaudio.cpp b/Alc/backends/pulseaudio.cpp index adae1a0f..f6e528fd 100644 --- a/Alc/backends/pulseaudio.cpp +++ b/Alc/backends/pulseaudio.cpp @@ -299,19 +299,23 @@ ALCboolean pulse_load() /* *grumble* Don't use enums for bitflags. */ inline pa_stream_flags_t operator|(pa_stream_flags_t lhs, pa_stream_flags_t rhs) { return pa_stream_flags_t(int(lhs) | int(rhs)); } - -inline pa_stream_flags_t operator|=(pa_stream_flags_t &lhs, pa_stream_flags_t rhs) +inline pa_stream_flags_t& operator|=(pa_stream_flags_t &lhs, pa_stream_flags_t rhs) { lhs = pa_stream_flags_t(int(lhs) | int(rhs)); return lhs; } - -inline pa_context_flags_t operator|=(pa_context_flags_t &lhs, pa_context_flags_t rhs) +inline pa_context_flags_t& operator|=(pa_context_flags_t &lhs, pa_context_flags_t rhs) { lhs = pa_context_flags_t(int(lhs) | int(rhs)); return lhs; } +inline pa_stream_flags_t& operator&=(pa_stream_flags_t &lhs, int rhs) +{ + lhs = pa_stream_flags_t(int(lhs) & rhs); + return lhs; +} + class palock_guard { pa_threaded_mainloop *mLoop; @@ -1031,11 +1035,18 @@ ALCboolean PulsePlayback::reset() wait_for_operation(op, mLoop); pa_stream_flags_t flags{PA_STREAM_START_CORKED | PA_STREAM_INTERPOLATE_TIMING | - PA_STREAM_AUTO_TIMING_UPDATE}; + PA_STREAM_AUTO_TIMING_UPDATE | PA_STREAM_EARLY_REQUESTS}; if(!GetConfigValueBool(nullptr, "pulse", "allow-moves", 0)) flags |= PA_STREAM_DONT_MOVE; if(GetConfigValueBool(mDevice->DeviceName.c_str(), "pulse", "adjust-latency", 0)) + { + /* ADJUST_LATENCY can't be specified with EARLY_REQUESTS, for some + * reason. So if the user wants to adjust the overall device latency, + * we can't ask to get write signals as soon as minreq is reached. + */ + flags &= ~PA_STREAM_EARLY_REQUESTS; flags |= PA_STREAM_ADJUST_LATENCY; + } if(GetConfigValueBool(mDevice->DeviceName.c_str(), "pulse", "fix-rate", 0) || !(mDevice->Flags&DEVICE_FREQUENCY_REQUEST)) flags |= PA_STREAM_FIX_RATE; |