• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
AudioConverterFillComplexBuffer returns -50 when decoding from MPEG4AAC to PCM
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AudioConverterFillComplexBuffer returns -50 when decoding from MPEG4AAC to PCM


  • Subject: AudioConverterFillComplexBuffer returns -50 when decoding from MPEG4AAC to PCM
  • From: faraz khan <email@hidden>
  • Date: Wed, 11 Apr 2012 00:14:11 -0700

Though I seem to have setup the encoding correctly I am unable to
decode the stream that I receive using
AudioConverterFillComplexBuffer. My Decode callback gets called which
basically does:

OSStatus DecoderDataProc(AudioConverterRef				inAudioConverter,
						 UInt32*							ioNumberDataPackets,
						 AudioBufferList*				ioData,
						 AudioStreamPacketDescription**	outDataPacketDescription,
						 void*							inUserData)
{
	OSStatus err = noErr;
	SlaveAudio * sa = (SlaveAudio*)inUserData;

	// figure out how much to read

    AudioPacket * packet = sa->lastReceivedPacket;
	if (!packet.read)
    {
        ioData->mNumberBuffers = 1;
        ioData->mBuffers[0].mData = (void*)packet._encodedData.bytes;
        ioData->mBuffers[0].mDataByteSize = packet._encodedData.length;
        ioData->mBuffers[0].mNumberChannels = 2;

        *outDataPacketDescription = packet._pktDescs.bytes;
        *ioNumberDataPackets = packet._pktDescs.length /
sizeof(AudioStreamPacketDescription);
        packet.read = YES;
    }
    else
    {
        *ioNumberDataPackets = 0;
        return 1;
    }


I can verify that this is the EXACT data the encoder sent out,
including the AudioStreamPacketDescriptions.

My call to AudioConverterFillComplexBuffer is as follows:

	err = AudioConverterFillComplexBuffer(audioConverter,
DecoderDataProc, self, &ioOutputDataPackets, intakeBuffer, NULL);

where ioOutputDataPackets are the number of packets that were
compressed and are in the number of frames of the OUTPUT format (PCM).
inTakeBuffer is basically setup as:

AudioBufferList list
list.mNumBuffers = 1;
list.mBuffers[0].mData = malloc(ioOutputDataPackets * 4);  // 4 bytes
per frame of PCM data
list.mBuffers[0].mNumDataBytes = ioOutputDataPackets * 4;
list.mBuffers[0].mNumChannels = 2  //exactly like the input PCM data
that was used to generate this stream

Any help or where to look would be appreciated. The converter goes
only ONCE through my callback and never again.

I had a similar issue with setting up the encoder where it was
throwing a -50 and that ended up being a bad AudioBufferList setup.
However this is the same AudioBufferList that works fine on the
encoder.

Thanks in advance guys!


--
Faraz Khan
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Avila/Adamson CoreAudio book
  • Next by Date: Re: QT -208 error
  • Previous by thread: Re: Coreaudio-api Digest, Vol 9, Issue 104
  • Next by thread: MixerHost sample code mono file output
  • Index(es):
    • Date
    • Thread