Audio source-pool census + fix the unbuilt jam-log literal

Field report (playtest night + operator): audio cutting in and out
toward the end of the match -- the classic shape of source-pool
pressure (sources release only at entity teardown; long matches
accumulate looping occupants like wreck burn/smoke until transients
lose the voice fight; OpenAL mixing capacity is finite).  L4AUDRND now
tracks live/deleted/failed sources: a 30s '[audio] source census' line
plus an ALWAYS-logged line on every acquisition failure (the smoking
gun).  Soak test next to confirm the leak/occupation slope.

Also: the ffa3933 jam-entry log had a raw newline in a string literal
(committed unbuilt -- process violation, caught by this build).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-23 10:59:39 -05:00
co-authored by Claude Opus 4.8
parent cc6639d952
commit cbebb0f1c1
2 changed files with 34 additions and 2 deletions
+33
View File
@@ -1307,6 +1307,25 @@ Logical
//Do we have enough?
int requested = source_request->count;
// SOURCE-POOL CENSUS (field 2026-07-23: "audio cutting in and out toward
// the end of the match"). OpenAL's mixing capacity is finite; sources
// release only at entity teardown, so long matches accumulate looping
// occupants (wreck burn/smoke) until transients lose the voice fight.
// Track generated/deleted/failed and print a 30s health line + EVERY
// acquisition failure (rare + the smoking gun).
extern long gBTAudioSourcesLive, gBTAudioAcquireFails;
{
static unsigned long s_censusAt = 0;
unsigned long now_ms = GetTickCount();
if (now_ms - s_censusAt > 30000)
{
s_censusAt = now_ms;
DEBUG_STREAM << "[audio] source census: live=" << gBTAudioSourcesLive
<< " acquireFails=" << gBTAudioAcquireFails
<< std::endl << std::flush;
}
}
// Gitea #12: hard cap at the SourceSet capacity so alGenSources can never
// write past sources[] (the death-crash heap overflow). count is set from
// the streamed voiceCount and is normally already clamped in the
@@ -1323,6 +1342,8 @@ Logical
if (!alIsSource(source_request->sources[i]))
{
alGenSources(1, source_request->sources + i);
if (alIsSource(source_request->sources[i]))
++gBTAudioSourcesLive;
}
}
@@ -1334,6 +1355,12 @@ Logical
if (failed)
{
++gBTAudioAcquireFails;
DEBUG_STREAM << "[audio] ACQUIRE FAILED (requested=" << requested
<< " live=" << gBTAudioSourcesLive
<< " fails=" << gBTAudioAcquireFails
<< ") -- the pool is exhausted; expect dropouts"
<< std::endl << std::flush;
return False;
}
@@ -1413,10 +1440,16 @@ Logical
return True;*/
}
long gBTAudioSourcesLive = 0;
long gBTAudioAcquireFails = 0;
void L4AudioRenderer::ReleaseSourceSet(SourceSet &sourceSet)
{
extern long gBTAudioSourcesLive;
for (int i = 0; i < sourceSet.count; i++)
{
if (alIsSource(sourceSet.sources[i]))
--gBTAudioSourcesLive;
ALenum state;
alGetSourcei(sourceSet.sources[i], AL_SOURCE_STATE, &state);