I'm using this tutorial Multipeer Connectivity Audio Stream To Multiple Peers and this project Github Repository , in order to stream audio from NSInputStream, which is obtained by:
-(void)session:didReceiveStream:withName:fromPeer:
MCSession delegate method.
After, this open a new Audio File Stream (TDAudioFileStreamer/Classes/AudioFileStream.m:39):
OSStatus err = AudioFileStreamOpen((__bridge void *)self, TDAudioFileStreamPropertyListener, TDAudioFileStreamPacketsListener, 0, &_audioFileStreamID);
Then read bytes from NSInputStream and try to parse by this way (TDAudioFileStreamer/Classes/AudioFileStream.m:98):
err = AudioFileStreamParseBytes(self.audioFileStreamID, length, data, kAudioFileStreamParseFlag_Discontinuity);
Or:
err = AudioFileStreamParseBytes(self.audioFileStreamID, length, data, 0);
Depending of the data flow.
And finally, this fill AudioQueue Buffer with the parsed data in order to playback (i guess - TDAudioFileStreamer/Classes/TDAudioQueueFiller.m) .
This works really nice for MP3 format files, but with others formats when try to parse the bytes get "unsupported file format" error.
The Apple documentation, says Audio File Stream services support a lot of formats and they are listed in this Link: Apple Stream Services supported formats, but for me only works with MP3.
I was trying too, when open the Audio File Stream pass a hint about file format like this and send a M4A or AAC file:
OSStatus err = AudioFileStreamOpen((__bridge void *)self, TDAudioFileStreamPropertyListener, TDAudioFileStreamPacketsListener, kAudioFileAAC_ADTSType, &_audioFileStreamID);
Where kAudioFileAAC_ADTSType is the type of sent file that will be streamed, by this way , the "unsupported file format error" disappears , but the application crashes and get a new error
This says: io: lpc and client: aac.
- Someone know what this mean?
- The Queue is expecting AAC format file?
- Why LPCM( Linear Pulse Code Modulation), i'm sending M4A or AAC not LPCM?
Thanks in advance.