cgl.narada.samples.rtp
Class NaradaRTPConnector

java.lang.Object
  extended by cgl.narada.samples.rtp.NaradaRTPConnector
All Implemented Interfaces:
Handler, javax.media.rtp.RTPConnector

public class NaradaRTPConnector
extends Object
implements javax.media.rtp.RTPConnector, Handler

An implementation of RTPConnector based on Naradabrokering RTP support. In initialization phase, this might fail. because when we register this client we are sending the message with UDP If that message of the response of that message get lost, then this client will not initialize Therefore it will not work.


Field Summary
protected  String brokerURI
           
protected  int endPointID
           
protected  TransportHandler transportHandler
           
 
Constructor Summary
NaradaRTPConnector(String ip, int remotePort, int topicNumber)
           
 
Method Summary
 void close()
          Close all the RTP, RTCP streams.
 javax.media.protocol.PushSourceStream getControlInputStream()
          Returns an input stream to receive the RTCP data.
 javax.media.rtp.OutputDataStream getControlOutputStream()
          Returns an output stream to send the RTCP data.
 javax.media.protocol.PushSourceStream getDataInputStream()
          Returns an input stream to receive the RTP data.
 javax.media.rtp.OutputDataStream getDataOutputStream()
          Returns an output stream to send the RTP data.
 int getEndPointId()
          return the endPointId
 int getReceiveBufferSize()
          Get the receive buffer size set on the RTP data channel.
 double getRTCPBandwidthFraction()
          Return the RTCP bandwidth fraction.
 double getRTCPSenderBandwidthFraction()
          Return the RTCP sender bandwidth fraction.
 int getSendBufferSize()
          Get the send buffer size set on the RTP data channel.
 void handleData(byte[] data, String sender)
           
 boolean isClient()
          This method indicates that the node in question is a client
 void processNodeAddressResponse(String sender, byte[] addressResponse)
          this method will be invoked by handleData method, when a response is received for the request
 void propagateEventToBroker(int topic, byte[] data, int offset, int length)
          coverts the received data to a serialized RtpEvent object and passes it to the transportHandler
 void sendDataTo(byte[] data)
          send the given byte array
 void setReceiveBufferSize(int size)
          Set the receive buffer size of the RTP data channel.
 void setSendBufferSize(int size)
          Set the send buffer size of the RTP data channel.
 void subscribeTo(int topic)
          subscribe to a topic on the given node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transportHandler

protected TransportHandler transportHandler

endPointID

protected int endPointID

brokerURI

protected String brokerURI
Constructor Detail

NaradaRTPConnector

public NaradaRTPConnector(String ip,
                          int remotePort,
                          int topicNumber)
Method Detail

processNodeAddressResponse

public void processNodeAddressResponse(String sender,
                                       byte[] addressResponse)
this method will be invoked by handleData method, when a response is received for the request

Parameters:
sender -
addressResponse -

handleData

public void handleData(byte[] data,
                       String sender)
Specified by:
handleData in interface Handler
Parameters:
dataReceived - received data

isClient

public boolean isClient()
This method indicates that the node in question is a client

Specified by:
isClient in interface Handler

subscribeTo

public void subscribeTo(int topic)
subscribe to a topic on the given node.


sendDataTo

public void sendDataTo(byte[] data)
send the given byte array


propagateEventToBroker

public void propagateEventToBroker(int topic,
                                   byte[] data,
                                   int offset,
                                   int length)
coverts the received data to a serialized RtpEvent object and passes it to the transportHandler


getEndPointId

public int getEndPointId()
return the endPointId


getDataInputStream

public javax.media.protocol.PushSourceStream getDataInputStream()
Returns an input stream to receive the RTP data.

Specified by:
getDataInputStream in interface javax.media.rtp.RTPConnector

getDataOutputStream

public javax.media.rtp.OutputDataStream getDataOutputStream()
Returns an output stream to send the RTP data.

Specified by:
getDataOutputStream in interface javax.media.rtp.RTPConnector

getControlInputStream

public javax.media.protocol.PushSourceStream getControlInputStream()
Returns an input stream to receive the RTCP data.

Specified by:
getControlInputStream in interface javax.media.rtp.RTPConnector

getControlOutputStream

public javax.media.rtp.OutputDataStream getControlOutputStream()
Returns an output stream to send the RTCP data.

Specified by:
getControlOutputStream in interface javax.media.rtp.RTPConnector

close

public void close()
Close all the RTP, RTCP streams.

Specified by:
close in interface javax.media.rtp.RTPConnector

setReceiveBufferSize

public void setReceiveBufferSize(int size)
                          throws IOException
Set the receive buffer size of the RTP data channel. This is only a hint to the implementation. The actual implementation may not be able to do anything to this.

Specified by:
setReceiveBufferSize in interface javax.media.rtp.RTPConnector
Throws:
IOException

getReceiveBufferSize

public int getReceiveBufferSize()
Get the receive buffer size set on the RTP data channel. Return -1 if the receive buffer size is not applicable for the implementation.

Specified by:
getReceiveBufferSize in interface javax.media.rtp.RTPConnector

setSendBufferSize

public void setSendBufferSize(int size)
                       throws IOException
Set the send buffer size of the RTP data channel. This is only a hint to the implementation. The actual implementation may not be able to do anything to this.

Specified by:
setSendBufferSize in interface javax.media.rtp.RTPConnector
Throws:
IOException

getSendBufferSize

public int getSendBufferSize()
Get the send buffer size set on the RTP data channel. Return -1 if the send buffer size is not applicable for the implementation.

Specified by:
getSendBufferSize in interface javax.media.rtp.RTPConnector

getRTCPBandwidthFraction

public double getRTCPBandwidthFraction()
Return the RTCP bandwidth fraction. This value is used to initialize the RTPManager. Check RTPManager for more detauls. Return -1 to use the default values.

Specified by:
getRTCPBandwidthFraction in interface javax.media.rtp.RTPConnector

getRTCPSenderBandwidthFraction

public double getRTCPSenderBandwidthFraction()
Return the RTCP sender bandwidth fraction. This value is used to initialize the RTPManager. Check RTPManager for more detauls. Return -1 to use the default values.

Specified by:
getRTCPSenderBandwidthFraction in interface javax.media.rtp.RTPConnector


For comments and suggestions please send e-mail to The NaradaBrokering Project