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 .....

