How to clone a received RTP Stream

Hello Friends ...

Can any one help me how to clone a received RTP stream ?

In my project i need to record the received RTP stream , play and store it in a media file simultaneously ....

its more like call recording ...

I capture the stream and create a realized processor and from the out put of the processor i get the data source and cloned it ....

Here is my code :

stream = ( (NewReceiveStreamEvent) evt).getReceiveStream();

DataSource ds = stream.getDataSource();

ProcessorModel pmreceive = new ProcessorModel(ds, new javax.media.Format[] { new AudioFormat(AudioFormat.ULAW_RTP) }, new ContentDescriptor(ContentDescriptor.RAW_RTP));

try

{

sourceProcessor = Manager.createRealizedProcessor(pmreceive);

}

catch (NoProcessorException ex)

{

logger.debug("NoProcessorException : "+ex);

}

catch (CannotRealizeException ex)

{

logger.debug("CannotRealizeException : "+ex);

}

catch (java.io.IOException ex)

{

logger.debug("java.io.IOException : "+ex);

}

DataSource ds1 = Manager.createCloneableDataSource(sourceProcessor.getDataOutput());

DataSource ds2 = ((SourceCloneable)ds1).createClone();

try

{

MediaLocator dest1 = new MediaLocator("file:D:/Recording/rec.au");

sink1 = Manager.createDataSink(ds2,dest1);

sink1.open();

sink1.start();

}

catch (NoDataSinkException ex)

{

logger.debug("NoDataSinkException : "+ex);

}

catch (java.lang.SecurityException ex)

{

logger.debug("java.lang.SecurityException : "+ex);

}

catch (java.io.IOException ex)

{

logger.debug("java.io.IOException for sink : "+ex);

}

sourceProcessor.start();

// Find out the formats.

RTPControl ctl = (RTPControl) ds1.getControl(

"javax.media.rtp.RTPControl");

if (logger.isDebugEnabled())

{

if (ctl != null)

{

logger.debug("Received new RTP stream: "

+ ctl.getFormat());

}

else

{

logger.debug("Received new RTP stream");

}

}

Player player = Manager.createPlayer(ds1);

player.addControllerListener(this);

player.realize();

players.add(player);

}

catch (Exception e)

{

logger.error("NewReceiveStreamEvent exception ", e);

return;

}

}

I pass the Cloneable data source to the player and the cloned data source to the datasink ...

I get errors like ....

NoDataSinkException : javax.media.NoDataSinkException: Cannot find a DataSink for: com.ibm.media.protocol.SuperCloneableDataSource$PushBufferDataSourceSlave

and

javax.media.NoPlayerException: Cannot find a Player for: com.ibm.media.protocol.CloneablePushBufferDataSource

Is any one can find the mistake i made in this coding ?

Please do help me .....

[2952 byte] By [madhu84a] at [2007-11-27 9:08:02]
# 1
Please help me :(Its really very urgent ..... please .....
madhu84a at 2007-7-12 21:45:32 > top of Java-index,Security,Cryptography...
# 2

Is there no one to help me ?

Please any one can tel me how to create and realize a processor for the received rtp stream ?

The received rtp stream is an ULAW/rtp stream ...

I tried to do so but it throws exception ...

I processed the rtp stream and gave the processor.getDataOut() to the player and it throws error ... Here is my sample code ... Can any one tell me wat is the error in it .....?

if (evt instanceof NewReceiveStreamEvent)

{

try

{

stream = ( (NewReceiveStreamEvent) evt).getReceiveStream();

ProcessorModel pm=new ProcessorModel(stream.getDataSource(),new javax.media.Format[]{format},descriptor);

Processor proc = Manager.createRealizedProcessor(pm);

proc.configure();

while (proc.getState() < Processor.Configured);

proc.start();

stream.getDataSource().start();

Player player = Manager.createPlayer(proc.getDataOutput());

player.addControllerListener(this);

player.realize();

players.add(player);

}

catch (Exception e)

{

logger.error("NewReceiveStreamEvent exception ", e);

return;

}

}

The error i get is ....

NewReceiveStreamEvent exception

javax.media.NoPlayerException: Cannot find a Player for: com.sun.media.multiplexer.BasicMux$BasicMuxDataSource@1f82253

at javax.media.Manager.createPlayerForSource(Manager.java:1512)

at javax.media.Manager.createPlayer(Manager.java:500)

at net.java.sip.communicator.impl.media.CallSessionImpl.update(CallSessionImpl.java:1489)

at com.sun.media.rtp.RTPEventHandler.processEvent(RTPEventHandler.java:62)

at com.sun.media.rtp.RTPEventHandler.dispatchEvents(RTPEventHandler.java:96)

at com.sun.media.rtp.RTPEventHandler.run(RTPEventHandler.java:115)

madhu84a at 2007-7-12 21:45:32 > top of Java-index,Security,Cryptography...
# 3
Hi madhu48I think the problem is either because the format of the media file is not supported by JMF Processor/Player or due to cocorruptted bit of the stream.try to use an mpeg fileif it doesn't work, then you may share your complete program cheers :)
LLLa at 2007-7-12 21:45:32 > top of Java-index,Security,Cryptography...