Pergunta

I am working on an app that involves recording audio on one device and playing it back on another device connected with a socket connection.

I am using Audioqueues to record data on one peer device, and streaming that data OTA, as in SpeakHere example.

I am trying to play that data back on the receiving device using AudioFileStream and AudioQueue on the other end to play it back, as in Matt Gallagher's AudioStreamer example.

The call to AudioFileStreamParseBytes is returning the "pty?" error. Consequentially, neither of the callbacks associated with this call (for properties and audio packet) are getting called.

There is plenty of sample code for streaming mp3s and HTTP streams etc online. However if I want to stream audio recorded using AudioQueue, is there something I might be missing? Something related to AudioQueue properties perhaps?

Can someone also suggest a way to check if the data I have received is in fact sensible audio data?

Small piece of code:

void AQPlayer::StreamDataAvailable(MediaPacket* packet)
{
    OSStatus err = 0;
    err = AudioFileStreamParseBytes(mAudioFileStream, packet->msizeInBytes, packet->mVoiceData, 0);
    if (err) 
    { 
        NSLog(@"AudioFileStreamParseBytes Error");
    }
} 

Additionally, I have already checked that packet->mVoiceData has about 44Kbytes of data (although not sure if it is sensible data) and that packet->msizeInBytes reflects that number.

Any help appreciated. Thanks!

Foi útil?

Solução

Looks like AudioFileStreams do not support LPCM format. That seems to be the reason I am getting this error. My guess is, since LPCM is raw data and does not need to be parsed.

Also turns out that there is no need to use AudioFileStreams at all for this case. Just using AudioQueues was enough.

I have been able to record, transmit and send the data using AudioQueues alone.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top