au.adpcm.ADPCMReadFailiureTimeout
au.adpcm.ADPCMReadFailiureTimeout
#Overview
name: au.adpcm.ADPCMReadFailiureTimeout
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Sets the number of ADPCM decode attempts we\'ll try before stopping the sound wave altogether.\n
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:
- Keeping the default value unless there’s a specific reason to change it.
- If changing, consider the trade-off between audio playback reliability and responsiveness to persistent decoding issues.
- Monitor and log instances where this timeout is reached to identify potential issues with audio assets or decoding process.
Regarding the associated variable ADPCMReadFailiureTimeoutCVar:
- Its purpose is to provide a direct, efficient way to access the timeout value in the C++ code.
- It’s used within the FADPCMAudioInfo::StreamCompressedData function to determine if the number of consecutive read failures has exceeded the threshold.
- The value is set through the console variable system, so it’s dynamically updatable.
- It interacts directly with the console variable au.adpcm.ADPCMReadFailiureTimeout.
- Developers should be aware that modifying this variable directly in code would be overridden by the console variable system.
- Best practice is to always use the console variable system to modify this value, ensuring consistency across the engine.
#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)