Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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;
        }
like image 815
Chandan Shetty SP Avatar asked Feb 01 '11 09:02

Chandan Shetty SP


2 Answers

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

like image 106
hyperspasm Avatar answered Nov 01 '22 11:11

hyperspasm


Try this:

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

AudioQueueDispose(playState.queue, true);
AudioFileClose(playState.audioFile);
like image 1
servermanfail Avatar answered Nov 01 '22 09:11

servermanfail