[sip-comm-dev] PlugInManager customCodecs missing


#1

Hello all,

I am trying to build simple SIP UA based on
sip-communicator. To do this, I have removed some
featuers like the felix, and created custom
MediaControl object in package: impl.media;

Now, it seems that the registration of the custom
codecs:

"net.java.sip.communicator.impl.media.codec.audio.alaw.JavaEncoder",
       
"net.java.sip.communicator.impl.media.codec.audio.alaw.DePacketizer",
       
"net.java.sip.communicator.impl.media.codec.audio.alaw.Packetizer",
       
"net.java.sip.communicator.impl.media.codec.audio.speex.JavaEncoder",
       
"net.java.sip.communicator.impl.media.codec.audio.speex.JavaDecoder",
       
"net.java.sip.communicator.impl.media.codec.audio.ilbc.JavaEncoder",
       
"net.java.sip.communicator.impl.media.codec.audio.ilbc.JavaDecoder"

is OK. But the datasource processor created does not
have those codec inside.

What am I doing wrong? (Please help - I am quite
desperate here).

Thanks,

Michael

···

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#2

From what I can tell, SC does not properly register the formats with the RTPManager. Here is some info that is similar to what I recently sent to Chris, who is working on RTP in SC.

Every time RTPManager.newInstance() is called, the nonstandard formats need to be resistered. ALAW/RTP, Speex/RTP, and ILBC/rtp are all nonstandard.

FMJ uses the class net.sf.fmj.media.datasink.rtp.RTPBonusFormatsMgr to register these additional formats, see its source code. If you choose to use a custom format, both the sender and the receiver must register it with the RTPManager.

For example, FMJ does this on the sending end:

rtpManager = RTPManager.newInstance();
rtpManager.initialize(new SessionAddress());
RTPBonusFormatsMgr.addBonusFormats(rtpManager);

....

and on the receiving end;

rtpManager = (RTPManager) RTPManager.newInstance();
RTPBonusFormatsMgr.addBonusFormats(rtpManager);
rtpManager.addReceiveStreamListener(new MyReceiveStreamListener());
....

You'll want to look and see where SC calls RTPManager.newInstance(), and add the formats there. You do not have to use net.sf.fmj.media.datasink.rtp.RTPBonusFormatsMgr of course, you may simply look at its code and do something similar.

The numbers that net.sf.fmj.media.datasink.rtp.RTPBonusFormatsMgr assigns to formats are totally arbitrary. The only important thing is that the numbers match on the sending and receiving side.

Hope this helps,

Ken.

PS here is FMJ's source to add these formats:

public class RTPBonusFormatsMgr
{
    public static final int FIRST_BONUS_FORMAT = 100;
    public static final int ALAW_RTP_INDEX = 100;
    public static final int SPEEX_RTP_INDEX = 101;
    public static final int ILBC_RTP_INDEX = 102;
   
    {
        mgr.addFormat(new AudioFormat(
                BonusAudioFormatEncodings.ALAW_RTP,
                8000,
                8,
                1,
                -1,
                AudioFormat.SIGNED
            ), ALAW_RTP_INDEX);
               // see net.java.sip.communicator.impl.media.codec.audio.speex.JavaDecoder.
        // only relevant if this encoder/decoder pair is available.
        mgr.addFormat(new AudioFormat(
                BonusAudioFormatEncodings.SPEEX_RTP,
                8000,
                8,
                1,
                -1,
                AudioFormat.SIGNED //isSigned());
            ), SPEEX_RTP_INDEX);
               // ditto, for net.java.sip.communicator.impl.media.codec.audio.ilbc.JavaDecoder:
        mgr.addFormat(new AudioFormat(
                BonusAudioFormatEncodings.ILBC_RTP,
                8000.0,
                16,
                1,
                AudioFormat.LITTLE_ENDIAN,
                AudioFormat.SIGNED
        ), ILBC_RTP_INDEX);
       
}

Michael kr wrote:

···

Hello all,

I am trying to build simple SIP UA based on
sip-communicator. To do this, I have removed some
featuers like the felix, and created custom
MediaControl object in package: impl.media;

Now, it seems that the registration of the custom
codecs:

"net.java.sip.communicator.impl.media.codec.audio.alaw.JavaEncoder",
       "net.java.sip.communicator.impl.media.codec.audio.alaw.DePacketizer",
       "net.java.sip.communicator.impl.media.codec.audio.alaw.Packetizer",
       "net.java.sip.communicator.impl.media.codec.audio.speex.JavaEncoder",
       "net.java.sip.communicator.impl.media.codec.audio.speex.JavaDecoder",
       "net.java.sip.communicator.impl.media.codec.audio.ilbc.JavaEncoder",
       "net.java.sip.communicator.impl.media.codec.audio.ilbc.JavaDecoder"

is OK. But the datasource processor created does not
have those codec inside.

What am I doing wrong? (Please help - I am quite
desperate here).

Thanks,

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#3

Hi Ken,

Ken Larson wrote:

From what I can tell, SC does not properly register the formats with the RTPManager. Here is some info that is similar to what I recently sent to Chris, who is working on RTP in SC.

Every time RTPManager.newInstance() is called, the nonstandard formats need to be resistered. ALAW/RTP, Speex/RTP, and ILBC/rtp are all nonstandard.

I agree that ALAW/RTP, Speex/RTP, and ILBC/rtp are nonstandard and missing in jmf. But I have changed com.sun.media.rtp.FormatInfo and have added them there - for example :
formatList[110] = new AudioFormat("speex/rtp", 8000D, -1, 1);

In answer to Michael maybe: he is not using our jmf libs (which have little changes :slight_smile: ).
But this is a good idea to register the formats in the newly created RTPManager I will change to that approach in sip-communicator.
Thanks for the hint.

damencho

···

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#4

Hello Ken and Damencho!
   
