au.streamcaching.BlockForPendingLoadOnCacheOverflow
au.streamcaching.BlockForPendingLoadOnCacheOverflow
#Overview
name: au.streamcaching.BlockForPendingLoadOnCacheOverflow
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
This cvar sets the default request priority for audio chunks that are about to play back, but aren\'t in the cache.\n0: When we blow the cache we clear any soundwave retainers. 1:When we blow the cache we attempt to cancel a load in flight.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.streamcaching.BlockForPendingLoadOnCacheOverflow is to control the behavior of the audio streaming cache when it overflows. It is part of the audio streaming system in Unreal Engine 5.
This setting variable is used by the Engine’s audio streaming module, specifically within the AudioStreamingCache subsystem. It’s primarily referenced in the AudioStreamingCache.cpp file, which handles the caching of audio chunks for streaming playback.
The value of this variable is set through a console variable (CVar) system. It’s initialized to 0 by default but can be changed at runtime through console commands or configuration files.
The associated variable BlockForPendingLoadOnCacheOverflowCVar directly interacts with it. They share the same value, with the CVar system bridging between the console-accessible variable and the C++ variable.
Developers should be aware that this variable affects how the audio streaming cache handles overflow situations. When set to 0 (default), it clears any sound wave retainers when the cache overflows. When set to 1, it attempts to cancel a load in flight when the cache overflows.
Best practices for using this variable include:
- Carefully consider the implications of changing its value, as it can affect audio streaming performance.
- Monitor audio performance when adjusting this value, especially in scenarios with many concurrent audio streams.
- Use in conjunction with other audio streaming settings for optimal performance.
Regarding the associated variable BlockForPendingLoadOnCacheOverflowCVar:
This is an integer variable that directly corresponds to the console variable. It’s used within the C++ code to check the current setting and adjust behavior accordingly. For example, in the InsertChunk function, it’s used to determine whether to attempt cancelling an in-flight load for an unreferenced chunk when the cache overflows.
The best practice when working with this variable is to use it for reading the current setting within C++ code, rather than modifying it directly. Any changes should be made through the console variable system to ensure consistency across the engine.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:72
Scope: file
Source code excerpt:
static int32 BlockForPendingLoadOnCacheOverflowCVar = 0;
FAutoConsoleVariableRef CVarBlockForPendingLoadOnCacheOverflow(
TEXT("au.streamcaching.BlockForPendingLoadOnCacheOverflow"),
BlockForPendingLoadOnCacheOverflowCVar,
TEXT("This cvar sets the default request priority for audio chunks that are about to play back, but aren't in the cache.\n")
TEXT("0: When we blow the cache we clear any soundwave retainers. 1:When we blow the cache we attempt to cancel a load in flight."),
ECVF_Default);
static int32 NumSoundWavesToClearOnCacheOverflowCVar = 0;
#Associated Variable and Callsites
This variable is associated with another variable named BlockForPendingLoadOnCacheOverflowCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:70
Scope: file
Source code excerpt:
ECVF_Default);
static int32 BlockForPendingLoadOnCacheOverflowCVar = 0;
FAutoConsoleVariableRef CVarBlockForPendingLoadOnCacheOverflow(
TEXT("au.streamcaching.BlockForPendingLoadOnCacheOverflow"),
BlockForPendingLoadOnCacheOverflowCVar,
TEXT("This cvar sets the default request priority for audio chunks that are about to play back, but aren't in the cache.\n")
TEXT("0: When we blow the cache we clear any soundwave retainers. 1:When we blow the cache we attempt to cancel a load in flight."),
ECVF_Default);
static int32 NumSoundWavesToClearOnCacheOverflowCVar = 0;
FAutoConsoleVariableRef CVarNumSoundWavesToClearOnCacheOverflow(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:1554
Scope (from outer to inner):
file
function FAudioChunkCache::FCacheElement* FAudioChunkCache::InsertChunk
Source code excerpt:
// If we blew the cache, it might be because we have too many loads in flight. Here we attempt to find a load in flight for an unreferenced chunk:
if (BlockForPendingLoadOnCacheOverflowCVar && !CacheElement)
{
UE_LOG(LogAudioStreamCaching, Warning, TEXT("Failed to find an available chunk slot in the audio streaming manager. Finding a load in flight for an unreferenced chunk and cancelling it."));
CacheElement = EvictLeastRecentChunk(true);
}
if (!CacheElement)