Rango
Rango

Reputation: 21

iOS AudioQueue playing AAC data always delay for 2-3 seconds

Recently I was using AudioQueue to play network AAC data. My plan is that once a AAC data is received, audioqueue enqueue this buffer and play immediately.

When I start audioQueue, I use AudioQueueStart(audioQueue, NULL) to start audioQueue as soon as possible.

However, when I print log, I notice that the AAC buffer was enqueued by AudioQueueEnqueueBuffer(audioQueue, buffer, 0, NULL) immediately but the sound played after enqueuing buffer which delayed for around 2-3 seconds. It means I received and enqueued the data at beginning but the first sound started 2-3 seconds later.

I wonder if it is because that audioqueue service decode AAC to PCM itself so the sounds delayed. If so, should I decode AAC myself and use Audio Unit instead?

I've been confused for a while and wish anyone can light me up!

Upvotes: 0

Views: 282

Answers (1)

Rango
Rango

Reputation: 21

Finally I found the reason. When the AAC data is late, I pause the audioQueue and start again when the data come. the PAUSE operation lead to the delay of playback.

Upvotes: 0

Related Questions