I'm trying develop app what play streaming PCM data from server.
I have used AudioQueue, but it does not work well.
PCM data format (from server) :
Sample rate = 48000, num of channel = 2, Bit per sample = 16
And, server is not streaming fixed bytes to client.
(Streaming variable bytes. Ex : 30848, 128, 2764, ... bytes )
My source code :
Here, ASBD structure what I have setted & create Audio Queue object (language : Swift)
// Create ASBD structure & set properties.
var streamFormat = AudioStreamBasicDescription()
streamFormat.mSampleRate = 48000
streamFormat.mFormatID = kAudioFormatLinearPCM
streamFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked
streamFormat.mFramesPerPacket = 1
streamFormat.mChannelsPerFrame = 2
streamFormat.mBitsPerChannel = 16
streamFormat.mBytesPerFrame = (streamFormat.mBitsPerChannel / 8) * streamFormat.mChannelsPerFrame
streamFormat.mBytesPerPacket = streamFormat.mBytesPerFrame
streamFormat.mReserved = 0
// Create AudioQueue for playing PCM streaming data.
var err = AudioQueueNewOutput(&streamFormat, self.queueCallbackProc, nil, nil, nil, 0, &aq)
...
I have setted ASBD structure & created AudioQueue object like the above.
AudioQueue play streamed PCM data very well for a few seconds,
but soon playing sound is on and off. What can I do?
(still streaming, and queueing AudioQueue)
Please give me any idea.