• 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: Streaming Audio - AudioFileStream, CFReadStreamRead and AudioQueue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Streaming Audio - AudioFileStream, CFReadStreamRead and AudioQueue


  • Subject: Re: Streaming Audio - AudioFileStream, CFReadStreamRead and AudioQueue
  • From: Jens Alfke <email@hidden>
  • Date: Wed, 30 Jul 2008 22:35:20 -0700


On 30 Jul '08, at 4:34 AM, Adam Fox wrote:

I then open a data stream to a URL of an MP3 stream..

[code]
NSURL *url = "" URLWithString:@"http://mp3stream.com"];
CFHTTPMessageRef message = CFHTTPMessageCreateRequest(kCFAllocatorDefault,
                                                     CFSTR("GET"),
                                                     (CFURLRef)url,
                                                     kCFHTTPVersion1_1);

It would be better to use NSURLConnection instead. It's a higher-level (and OOP) API, and it also handles things like redirects and authentication for you.

..here I try and allocate the stream packets into the an
AudioQueueBuffer and force that buffer into the AudioQueue callback..

Hm, that's not the approach I use. I have a fixed ring of buffers for my queue, and I fill the next buffer with packets when the queue calls me back. I have a secondary buffer where I store the packets read from the stream until they go into the queue.

Your approach might work; but you need to be careful to dispose all the buffers you create after they've been played, else you're leaking memory. I think you can dispose each buffer that the queue's callback gives you, since that callback occurs after the queue has finished playing that buffer.

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

References: 
 >Streaming Audio - AudioFileStream, CFReadStreamRead and AudioQueue (From: "Adam Fox" <email@hidden>)

  • Prev by Date: Re: Adjusting AudioQueue volume
  • Next by Date: Re: Streaming Audio - AudioFileStream, CFReadStreamRead and AudioQueue
  • Previous by thread: Streaming Audio - AudioFileStream, CFReadStreamRead and AudioQueue
  • Next by thread: Re: Streaming Audio - AudioFileStream, CFReadStreamRead and AudioQueue
  • Index(es):
    • Date
    • Thread