voip - 将 OPUS 流转换为 PCM 或 RTP
问题描述
目前,我正在开发一个VOIP系统。在将RTP流转换为PCM后,我可以将SIP流发送到mumble服务器,并且mumble客户端的语音质量很好。但是,到 SIP 的 Mumble 流 (OPUS) 不起作用,总是有噪音。我正在将 Mumble 频道的流 (OPUS) 转换为 RTP 并将其发送到 SIP 客户端。是否有任何库或源代码来找出 RTP 问题,而不是通过 SIP 接收?
注意:将接收流转换为.wav文件后,语音质量可以,但在SIP客户端中不起作用。
OPUS 解码代码:
public byte[] SendDecodeMumbleDataToMulticast(byte[] encodedData, int uid, int cid)
{
var _decoder = new OpusDecoder(8000, 1) { EnableForwardErrorCorrection = true };
if (encodedData == null)
{
//_decoder.Decode(null, 0, 0, new byte[_sampleRate / _frameSize], 0);
return null;
}
int samples = OpusDecoder.GetSamples(encodedData, 0, encodedData.Length, 8000);
if (samples < 1)
{
return null;
}
byte[] dst = new byte[samples * sizeof(ushort)];
int length = _decoder.Decode(encodedData, 0, encodedData.Length, dst, 0);
if (dst.Length != length)
{
Array.Resize(ref dst, length);
}
RTPPacket rtp = ToRTPPacket(dst, 16, 1);
OnRTPReceived?.Invoke(rtp);
return dst;
}
解决方案
推荐阅读
- javascript - 如何在控制器中使用 multer 函数而不是在路由中使用
- flutter - 运行 Flutter Doctor 后出现 Flutter 错误
- regex - Oracle RegExp - 处理字符串字段中的双引号
- javascript - 如何通过 CDN 在 mathjax v3 上设置“xypic.js”
- python - 在不依赖 `len` 或使用迭代器的情况下检查 python 可迭代对象是否为空
- c++ - FindJUCE.cmake:无法为导入的目标“juce_core”指定源
- c++ - CreateProcess windows API将excel存储在Documents文件夹中
- php - Wordpress 管理页面无法正常工作
- javascript - 不在子菜单上悬停后如何延迟
- r - 仅在列表列表中保留 data.frames