  Thank you for your prompt response! I did need to use the sip-communicator JMF libs.
  As I have spent 5 working days on this, you might want to alert the unsuspecting programmer.
   
  In case I do want to use the latest standard JMF libs, how do I register the plugins?
  (
  There are two calls to RTPManager.newInstance:
   
  grep "RTPManager.newInstance"
./net/java/sip/communicator/impl/media/CallSessionImpl.java:
  private RTPManager audioRtpManager = RTPManager.newInstance();
./net/java/sip/communicator/impl/media/CallSessionImpl.java:
  private RTPManager videoRtpManager = RTPManager.newInstance();
   
   )
   
  Thanks again for your help,
   
  Michael
  
  Hi Ken,

Ken Larson wrote:

From what I can tell, SC does not properly register the formats with
the RTPManager. Here is some info that is similar to what I recently
sent to Chris, who is working on RTP in SC.

Every time RTPManager.newInstance() is called, the nonstandard formats
need to be resistered. ALAW/RTP, Speex/RTP, and ILBC/rtp are all
nonstandard.

I agree that ALAW/RTP, Speex/RTP, and ILBC/rtp are nonstandard and
missing in jmf. But I have changed com.sun.media.rtp.FormatInfo and have
added them there - for example :
formatList[110] = new AudioFormat("speex/rtp", 8000D, -1, 1);

In answer to Michael maybe: he is not using our jmf libs (which have
little changes :slight_smile: ).
But this is a good idea to register the formats in the newly created
RTPManager I will change to that approach in sip-communicator.
Thanks for the hint.

damencho

···

Damian Minkov <damencho@damencho.com> wrote:

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#5

Hi Michael,

We're initializing all RTP Managers in here:

net.java.sip.communicator.impl.media.CallSessionImpl.initializeRtpManager()

You should be able to easily add what Ken suggested in this method.

Hope this helps
Emil

···

On 7/11/07, mik <rivael_il@yahoo.com> wrote:

Hello Ken and Damencho!

Thank you for your prompt response! I did need to use the sip-communicator
JMF libs.
As I have spent 5 working days on this, you might want to alert the
unsuspecting programmer.

In case I do want to use the latest standard JMF libs, how do I register the
plugins?
(
There are two calls to RTPManager.newInstance:

grep "RTPManager.newInstance"
./net/java/sip/communicator/impl/media/CallSessionImpl.java:

private RTPManager audioRtpManager = RTPManager.newInstance();
./net/java/sip/communicator/impl/media/CallSessionImpl.java:

private RTPManager videoRtpManager = RTPManager.newInstance();

)

Thanks again for your help,

Michael

Damian Minkov <damencho@damencho.com> wrote:
Hi Ken,

Ken Larson wrote:
> From what I can tell, SC does not properly register the formats with
> the RTPManager. Here is some info that is similar to what I recently
> sent to Chris, who is working on RTP in SC.
>
> Every time RTPManager.newInstance() is called, the nonstandard formats
> need to be resistered. ALAW/RTP, Speex/RTP, and ILBC/rtp are all
> nonstandard.
>
I agree that ALAW/RTP, Speex/RTP, and ILBC/rtp are nonstandard and
missing in jmf. But I have changed com.sun.media.rtp.FormatInfo and have
added them there - for example :
formatList[110] = new AudioFormat("speex/rtp", 8000D, -1, 1);

In answer to Michael maybe: he is not using our jmf libs (which have
little changes :slight_smile: ).
But this is a good idea to register the formats in the newly created
RTPManager I will change to that approach in sip-communicator.
Thanks for the hint.

damencho

---------------------------------------------------------------------
To unsubscribe, e-mail:
dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail:
dev-help@sip-communicator.dev.java.net


#6

Ah, thanks, that explains why it works in SC, and that I did not find the code.

Agreed, the best way to do this is outside of the sun classes - that way it will work better with FMJ out of the box, as well.

Ken

Damian Minkov wrote:

···

Hi Ken,

Ken Larson wrote:

From what I can tell, SC does not properly register the formats with the RTPManager. Here is some info that is similar to what I recently sent to Chris, who is working on RTP in SC.

Every time RTPManager.newInstance() is called, the nonstandard formats need to be resistered. ALAW/RTP, Speex/RTP, and ILBC/rtp are all nonstandard.

I agree that ALAW/RTP, Speex/RTP, and ILBC/rtp are nonstandard and missing in jmf. But I have changed com.sun.media.rtp.FormatInfo and have added them there - for example :
formatList[110] = new AudioFormat("speex/rtp", 8000D, -1, 1);

In answer to Michael maybe: he is not using our jmf libs (which have little changes :slight_smile: ).
But this is a good idea to register the formats in the newly created RTPManager I will change to that approach in sip-communicator.
Thanks for the hint.

damencho

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#7

Hello all!

Incidentally I've just today tried to do the same thing. The posting came
just at the right time for me.

I haven't been successful so far, unfortunately. Adding the format to the
RTP Manager is not all one has to do it seems. According to the SIP
Communicator log messages, the encoders/decoders for the custom formats are
not registered when I use the standard JMF. I guess they are already added
to the Registry of the custom JMF, so I'll have to add them to the standard
JMF registry by hand.

I won't have time to do this today, but will try tomorrow and keep you
informed.

This is my first post to the list, BTW. Thanks to all contributors for the
great work.

Regards
Michael Koch

···

Von: Emil Ivov [mailto:emcho@emcho.com]
Gesendet: Mittwoch, 11. Juli 2007 13:43
An: dev@sip-communicator.dev.java.net
Betreff: Re: [sip-comm-dev] PlugInManager customCodecs missing

Hi Michael,

We're initializing all RTP Managers in here:

net.java.sip.communicator.impl.media.CallSessionImpl.initializ
eRtpManager()

You should be able to easily add what Ken suggested in this method.

Hope this helps
Emil

On 7/11/07, mik <rivael_il@yahoo.com> wrote:
>
> Hello Ken and Damencho!
>
> Thank you for your prompt response! I did need to use the
sip-communicator
> JMF libs.
> As I have spent 5 working days on this, you might want to alert the
> unsuspecting programmer.
>
> In case I do want to use the latest standard JMF libs, how
do I register the
> plugins?
> (
> There are two calls to RTPManager.newInstance:
>
> grep "RTPManager.newInstance"
> ./net/java/sip/communicator/impl/media/CallSessionImpl.java:
>
> private RTPManager audioRtpManager = RTPManager.newInstance();
> ./net/java/sip/communicator/impl/media/CallSessionImpl.java:
>
> private RTPManager videoRtpManager = RTPManager.newInstance();
>
> )
>
> Thanks again for your help,
>
> Michael
>
>
> Damian Minkov <damencho@damencho.com> wrote:
> Hi Ken,
>
> Ken Larson wrote:
> > From what I can tell, SC does not properly register the
formats with
> > the RTPManager. Here is some info that is similar to what
I recently
> > sent to Chris, who is working on RTP in SC.
> >
> > Every time RTPManager.newInstance() is called, the
nonstandard formats
> > need to be resistered. ALAW/RTP, Speex/RTP, and ILBC/rtp are all
> > nonstandard.
> >
> I agree that ALAW/RTP, Speex/RTP, and ILBC/rtp are nonstandard and
> missing in jmf. But I have changed
com.sun.media.rtp.FormatInfo and have
> added them there - for example :
> formatList[110] = new AudioFormat("speex/rtp", 8000D, -1, 1);
>
> In answer to Michael maybe: he is not using our jmf libs (which have
> little changes :slight_smile: ).
> But this is a good idea to register the formats in the newly created
> RTPManager I will change to that approach in sip-communicator.
> Thanks for the hint.
>
> damencho


#8

This is done in FMJ as follows:

