XAUDIO2: WARNING: Glitch at output sample 35412960 问题追踪

播放视频同时也播放音频,期间做着同步。之后偶然的时候,会有以下的输出:
“XAUDIO2: WARNING: Spent 251.13ms in OnProcessingPassStart callbacks
XAUDIO2: WARNING: Glitch at output sample 15522240

视频采用的是微软的media player api(CWMPPlayer4),音频采用的是 xaudio2。

google值到了https://msdn.microsoft.com/zh-cn/library/windows/desktop/ee415765

*If the audio thread runs for too long, XAudio2 shows a message in this form.
XAudio2: WARNING: Spent Xms in audio thread; XAudio2 possibly overloaded
Typically, this message occurs with the next message.

*If the audio driver can’t be fed new audio data on time, XAudio2 shows a message in this form.
XAudio2: WARNING: Glitch at output sample X

*Calling IXAudio2::GetPerformanceData provides XAudio2 performance data, including the total number of glitches since the XAudio2 engine started.
总的原因是音频线程运行时间太长,或者音频数据不能及时被提供。

解决办法:
Reduce the number of active voices and effects in the graph, especially expensive effects like reverb.
减少激活的声音数量和音效,尤其是让cpu费力的音效,如混响。
Disable voices and effects you’re not using.
在你不用时,禁用声音和音效。
Use the XAUDIO2_VOICE_NOSRC and XAUDIO2_VOICE_NOPITCH flags in IXAudio2::CreateSourceVoice, whenever possible. Sample rate conversion is costly.
尽可能的在CreateSourceVoice时使用 XAUDIO2_VOICE_NOSRC and XAUDIO2_VOICE_NOPITCH两个标记。采样率转换也很“昂贵”
Reduce the sample rate of individual voices. For example, a submix voice hosting a reverb effect can have a lower sample rate than the source voice sending to it. Sounds such as explosions and gunshots that don’t need high fidelity can also be recorded at lower sample rates.
降低个别声音的采样率。例如托管混响效果的子混音语音的采样率可能比发送给它的源语音的采样率低。不需要高保真度的声音,如爆炸和枪声也可以以较低的采样率。
Ensure that callback implementations do as little work as possible and never block.
确保回调实现尽可能少的工作,并且不会阻塞
Make fewer calls to XAudio2. Audio parameters usually don’t need to be updated for every video frame. Every 30 ms or so is sufficient. You should eliminate redundant calls, such as setting volume several times in quick succession.
尽量少调用XAudio2。音频参数通草不会在每一帧都需要更新。每30毫秒左右就足够了。您应该消除多余的调用,例如快速连续多次设置音量。
Reduce the game’s overall CPU usage.
减少游戏的整体CPU使用率。

采用方案:减少调用!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

思依_xuni

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值