CRI ADX  Last Updated: 2024-03-21 14:32 p
バッファリング量の取得

サンプルのディレクトリ

/cri/pc/samples/criatomex/buffering_size

サンプルで使用しているデータ

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

サンプルの解説

ボイスプールから下位レイヤのAtomプレーヤー(≒ボイス)を取得し、入力データ残量をチェックすることで、 ストリーミング再生中のデータがどれだけバッファリングされているのかを確認することが可能です。
通常、アプリケーション中でバッファリング量を意識する必要はありません。
しかしストリーミングに関する問題が発生した場合、調査のためにバッファリング量を確認したいかもしれません。
例えば、アプリケーション実行中に音途切れが発生する場合などが、そのような問題に相当します。
処理手順
  1. criAtomExVoicePool_GetPlayerHandle 関数を用いてボイスプールからAtomプレーヤーを取得する。
  2. criAtomPlayer_GetInputBufferRemainSize 関数でAtomプレーヤーの入力バッファ残量を取得する。

/* ボイスプールの作成 */
pool_config.num_voices = SMP_MAX_STREAMS;
pool_config.player_config.streaming_flag = CRI_TRUE;
app_obj->pool = criAtomExVoicePool_AllocateStandardVoicePool(&pool_config, NULL, 0);
/* ボイスプール内のAtomプレーヤー(≒ボイス)の情報を取得 */
for (i = 0; i < SMP_MAX_STREAMS; i++) {
/* Atomプレーヤーの取得 */
player = criAtomExVoicePool_GetPlayerHandle(app_obj->pool, i);
/* Atomプレーヤーのステータス/バッファリング量を取得 */
status = criAtomPlayer_GetStatus(player);
}
CriAtomPlayerHn criAtomExVoicePool_GetPlayerHandle(CriAtomExVoicePoolHn pool, CriSint32 index)
プレーヤーハンドルの取得
#define criAtomExVoicePool_SetDefaultConfigForStandardVoicePool(p_config)
標準ボイスプール作成用コンフィグ構造体にデフォルト値をセット
Definition: cri_atom_ex.h:567
CriAtomExVoicePoolHn criAtomExVoicePool_AllocateStandardVoicePool(const CriAtomExStandardVoicePoolConfig *config, void *work, CriSint32 work_size)
標準ボイスプールの作成
CriSint32 criAtomPlayer_GetInputBufferRemainSize(CriAtomPlayerHn player)
入力バッファー内データ残量の取得
CriAtomPlayerStatus criAtomPlayer_GetStatus(CriAtomPlayerHn player)
ステータスの取得
注意
Atomプレーヤーのステータスが CRIATOMPLAYER_STATUS_PLAYING にも関わらず、長時間に渡ってバッファリング量が0の状態が続く場合、 ファイルの読み込みが何らかの処理によりブロックされている可能性があります。