AudioQueueFreeBuffer warning

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;
        }

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).


尝试这个:

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

AudioQueueDispose(playState.queue, true);
AudioFileClose(playState.audioFile);
链接地址: http://www.djcxy.com/p/4586.html

上一篇: 如何在格式字符串攻击中将值写入地址

下一篇: AudioQueueFreeBuffer警告