Re: Getting wrong data format for stream
Re: Getting wrong data format for stream
- Subject: Re: Getting wrong data format for stream
- From: james mccartney <email@hidden>
- Date: Wed, 22 Jul 2009 09:09:36 -0700
On Jul 21, 2009, at 6:06 PM, james mccartney wrote:
Are you supplying a buffer whose first byte begins an MPEG Layer 3
packet (optionally preceeded by an ID3 tag), or is it a buffer that
starts in the middle of some random header data after which, at some
point, there is MP3 data. If the former, then the parser may be
picking up on the first bytes that look like an MPEG packet header
and reporting that as the format.
oops. should be "if the latter". IOW starting in the middle of random
data is the not good scenario.
There is not really any way to start in the middle of random data
and reliably determine the format.
There have been some fixes in this area to improve reliability, but
there is no certain method for deducing the format starting from a
random position in a finite buffer of arbitrary data.
On Jul 21, 2009, at 2:03 PM, Tom Harrington wrote:
I'm using Audio File Stream Services to play streaming audio from a
web site.
The stream in question is MP3, 44100Hz, 112kbps, from a shoutcast
server (more details on request). When I create the stream I provide
a file type hint of kAudioFileMP3Type.
Periodically, maybe one out of 8 times, I get bogus data for
kAudioFileStreamProperty_DataFormat. It'll have an incorrect sample
rate (usually 32000Hz or 48000Hz) and a format of MP1
(kAudioFormatMPEGLayer1). Playback then fails-- since I'm on iPhone,
AudioQueueNewOutput() returns kAudioFormatUnknownFormatError.
I look up the format by waiting for
kAudioFileStreamProperty_ReadyToProducePackets and then doing:
AudioStreamBasicDescription dataFormat;
UInt32 propertySize = sizeof(AudioStreamBasicDescription);
OSStatus audioStatus = AudioFileStreamGetProperty(inAudioFileStream,
kAudioFileStreamProperty_DataFormat, &propertySize, &dataFormat);
When I get bogus data, audioStatus is 0, but the returned format is
bogus. What can I do to deal with this?
--
Tom Harrington
email@hidden
AIM: atomicbird1
_______________________________________________
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
_______________________________________________
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
_______________________________________________
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