How to change codec analysis system in MjSip?

I am working on a softphone project and use the MjSip stack to develop it. The MjSip core is supported only with PCMA / PCMU codecs. But I want to add some more codecs like G729, GSM, iLBC, etc.

In MjSip, the AudioSender.java class is the sender of the pure-java audio stream. It uses the javax.sound package. In this class, javax.sound.sampled.AudioFormat is used to format an audio stream using a signed, unsigned, or floating PCM type. This is done in MjSip, as shown below.

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 created my own org.mine.codec package including this class

 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 AudioFormat.Encoding . How do I create the AudioSender.java class, and what has changed in the RtpStreamSender.java class ? Is it possible to ignore the AudioFormat class? If I should use this, would I be the constructor of RtpStreamSender.java ?

+4
source share

Source: https://habr.com/ru/post/1397408/


All Articles