如何更改 MjSip 中的编解码器解析系统?
我正在开发一个软件电话项目并使用 MjSip 堆栈来创建和开发它。核心 MjSip 仅支持 PCMA/PCMU 编解码器。但我想添加更多的编解码器,如 G729、GSM、iLBC 等。
在 MjSip 中,类 AudioSender.java 是一个纯 java 音频流发送器。它使用 javax.sound 包。 在该类中,javax.sound.sampled.AudioFormat 用于使用 PCM 有符号、无符号或浮点类型格式化音频流。 它在 MjSip 中做了如下操作。
AudioFormat.Encoding codec;
if (pcmu) {
codec = AudioFormat.Encoding.ULAW;
} else if (linear_signed) {
codec = AudioFormat.Encoding.PCM_SIGNED;
} else if (pcma) {
codec = AudioFormat.Encoding.ALAW;
} else {
codec = AudioFormat.Encoding.PCM_UNSIGNED; // default
}
if (sound)
{ AudioFormat format=new AudioFormat(codec,sample_rate,8*sample_size,1,sample_size,sample_rate,big_endian);
System.out.println("System audio format: "+format);
audio_input=new AudioInput(format);
sender=new RtpStreamSender(audio_input.getInputStream(),false,payload_type,frame_rate,frame_size,daddr,dport);
}
但我已经创建了自己的包org.mine.codec,其中包含此类
Codec.java (This is an Interface)
CodecAttribute.java
CodecUtils.java
CodecFactory.java
CodecG729.java
CodecPCMA.java
CodecPCMU.java
,所以我想使用它而不是AudioFormat.Encoding。我应该如何构建我的 AudioSender.java 类以及 RtpStreamSender.java 类 中需要进行哪些更改? 是否可以忽略 AudioFormat 类?如果我必须使用它,RtpStreamSender.java 的构造函数是什么?
I am working on a softphone project and using MjSip stack to create develop it. The core MjSip is only suporrted with PCMA/PCMU codecs. But I want to add some more codecs with it like G729, GSM, iLBC etc.
In MjSip the class AudioSender.java is a pure-java audio stream sender. It uses javax.sound package.
In that class javax.sound.sampled.AudioFormat is used for formatting the audio stream with PCM signed, unsigned or float type.
It has done in MjSip like following.
AudioFormat.Encoding codec;
if (pcmu) {
codec = AudioFormat.Encoding.ULAW;
} else if (linear_signed) {
codec = AudioFormat.Encoding.PCM_SIGNED;
} else if (pcma) {
codec = AudioFormat.Encoding.ALAW;
} else {
codec = AudioFormat.Encoding.PCM_UNSIGNED; // default
}
if (sound)
{ AudioFormat format=new AudioFormat(codec,sample_rate,8*sample_size,1,sample_size,sample_rate,big_endian);
System.out.println("System audio format: "+format);
audio_input=new AudioInput(format);
sender=new RtpStreamSender(audio_input.getInputStream(),false,payload_type,frame_rate,frame_size,daddr,dport);
}
But I have created my own package org.mine.codec including this classes
Codec.java (This is an Interface)
CodecAttribute.java
CodecUtils.java
CodecFactory.java
CodecG729.java
CodecPCMA.java
CodecPCMU.java
So I want to use this instead of that AudioFormat.Encoding. How should I construct my AudioSender.java class and what changed are needed in RtpStreamSender.java class?
Is it possible to ignore that AudioFormat class? If I have to use that what would be the constructor of RtpStreamSender.java?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论