• 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
Re: Endless loop running AudioConverterFillComplexBuffer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Endless loop running AudioConverterFillComplexBuffer


  • Subject: Re: Endless loop running AudioConverterFillComplexBuffer
  • From: james mccartney <email@hidden>
  • Date: Mon, 13 Jul 2009 10:11:47 -0700



I can't really tell from this. You're sure you aren't returning a packet description of zero bytes? That is my only guess at this point.

On Jul 11, 2009, at 12:39 PM, dct wrote:

Thanks to James McCartney, my '!pkd' problem is corrected.

Now, having taken care of that, I have a situation where AudioConverterFillComplexBuffer calls the inputProc once and then goes into an infinite loop.

My code is below. Values shown are for a case to convert one input packet of an mp3 input to pcm.

a. The converter call --

    err = AudioConverterFillComplexBuffer( aCnvrtr, inputCallback,
                                             &inProcData, &nxtDataSz,
                                               &aBufList, NULL );
	//  nxtDataSz = 9216 (output bytes from 1 input packet)

b.  The inputProc ( titled "inputCallback ") --

     OSStatus inputCallback(
                         AudioConverterRef inAudioConverter,
			   UInt32 *ioNumberDataPackets,
			    AudioBufferList *ioData,
			     AudioStreamPacketDescription
                                  **outDataPacketDescription,
			      void *inUserData )
{
	InputProcessData  *callBack = (InputProcessData *)inUserData;
	AudioStreamPacketDescription  *inASPD = callBack->inPcktDescPtr;
	AudioBufferList		      *bufferList = callBack->ioBufferList;
	void			      *in = callBack->inputData;
	UInt32			      frstPckt, nxt1stPckt, inByte0, inBytes, nn;

	if( !inUserData || !*ioNumberDataPackets ) return( -1 );

	frstPckt	= callBack->packetOffset;
	nxt1stPckt  = frstPckt + callBack->stdInPcktCount;
	if( nxt1stPckt >= callBack->todoPacketCount ) {
		nxt1stPckt = callBack->todoPacketCount;
	}
	*ioNumberDataPackets = nn = nxt1stPckt - frstPckt;
            // =1, (ok, one input packet)

	inByte0	= inASPD[frstPckt].mStartOffset;    // = 0, (ok)
	inBytes	= inASPD[nxt1stPckt-1].mStartOffset - inByte0 +
                              inASPD[nxt1stPckt-1].mDataByteSize;
                               // = 627 (ok, input pckt size)
	in += inByte0;          // =0x162aa09d (ok = inputData)

	ioData->mNumberBuffers = 1;
	ioData->mBuffers[0].mNumberChannels = 1;
	ioData->mBuffers[0].mDataByteSize = inBytes; // = 627
	ioData->mBuffers[0].mData = bufferList->mBuffers[0].mData;
                               // = 0x8ac800 ( ok = ioBuffer)

	memcpy((char *)ioData->mBuffers[0].mData, (const char *)in, inBytes);

	*outDataPacketDescription = callBack->outPcktDescPtr;

	callBack->outPcktDescPtr->mStartOffset = 0;
	callBack->outPcktDescPtr->mVariableFramesInPacket = 1;
                               // doesn't work w 0 either
	callBack->outPcktDescPtr->mDataByteSize =
                           nn * callBack->outBytsPerInPckt;
                               // = 9216 (ok 1152 frms*8 bytes/frm)

	callBack->packetOffset = nxt1stPckt;
	callBack->bytesCounter += inBytes;

	return  noErr;
}

Thanks for the help, Don Thompson

_______________________________________________ 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
  • Follow-Ups:
    • Re: Endless loop running AudioConverterFillComplexBuffer
      • From: dct <email@hidden>
References: 
 >Endless loop running AudioConverterFillComplexBuffer (From: dct <email@hidden>)

  • Prev by Date: Endless loop running AudioConverterFillComplexBuffer
  • Next by Date: Re: Endless loop running AudioConverterFillComplexBuffer
  • Previous by thread: Endless loop running AudioConverterFillComplexBuffer
  • Next by thread: Re: Endless loop running AudioConverterFillComplexBuffer
  • Index(es):
    • Date
    • Thread