CRI ADX  Last Updated: 2025-05-07 13:34 p
Acquiring the Amount of Buffering

Sample directory

/cri/pc/samples/criatomex/buffering_size

Data used in the sample

/cri/common/smpdata/criatomex/
  • SampleAdxPack.awb

Sample description

By getting the lower layer Atom player (≒voice) from the voice pool and checking the remaining input data, it is possible to check how much data is being buffered during streaming playback.
Normally, there is no need to be aware of the amount of buffering in an application.
However, if you have a problem with streaming, you may want to check the amount of buffering to investigate.
For example, if the sound is interrupted while the application is running, this corresponds to such a problem.
Processing Procedure
  1. Use the criAtomExVoicePool_GetPlayerHandle function to get the Atom player from the voice pool.
  2. Use the criAtomPlayer_GetInputBufferRemainSize function to get the remaining input buffer size of the Atom player.

:
/* Create Voice Pool */
pool_config.num_voices = SMP_MAX_STREAMS;
pool_config.player_config.streaming_flag = CRI_TRUE;
app_obj->pool = criAtomExVoicePool_AllocateStandardVoicePool(&pool_config, NULL, 0);
:
:
/* Get information about the Atom player (nearly equals to Voice) in the Voice Pool */
for (i = 0; i < SMP_MAX_STREAMS; i++) {
/* Get the Atom player */
player = criAtomExVoicePool_GetPlayerHandle(app_obj->pool, i);
/* Get status/amount of buffering in the Atom player */
status = criAtomPlayer_GetStatus(player);
:
}
:
CriAtomPlayerHn criAtomExVoicePool_GetPlayerHandle(CriAtomExVoicePoolHn pool, CriSint32 index)
Getting the Player Handle.
#define criAtomExVoicePool_SetDefaultConfigForStandardVoicePool(p_config)
Assign the default values to the configuration structure used to create a standard Voice Pool.
Definition: cri_le_atom_ex.h:564
CriAtomExVoicePoolHn criAtomExVoicePool_AllocateStandardVoicePool(const CriAtomExStandardVoicePoolConfig *config, void *work, CriSint32 work_size)
Create a standard Voice Pool.
CriSint32 criAtomPlayer_GetInputBufferRemainSize(CriAtomPlayerHn player)
Get amount of data remaining in input buffer.
CriAtomPlayerStatus criAtomPlayer_GetStatus(CriAtomPlayerHn player)
Get status.
CriSint32 num_voices
Definition: cri_le_atom_ex.h:3257
CriAtomStandardPlayerConfig player_config
Definition: cri_le_atom_ex.h:3258
CriBool streaming_flag
Whether to perform streaming playback.
Definition: cri_le_atom.h:1484
Attention
If the buffering amount remains at 0 for a long period of time even though the Atom Player status is CRIATOMPLAYER_STATUS_PLAYING , file loading may be blocked by some process.