• 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: Getting wrong data format for stream
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting wrong data format for stream


  • Subject: Re: Getting wrong data format for stream
  • From: james mccartney <email@hidden>
  • Date: Tue, 21 Jul 2009 18:06:03 -0700


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.


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
  • Follow-Ups:
    • Re: Getting wrong data format for stream
      • From: james mccartney <email@hidden>
References: 
 >Getting wrong data format for stream (From: Tom Harrington <email@hidden>)

  • Prev by Date: Getting wrong data format for stream
  • Next by Date: Re: Getting wrong data format for stream
  • Previous by thread: Getting wrong data format for stream
  • Next by thread: Re: Getting wrong data format for stream
  • Index(es):
    • Date
    • Thread