-1

I have a CoreAudio based player that streams remote mp3s.

It uses NSURLConnection to retrieve the mp3 data -> uses AudioConverter to convert the stream into PCM -> and feeds the stream into an AUGraph to play audio.

The player works completely fine in my demo app(it only contains a play button), but when i add the player to another project, but when coupled with a project that already makes networking calls, and updates UI, the player fails to play audio past a few seconds.

Am possibly experiencing a threading issue? What are some preventative approaches that i can take or look into that can prevent this from happening?

3254523
  • 3,016
  • 7
  • 29
  • 43
  • It's a very complex thing you're doing. It's a bit difficult to help without more information. Try to narrow down exactly when the crash is happening, and ask(or edit) a more specific question. If you need debugging tips, you should reframe your question toward help with debugging. It might be something simple like updating you UI from a background thread that's causing the crash, but I would just be guessing because I don't have enough information. – dave234 Aug 08 '15 at 02:45
  • @Dave - thank you for your suggestion, i have re-posted the question with more details http://stackoverflow.com/questions/31899339/audio-stream-stops-playing-audio-after-nsurlconnections-connectiondidfinishload – 3254523 Aug 08 '15 at 22:47

1 Answers1

0

You do not mention anything in your software architecture about buffering your data between receiving it via NSURLConnection and when you send it to your player.

Data will arrive in chunks with inconsistent arrival rates.

Please see these answers I posted regarding buffering and network jitter.

Network jitter

and

Network jitter and buffering queue

In a nutshell, you can receive data and immediately send it to your player because the next data may not arrive in time.

You don't mention the rate that the mp3 file is delivered. If it is delivered very quickly over a fast connection... are you buffering all of the data received or is it getting lost somewhere in your app? There is a chance that your problem is that you are receiving way too much data too fast and not properly buffering up the data received.

Community
  • 1
  • 1
jaybers
  • 1,991
  • 13
  • 18