[sip-comm-dev] MediaControl.crateDataSourceFoEncodings & CallSessionImpl.update


#1

Hi,

I find the sip-communicator project tobe interesting, despite a couple of immediate challenges that I am trying to resolve. In particular, I would appreciate it if you could provide me guidelines/sample code for resolving the following two challenges:

Question #1:
How do I insert specific effect (TAMEffect) as a first codec in the
codecChain on the outgoing stream?

Description:
The codec chain on the outgoing audio stream is the following (is this
correct?):
  1. Microphone(LINEAR, 8000, 16, 1) ->ALAW
  2. ALAW ->ALAW/rtp

In function MediaControl.crateDataSourceFoEncodings(...) outgoing
tracks are extracted and
the above transcoding formats are set on them. We need to insert our
TAMEffect as a first
codec (effect) before the existing codecChain to achieve the folowing
chain of codecs.
  1. Microphone(LINEAR, 8000, 16, 1) -> (LINEAR, 8000, 16, 1) [realized by
our custom effect TAMEffect]
  2. (LINEAR, 8000, 16, 1) ->ALAW
  3. ALAW ->ALAW/rtp

The problem with my current solutionis that
although my last codec is the ALAW Packetizer
the negotiation process gives an mpegaudio/rtp as an outgoing format
instead of the expected ALAW/rtp. Why?

Question 2.
................................................................................
....................................................................
How does an effect use incoming datastream packets on the outgoing
stream to process the outgoing
data using the incoming data? How do I write such effects (codecs)? Is
that possible to do in a synchronized
manner with 10ms segments?

Description:
The codec chain on the incoming audio stream is the following (is this
correct?):
  1. ALAW/rtp ->ALAW
  2. ALAW -> Speaker(LINEAR, 8000, 16, 1)

As it is in my CallSessionImpl.update(ReceiveStreamEvent ...) we can
utilize a new processor at the end of the
codec chain and apply a filter (effect) using
            Codec codec[] = {new
TestEffect()};
            tracks[i].setCodecChain(codec);
So the final codec chain is changed this way to:
  1. ALAW/rtp ->ALAW
  2. ALAW -> (LINEAR, 8000, 16, 1)
  3. (LINEAR, 8000, 16, 1) -> Speaker(LINEAR, 8000, 16, 1) [realized by
our custom TestEffect]

This works with some test effects...
..but we need to extract 10ms of just incoming buffers and use this
buffer inside the effect that is working
on the outgoing stream (as it's first codec element, like described in
Question 1. We need this to provide
echo-cancelling this way.

Thanks,
mariesa

···

_________________________________________________________________
More photos, more messages, more storage�get 2GB with Windows Live Hotmail. http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_2G_0507

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


#2

Gus Samba wrote:

Hi,

I find the sip-communicator project tobe interesting, despite a couple of immediate challenges that I am trying to resolve. In particular, I would appreciate it if you could provide me guidelines/sample code for resolving the following two challenges:

Question #1:
How do I insert specific effect (TAMEffect) as a first codec in the
codecChain on the outgoing stream?

Description:
The codec chain on the outgoing audio stream is the following (is this
correct?):
    1. Microphone(LINEAR, 8000, 16, 1) ->ALAW
    2. ALAW ->ALAW/rtp

In function MediaControl.crateDataSourceFoEncodings(...) outgoing
tracks are extracted and
the above transcoding formats are set on them. We need to insert our
TAMEffect as a first
codec (effect) before the existing codecChain to achieve the folowing
chain of codecs.
    1. Microphone(LINEAR, 8000, 16, 1) -> (LINEAR, 8000, 16, 1) [realized by
our custom effect TAMEffect]
    2. (LINEAR, 8000, 16, 1) ->ALAW
    3. ALAW ->ALAW/rtp

The problem with my current solutionis that
although my last codec is the ALAW Packetizer
the negotiation process gives an mpegaudio/rtp as an outgoing format
instead of the expected ALAW/rtp. Why?

I think this must be done by adding custom effect (its added almost the same way as the existing speex codec is added)
Take a look at the example gain effect plug-in :
http://java.sun.com/products/java-media/jmf/2.1.1/guide/JMFExtending.html
this example takes as input LINEAR and output LINEAR so JMF must put it in front every codec before encoding.

Question 2.
................................................................................

....................................................................
How does an effect use incoming datastream packets on the outgoing
stream to process the outgoing
data using the incoming data? How do I write such effects (codecs)? Is
that possible to do in a synchronized
manner with 10ms segments?

Description:
The codec chain on the incoming audio stream is the following (is this
correct?):
    1. ALAW/rtp ->ALAW
    2. ALAW -> Speaker(LINEAR, 8000, 16, 1)

As it is in my CallSessionImpl.update(ReceiveStreamEvent ...) we can
utilize a new processor at the end of the
codec chain and apply a filter (effect) using
                        Codec codec[] = {new
TestEffect()};
                        tracks[i].setCodecChain(codec);
So the final codec chain is changed this way to:
    1. ALAW/rtp ->ALAW
    2. ALAW -> (LINEAR, 8000, 16, 1)
    3. (LINEAR, 8000, 16, 1) -> Speaker(LINEAR, 8000, 16, 1) [realized by
our custom TestEffect]

This works with some test effects...
..but we need to extract 10ms of just incoming buffers and use this
buffer inside the effect that is working
on the outgoing stream (as it's first codec element, like described in
Question 1. We need this to provide
echo-cancelling this way.

Every Codec/Effect process method return status of the processing. Can this be achieved by
as extracting 10ms process then put them in the output buffer, move the offset of the output buffer, move the offset of the input buffer
and return status : BUFFER_PROCESSED_OK | INPUT_BUFFER_NOT_CONSUMED;
So this method will be called again with the same input and output so you can extract the next 10ms. And this continues till the whole input buffer is consumed
and then just return BUFFER_PROCESSED_OK so you can move to the next input.

Is this ok ?

damencho

···

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