AudioQueue doesn't work Window Miniaturize

85 views Asked by At

I am working on the VOIP Application, for voice capturing and play i am using AudioQueue framework, facing one wired issue,
Whenever application window get miniaturize , it doesn't play audio for fraction of the sec, till window doesn't get miniaturize.

I feel its due to running AudioQueue in the main thread, i tried running audioQueue in Other thread, but in that AudioQueue is not working.

Any pointers how to resolve this issue ?

Or .... Is there any way to handle notification when a user press Minimize button and i can handle and refuse to minize when audio is going on ? i am getting delegate method for closing and other activity but not for the When minimize button pressed.

1

There are 1 answers

0
Amitg2k12 On BEST ANSWER

Thanks for looking at it

It got resolved with using CFRunloop in the playback audio queue, like this,

OSStatus status = AudioQueueStart(mQueue,NULL);


NSLog(@" Start AudioQueue returns %d",(int)status);

if ( status != noErr) {
    NSLog(@"AudioQueueStart Error ");
    mIsRunning = TRUE;
}

do {                                               // 5
    CFRunLoopRunInMode (                           // 6
                        kCFRunLoopDefaultMode,                     // 7
                        0.25,                                      // 8
                        false                                      // 9
                        );

} while (mIsRunning);

CFRunLoopRunInMode (                               // 10
                    kCFRunLoopDefaultMode,
                    1,
                    false
                    );

Using this line of code, i can start audioQueue from the thread.