              // SIP communicator packetizers/depacketizers.
              PlugInUtility.registerPlugIn("net.java.sip.communicator.impl.media.codec.audio.speex.JavaEncoder");
              PlugInUtility.registerPlugIn("net.java.sip.communicator.impl.media.codec.audio.speex.JavaDecoder");
              PlugInUtility.registerPlugIn("net.java.sip.communicator.impl.media.codec.audio.ilbc.JavaEncoder");
              PlugInUtility.registerPlugIn("net.java.sip.communicator.impl.media.codec.audio.ilbc.JavaDecoder");

The source for PlugInUtility is attached.

Ken

Koch Michael wrote:

PlugInUtility.java (3.03 KB)

···

Hello all!

Incidentally I've just today tried to do the same thing. The posting came
just at the right time for me.

I haven't been successful so far, unfortunately. Adding the format to the
RTP Manager is not all one has to do it seems. According to the SIP
Communicator log messages, the encoders/decoders for the custom formats are
not registered when I use the standard JMF. I guess they are already added
to the Registry of the custom JMF, so I'll have to add them to the standard
JMF registry by hand.

I won't have time to do this today, but will try tomorrow and keep you
informed.

This is my first post to the list, BTW. Thanks to all contributors for the
great work.

Regards
Michael Koch

Von: Emil Ivov [mailto:emcho@emcho.com] Gesendet: Mittwoch, 11. Juli 2007 13:43
An: dev@sip-communicator.dev.java.net
Betreff: Re: [sip-comm-dev] PlugInManager customCodecs missing

Hi Michael,

We're initializing all RTP Managers in here:

net.java.sip.communicator.impl.media.CallSessionImpl.initializ
eRtpManager()

You should be able to easily add what Ken suggested in this method.

Hope this helps
Emil

On 7/11/07, mik <rivael_il@yahoo.com> wrote:
    

Hello Ken and Damencho!

Thank you for your prompt response! I did need to use the
      

sip-communicator
    

JMF libs.
As I have spent 5 working days on this, you might want to alert the
unsuspecting programmer.

In case I do want to use the latest standard JMF libs, how
      

do I register the
    

plugins?
(
There are two calls to RTPManager.newInstance:

grep "RTPManager.newInstance"
./net/java/sip/communicator/impl/media/CallSessionImpl.java:

private RTPManager audioRtpManager = RTPManager.newInstance();
./net/java/sip/communicator/impl/media/CallSessionImpl.java:

private RTPManager videoRtpManager = RTPManager.newInstance();

)

Thanks again for your help,

Michael

Damian Minkov <damencho@damencho.com> wrote:
Hi Ken,

Ken Larson wrote:
      

From what I can tell, SC does not properly register the
        

formats with
    

the RTPManager. Here is some info that is similar to what
        

I recently
    

sent to Chris, who is working on RTP in SC.

Every time RTPManager.newInstance() is called, the
        

nonstandard formats
    

need to be resistered. ALAW/RTP, Speex/RTP, and ILBC/rtp are all
nonstandard.

I agree that ALAW/RTP, Speex/RTP, and ILBC/rtp are nonstandard and
missing in jmf. But I have changed
      

com.sun.media.rtp.FormatInfo and have
    

added them there - for example :
formatList[110] = new AudioFormat("speex/rtp", 8000D, -1, 1);

In answer to Michael maybe: he is not using our jmf libs (which have
little changes :slight_smile: ).
But this is a good idea to register the formats in the newly created
RTPManager I will change to that approach in sip-communicator.
Thanks for the hint.

damencho


#9

I haven't been successful so far, unfortunately. Adding the
format to the
RTP Manager is not all one has to do it seems. According to the SIP
Communicator log messages, the encoders/decoders for the
custom formats are
not registered when I use the standard JMF. I guess they are
already added
to the Registry of the custom JMF, so I'll have to add them
to the standard
JMF registry by hand.

Thanks for the reply, Ken!

I seem to have been jumping to conclusions too fast yesterday. As I just
found out, the custom codecs of SIP Communicator are registered in
MediaControl.registerCustomCodecs(). I now have to find out why
PlugInManager.addPlugIn returns false when the codecs should be registered.

My current guess is that the JMF doesn't find the codec classes, since I
have unbundled it from the media bundle (which contains the codecs) and
added it to the system classpath. I'll have to see if this is indeed the
case and if I can find a workaround which suits my needs.

Regards
Michael Koch


#10

I have finally succeeded in getting the custom codecs working with the
unmodified JMF. As Ken wrote, I had to register the custom formats with the
RTPManager instances. The trick was that, due to how the Sun JMF handles the
registration internally, this has to be done once before
MediaControl.initProcessor() creates the transmittableAudioEncodings list.
Otherwise, the list doesn't contain the custom encodings.

If you are interested, I can provide a patch.

Regards
Michael Koch