AudioQueueFreeBuffer 警告

发布于 2024-10-15 03:49:28 字数 759 浏览 3 评论 0原文

我收到 API AudioQueueFreeBuffer 的警告“AudioQueueObject::FreeBuffer: AQBuffer * 0x6273fd0 的排队计数为 1”...如何避免此警告?

我在 AudioQueueFreeBuffer API 中收到此警告

        for (int i = 0; i < kNumberBuffers; ++i) {

            if(mAudioInfo.mBuffers[i] != NULL)
            {
                AudioQueueFreeBuffer(mAudioInfo.mQueue, mAudioInfo.mBuffers[i]);
                mAudioInfo.mBuffers[i] = NULL;
            }   
            XThrowIfError(AudioQueueAllocateBuffer(mAudioInfo.mQueue, mBufferByteSize, &mAudioInfo.mBuffers[i]), "AudioQueueAllocateBuffer failed");

            AQTestBufferCallback (&mAudioInfo, mAudioInfo.mQueue, mAudioInfo.mBuffers[i]);

            if (mAudioInfo.mDone) break;
        }

I am getting warning "AudioQueueObject::FreeBuffer: AQBuffer * 0x6273fd0 has enqueue count of 1" for API AudioQueueFreeBuffer... How to avoid this warning?

I am getting this warning in AudioQueueFreeBuffer API

        for (int i = 0; i < kNumberBuffers; ++i) {

            if(mAudioInfo.mBuffers[i] != NULL)
            {
                AudioQueueFreeBuffer(mAudioInfo.mQueue, mAudioInfo.mBuffers[i]);
                mAudioInfo.mBuffers[i] = NULL;
            }   
            XThrowIfError(AudioQueueAllocateBuffer(mAudioInfo.mQueue, mBufferByteSize, &mAudioInfo.mBuffers[i]), "AudioQueueAllocateBuffer failed");

            AQTestBufferCallback (&mAudioInfo, mAudioInfo.mQueue, mAudioInfo.mBuffers[i]);

            if (mAudioInfo.mDone) break;
        }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

马蹄踏│碎落叶 2024-10-22 03:49:28

当您尝试对已在正在运行的 AudioQueue 中排队的缓冲区调用 AudioQueueFreeBuffer() 时,会发生这种情况。在尝试释放缓冲区之前,您应该在关联的 AudioQueue 上调用 AudioQueueStop()。

AudioQueueFreeBuffer() 的文档说:

仅当您想要释放特定缓冲区时才调用此函数
同时继续使用音频队列。您可以处置缓冲区
仅当拥有它的音频队列停止时(即,不
处理音频数据)。

This occurs when you attempt to call AudioQueueFreeBuffer() on a buffer that has been enqueued in an AudioQueue that is running. You should call AudioQueueStop() on the associated AudioQueue before attempting to free the buffers.

The doc's for AudioQueueFreeBuffer() say:

Call this function only if you want to dispose of a particular buffer
while continuing to use an audio queue. You can dispose of a buffer
only when the audio queue that owns it is stopped (that is, not
processing audio data).

街角卖回忆 2024-10-22 03:49:28

试试这个:

for(int i = 0; i < NUM_BUFFERS; i++)
{
    AudioQueueFreeBuffer(playState.queue, playState.buffers[i]);
}

AudioQueueDispose(playState.queue, true);
AudioFileClose(playState.audioFile);

Try this:

for(int i = 0; i < NUM_BUFFERS; i++)
{
    AudioQueueFreeBuffer(playState.queue, playState.buffers[i]);
}

AudioQueueDispose(playState.queue, true);
AudioFileClose(playState.audioFile);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文