au.adpcm.ADPCMReadFailiureTimeout

au.adpcm.ADPCMReadFailiureTimeout

#Overview

name: au.adpcm.ADPCMReadFailiureTimeout

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of au.adpcm.ADPCMReadFailiureTimeout is to control the number of ADPCM (Adaptive Differential Pulse-Code Modulation) decode attempts before stopping the sound wave playback. This setting is part of the audio decoding system in Unreal Engine 5.

This setting variable is primarily used in the AdpcmAudioDecoder module, which is responsible for decoding ADPCM-encoded audio data. Based on the callsites, it’s clear that this variable is crucial for handling potential failures in the audio decoding process.

The value of this variable is set using the Unreal Engine’s Console Variable (CVar) system. It’s initialized with a default value of 64 and can be modified at runtime through console commands or configuration files.

The associated variable ADPCMReadFailiureTimeoutCVar directly interacts with au.adpcm.ADPCMReadFailiureTimeout. They share the same value, with ADPCMReadFailiureTimeoutCVar being the actual integer variable used in the code, while au.adpcm.ADPCMReadFailiureTimeout is the console variable name.

Developers must be aware that this variable affects the robustness of ADPCM audio playback. If set too low, it might cause audio to stop prematurely in case of temporary decoding issues. If set too high, it might lead to prolonged periods of silence or stuttering before the engine decides to stop playback.

Best practices when using this variable include:

  1. Keeping the default value unless there’s a specific reason to change it.
  2. If changing, consider the trade-off between audio playback reliability and responsiveness to persistent decoding issues.
  3. Monitor and log instances where this timeout is reached to identify potential issues with audio assets or decoding process.

Regarding the associated variable ADPCMReadFailiureTimeoutCVar:

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/AdpcmAudioDecoder/Module/Private/ADPCMAudioInfo.cpp:13

Scope: file

Source code excerpt:

static int32 ADPCMReadFailiureTimeoutCVar = 64;
FAutoConsoleVariableRef CVarADPCMReadFailiureTimeout(
	TEXT("au.adpcm.ADPCMReadFailiureTimeout"),
	ADPCMReadFailiureTimeoutCVar,
	TEXT("Sets the number of ADPCM decode attempts we'll try before stopping the sound wave altogether.\n"),
	ECVF_Default);

static int32 ADPCMDisableSeekForwardOnChunkMissesCVar = 1;
FAutoConsoleVariableRef CVarADPCMDisableSeekForwardOnChunkMisses(

#Associated Variable and Callsites

This variable is associated with another variable named ADPCMReadFailiureTimeoutCVar. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/AdpcmAudioDecoder/Module/Private/ADPCMAudioInfo.cpp:11

Scope: file

Source code excerpt:

	ECVF_Default);

static int32 ADPCMReadFailiureTimeoutCVar = 64;
FAutoConsoleVariableRef CVarADPCMReadFailiureTimeout(
	TEXT("au.adpcm.ADPCMReadFailiureTimeout"),
	ADPCMReadFailiureTimeoutCVar,
	TEXT("Sets the number of ADPCM decode attempts we'll try before stopping the sound wave altogether.\n"),
	ECVF_Default);

static int32 ADPCMDisableSeekForwardOnChunkMissesCVar = 1;
FAutoConsoleVariableRef CVarADPCMDisableSeekForwardOnChunkMisses(
	TEXT("au.adpcm.DisableSeekForwardOnReadMisses"),

#Loc: <Workspace>/Engine/Source/Runtime/AdpcmAudioDecoder/Module/Private/ADPCMAudioInfo.cpp:921

Scope (from outer to inner):

file
function     bool FADPCMAudioInfo::StreamCompressedData

Source code excerpt:

					FMemory::Memset(OutData, 0, BufferSize);
					NumConsecutiveReadFailiures++;
					const bool bReadAttemptTimedOut = NumConsecutiveReadFailiures > ADPCMReadFailiureTimeoutCVar;
					UE_CLOG(bReadAttemptTimedOut, LogAudio, Warning, TEXT("ADPCM Audio Decode timed out."), bReadAttemptTimedOut);
					return NumConsecutiveReadFailiures > ADPCMReadFailiureTimeoutCVar;
				}

				NumConsecutiveReadFailiures = 0;

				// Set the current buffer offset accounting for the header in the first chunk
				if (!bSeekPendingRead)