flakes/overlays/misc/wine-lowlatency.patch

47 lines
1.8 KiB
Diff
Raw Normal View History

diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c
index 55579ecda80..6f7ff732135 100644
--- a/dlls/winepulse.drv/pulse.c
+++ b/dlls/winepulse.drv/pulse.c
@@ -93,9 +93,6 @@ static REFERENCE_TIME pulse_min_period[2], pulse_def_period[2];
static UINT g_phys_speakers_mask = 0;
-static const REFERENCE_TIME MinimumPeriod = 30000;
-static const REFERENCE_TIME DefaultPeriod = 100000;
-
static pthread_mutex_t pulse_mutex;
static pthread_cond_t pulse_cond = PTHREAD_COND_INITIALIZER;
@@ -481,11 +478,12 @@ static void pulse_probe_settings(int render, WAVEFORMATEXTENSIBLE *fmt) {
if (length)
pulse_def_period[!render] = pulse_min_period[!render] = pa_bytes_to_usec(10 * length, &ss);
- if (pulse_min_period[!render] < MinimumPeriod)
- pulse_min_period[!render] = MinimumPeriod;
-
- if (pulse_def_period[!render] < DefaultPeriod)
- pulse_def_period[!render] = DefaultPeriod;
+ const char* penv = getenv("STAGING_AUDIO_PERIOD");
+ if (penv) {
+ int val = atoi(penv);
+ pulse_def_period[!render] = pulse_min_period[!render] = val;
+ printf("Staging audio period set to %d.\n", val);
+ }
wfx->wFormatTag = WAVE_FORMAT_EXTENSIBLE;
wfx->cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
@@ -836,6 +834,13 @@ static NTSTATUS pulse_create_stream(void *args)
if (duration < 3 * period)
duration = 3 * period;
+ const char* denv = getenv("STAGING_AUDIO_DURATION");
+ if (denv) {
+ int val = atoi(denv);
+ duration = val;
+ printf("Staging audio duration set to %d.\n", val);
+ }
+
stream->period_bytes = pa_frame_size(&stream->ss) * muldiv(period, stream->ss.rate, 10000000);
stream->bufsize_frames = ceil((duration / 10000000.) * params->fmt->nSamplesPerSec);