S. M. Shahinul Islam
S. M. Shahinul Islam

Reputation: 2800

How can I change codec parsing system in MjSip?

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?

Upvotes: 4

Views: 555

Answers (0)

Related Questions