AudioFileStreamParseBytes 返回“pty?”关于流式传输、记录的数据

发布于 2024-12-26 05:26:15 字数 893 浏览 2 评论 0原文

我正在开发一个应用程序,该应用程序涉及在一个设备上录制音频并在通过套接字连接连接的另一台设备上播放它。

我正在使用 Audioqueues 在一台对等设备上记录数据,并通过 OTA 传输该数据,如 SpeakHere 示例中所示。

我尝试在另一端使用 AudioFileStream 和 AudioQueue 在接收设备上播放该数据,如 Matt Gallagher 的 AudioStreamer 示例中所示。

对 AudioFileStreamParseBytes 的调用返回“pty?”错误。因此,与此调用(针对属性和音频数据包)关联的回调都不会被调用。

有大量用于在线播放 mp3 和 HTTP 流等的示例代码。但是,如果我想流式传输使用 AudioQueue 录制的音频,是否有什么东西我可能会丢失?也许与 AudioQueue 属性有关?

有人还可以建议一种方法来检查我收到的数据是否确实是合理的音频数据?

小段代码:

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

此外,我已经检查过 packet->mVoiceData 有大约 44Kbytes 的数据(尽管不确定它是否是合理的数据)并且 packet->msizeInBytes 反映了这个数字。

任何帮助表示赞赏。 谢谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

撕心裂肺的伤痛 2025-01-02 05:26:15

看起来 AudioFileStreams 不支持 LPCM 格式。这似乎就是我收到此错误的原因。我的猜测是,因为 LPCM 是原始数据,不需要解析。

事实证明,在这种情况下根本不需要使用 AudioFileStreams。只需使用 AudioQueues 就足够了。

我已经能够单独使用 AudioQueues 来记录、传输和发送数据。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文