Adding ability to customize the precache buffer size in engine ini files.

- Adding some new LLM categories to help track decoded precache buffer mem usage and fully decoded buffers.

More info:

Precache buffer sizes, on platforms that utilize the feature, can be a huge memory hog. By reducing their sizes, we can recover quite a bit of memory.
Tricky part of the change is accounting for the variable precache buffer size while still retaining the MONO_PCM_BUFFER_SIZE size for regular real-time decoding cases.
We do a "skip first buffer(s)" step when starting a real-time decoded sound so the smaller precache buffer size needs to be shared to the decoders.


#rb Ethan.Geller, Rob.Gay
#jira


#ROBOMERGE-SOURCE: CL 4696296

[CL 4696323 by aaron mcleran in Main branch]
This commit is contained in:
aaron mcleran
2019-01-09 17:41:16 -05:00
parent c953f4d8da
commit c30c37b8a3
30 changed files with 162 additions and 101 deletions
@@ -115,14 +115,7 @@ void FCoreAudioSoundBuffer::InitAudioStreamBasicDescription( UInt32 FormatID, US
}
}
/**
* Decompresses a chunk of compressed audio to the destination memory
*
* @param Destination Memory to decompress to
* @param bLooping Whether to loop the sound seamlessly, or pad with zeroes
* @return Whether the sound looped or not
*/
bool FCoreAudioSoundBuffer::ReadCompressedData( uint8* Destination, bool bLooping )
bool FCoreAudioSoundBuffer::ReadCompressedData(uint8* Destination, int32 NumFramesToDecode, bool bLooping)
{
const uint32 kPCMBufferSize = MONO_PCM_BUFFER_SIZE * NumChannels;
if (SoundFormat == SoundFormat_Streaming)
@@ -165,11 +165,11 @@ bool FCoreAudioSoundSource::ReadMorePCMData( const int32 BufferIndex, EDataReadM
if (DataReadMode == EDataReadMode::Synchronous)
{
++NumActiveBuffers;
return CoreAudioBuffer->ReadCompressedData( CoreAudioBuffers[BufferIndex].AudioData, WaveInstance->LoopingMode != LOOP_Never );
return CoreAudioBuffer->ReadCompressedData( CoreAudioBuffers[BufferIndex].AudioData, MONO_PCM_BUFFER_SAMPLES, WaveInstance->LoopingMode != LOOP_Never );
}
else
{
RealtimeAsyncTask = new FAsyncRealtimeAudioTask(CoreAudioBuffer, (uint8*)CoreAudioBuffers[BufferIndex].AudioData, WaveInstance->LoopingMode != LOOP_Never, DataReadMode == EDataReadMode::AsynchronousSkipFirstFrame);
RealtimeAsyncTask = new FAsyncRealtimeAudioTask(CoreAudioBuffer, (uint8*)CoreAudioBuffers[BufferIndex].AudioData, WaveInstance->WaveData->NumPrecacheFrames, WaveInstance->LoopingMode != LOOP_Never, DataReadMode == EDataReadMode::AsynchronousSkipFirstFrame);
RealtimeAsyncTask->StartBackgroundTask();
return false;
}
@@ -82,7 +82,7 @@ public:
* @param bLooping Whether to loop the sound seamlessly, or pad with zeroes
* @return Whether the sound looped or not
*/
bool ReadCompressedData( uint8* Destination, bool bLooping );
virtual bool ReadCompressedData( uint8* Destination, int32 NumFramesToDecode, bool bLooping ) override;
/**
* Sets the point in time within the buffer to the specified time