Re: AudioConverterFillComplexBuffer and '!buf' error
Re: AudioConverterFillComplexBuffer and '!buf' error
- Subject: Re: AudioConverterFillComplexBuffer and '!buf' error
- From: "Damien Chavarria" <email@hidden>
- Date: Thu, 8 Nov 2007 14:29:28 +0100
Hi,
Thank you very much you put me on the right tack. I was indeed only passing raw data to the converter by a fixed amount that did not correspond to the packet size or anything, I should have paid closer attention to the samples. I am now using the AudioFile api to read the requested number of packets and get proper packet descriptions form the mp3 stream. The one thing though is that my mp3 stream is contained in an AVI file that I am still downloading (and therefore progressively playing) at the time the program runs.
So I am using AudioFileOpenWithCallbacks to open my audio stream from memory and provide read and get size functions. Since I don't really know the size of my audio stream in advance and since the whole stream isn't available, I return a big number from the get size method. This might not be the best but I couldn't figure out a way to use the AudioFile API another way, since it seems to want to look at the end of the stream for a ID3 tag (which I fake right now). Maybe there is another API to read audio packets from a stream (as opposed to a file of fixed length) ?
Anyway, this seems to work as the Open call succeeds and I'm able to read several packets and decode some of the mp3 stream to PCM using my audio converter. Now, the problem is I am getting a crash though and it does not always happens at the same 'time' in the mp3 stream but it always happen at same spot inside MPEGAudioFile::ReadPackets from within the time I call AudioFileReadPackets() to read packets.
I'm not sure why the crash does not always happen at the same time, however it happens consistently and when it does, I can see that the packet number (of which I keep count to call AudioFileReadPackets) is always either 1023, 2047 or 4095 - which is odly a power of two minus 1.
I must be doing something wrong but I am not sure how to find out what now that all I get is a crash a few seconds into the decoding operation.
Again, thank you very much if you can help...and sorry to be a pain :)
Cheers,
Damien.
On Nov 8, 2007 12:57 AM, William Stewart <
email@hidden> wrote:
The error is from AudioCodec.h:
kAudioCodecNotEnoughBufferSpaceError
I suspect that you are feeding partial packets in your Input callback
- you can't do that, so you have to provide packet descriptions and
buffers that contain full packets only.
Bill
On Nov 7, 2007, at 1:14 PM, Damien Chavarria wrote:
>
> Hi fellow coders,
>
> I am using core audio's audio converter API to decode a mp3
> bitstream into PCM samples. I have some code that creates and uses
> an audio decoder and that used to do the job (although I suspect it
> was a little shallow or shaky to start with) back with Tiger. Now
> running it on Leopard it didn't work and I first found a problem
> where AudioConverterFillComplexBuffer would return a status code of
> '!pkg' at which point I found out I needed to provide packet
> desciptions which I added. Now it works at first and I'm able to
> decode about 1 seond of audio through successive calls to
> AudioConverterFillComplexBuffer.
>
> After that period though, I get a new error.
> AudioConverterFillComplexBuffer returns '!buf' which I have not seen
> before and couldn't find referenced in the documentation. When it
> returns I have some samples in the output buffer list but not as
> many as I had requested. Does anyone have an idea of what this error
> code means, or what would cause it to be returned ? I already
> checked the input buffer that I fill through the input proc at that
> time and it looks okay (8192 bytes)... Successive calls with newly
> read input data all return '!buf' still.
>
> Thank you very much for any insight you can provide,
> Cheers,
> --
> Damien. _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list (
>
> This email sent to email@hidden
--
D.
_______________________________________________
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