Audio in Pak file fails to load

There appears to be a bug in 4.26.1 with loading any audio files from a pak file that are loaded during runtime.
This a repeatable issue from my tests.
To Produce: create a packaged game, in separate uproject that uses the same code, import some audio files, create some blueprint that plays them then cook and package the related assets into a pak file.
Once loaded in the runtime game the files will throw the errors

USoundWave::BeginGetCompressedData
LogAudio: Error: Attempt to access the DDC when there is none available on sound " sound file"  format = OGG00000000. Should have been cooked.

FVorbisAudioInfo::ReadCompressedInfo
LogAudio: Error: FVorbisAudioInfo::ReadCompressedInfo, ov_open_callbacks error code: -132

USoundWave::InitAudioResource
  FByteBulkData* Bulk = GetCompressedData(Format, GetPlatformCompressionOverridesForCurrentPlatform()); 
returns null 

importing paks like this worked fine in versions 4.22 ā†’ 4.25 so this seems to be a new bug.
Interestingly USoundWave::GetCompressedData will occur a second time slightly later where it will find valid FByteBulkData for the same file but it the audio will not play after the first failure

Hello,

Iā€™m currently looking through changes to the relevant code that happened between 4.25 and 4.26.1 to see if I can find any likely culprits for this altered behavior. I am noticing that there are a few recent CLs in GitHub that looked like they were created to solve similar issues to this: can you let me know if syncing to the changes on these two CLs fixes the problem?

Otherwise, can you try entering the following commands into the console, and letting me know what happens?

au.streamcache.BlockOnChunkLoadCompletion 1

au.streamcache.DispatchToGameThreadOnChunkRequest 0

This should disable the only major code changes to the relevant functionality that Iā€™ve seen introduced in 4.26, so knowing if this is the source of the problem significantly narrows down where to investigate.

Otherwise, the next thing to look at would be the stream caching settings.

Hi, Thanks for looking into this.
I merged in the changes you recommended, but there was no change on loading a pak file packaged before or after the new build.

I tried the following cvars in various settings before loading the pak file but unfortunately with no change

    au.streamcache.BlockOnChunkLoadCompletion 1
    au.streamcache.DispatchToGameThreadOnChunkRequest 0
    au.streamcaching.AlwaysLogCacheMisses 1
    au.streamcaching.ForceBlockForLoad 1
    au.streamcaching.UseObjectKeyInChunkKeyComparisons 1
    au.streamcache.BlockOnChunkLoadCompletion 1
    au.streamcache.DispatchToGameThreadOnChunkRequest 1
    au.streamcache.DisableRetaining  1
    au.vorbis.ReadFailiureTimeout  0

Hmm - Iā€™m guessing by ā€œtried the following cvars in various settingsā€ you mean youā€™ve tried each of them both on and off? In that case, could you try a few things for me:

  • Can you walk through the code, and let me know exactly where the code is failing in GetDerivedDataCache()? E.g., is bInitialized false? Is FPlatformProperties::RequiresCookedData() returning true? Is check(IsInGameThread()) passing as expected? Is Module->CreateOrGetDDC() returning Null, or garbage data?

  • Iā€™m noticing the error Ogg Vorbis is returning is the code for OV_ENOTVORBIS, e.g., it does not recognize your data as being Vorbis. Sometimes this can happen if thereā€™s a mismatch between how a file is encoded, and how its decoded. Can you tell me whatā€™s returning from the functions ā€œGetWaveFormat,ā€ and ā€œGetRuntimeFormatā€? (And in particular, do they match?) In addition, if you havenā€™t done so already, I recommend fully recooking all audio files after a jump in engine versions when codec problems are involved.

  • Just as a sanity check - what happens if you completely disable Stream Caching? Thatā€™ll let me know if Stream Caching is still a potential suspect

Walked through with the debugger and made a txt doc of my findings/notes for you questions.
For the sanity check, is this the ā€˜Stream Caching (experimental)ā€™ option in project settings? if so then ive never had that enabled, and game +editor crashs upon playing a sound with it enabled
link text

Well after all that it came down to a config issue, if these lines are not in the defaultEngine.ini of the project making the external pak files then the audio breaks on load.

MaxSampleRate=0.000000
HighSampleRate=0.000000
MedSampleRate=0.000000
LowSampleRate=0.000000
MinSampleRate=0.000000
CompressionQualityModifier=0.000000
AutoStreamingThreshold=0.000000
1 Like