public class RtpSender
extends java.lang.Object
RTP packets are sent according to a given RTP context that specifies the SSRC and payload type of the flow and maintains the sequence number and timestamp information.
Constructor and Description |
---|
RtpSender(int pt,
UdpSocket src_socket,
SocketAddress dest_soaddr)
Creates a new RtpSender.
|
RtpSender(RtpContext rtp_context,
UdpSocket src_socket,
SocketAddress dest_soaddr)
Creates a new RtpSender.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this RTP sender.
|
int |
getLocalPort()
Gets the local port.
|
long |
getOctectCounter()
Gets the total number of sent octects.
|
long |
getPacketCounter()
Gets the total number of sent packets.
|
SocketAddress |
getRemoteSoAddress()
Gets the remote socket address.
|
long |
getRtpTimestamp()
Gets the current RTP timestamp value.
|
long |
getSSRC()
Gets the synchronization source (SSRC) identifier.
|
void |
incTimestamp(long delta_timestamp)
Increments the sequence number.
|
void |
send(byte[] buf,
int off,
int len,
long packet_time)
Sends a new RTP packet.
|
void |
send(byte[] data,
long packet_time)
Sends a new RTP packet.
|
void |
send(RtpPacket rtp_packet,
long packet_time)
Sends a new RTP packet.
|
void |
setRemoteSoAddress(SocketAddress remote_soaddr)
Changes the remote socket address.
|
void |
setTimestamp(long timestamp)
Sets the timestamp.
|
public RtpSender(int pt, UdpSocket src_socket, SocketAddress dest_soaddr)
pt
- payload typesrc_socket
- the local UDP socket used for sending the RTP packetsdest_soaddr
- the destination socket addresspublic RtpSender(RtpContext rtp_context, UdpSocket src_socket, SocketAddress dest_soaddr)
rtp_context
- the RTP contextsrc_socket
- the local UDP socket used for sending the RTP packetsdest_soaddr
- the destination socket addresspublic int getLocalPort()
public void setRemoteSoAddress(SocketAddress remote_soaddr)
public SocketAddress getRemoteSoAddress()
public long getSSRC()
public long getRtpTimestamp()
public void setTimestamp(long timestamp)
timestamp
- RTP timestamppublic void incTimestamp(long delta_timestamp)
delta_timestamp
- the time lapse from the previous timestamp (in sampling periods)public long getPacketCounter()
public long getOctectCounter()
public void send(byte[] data, long packet_time) throws java.io.IOException
data
- payload datapacket_time
- the normalized packet time (in sampling periods) used to increment the next timestampjava.io.IOException
public void send(byte[] buf, int off, int len, long packet_time) throws java.io.IOException
buf
- payload bufferoff
- payload offsetlen
- payload lengthpacket_time
- the normalized packet time (in sampling periods) used to calculate the next timestampjava.io.IOException
public void send(RtpPacket rtp_packet, long packet_time) throws java.io.IOException
rtp_packet
- the RTP packetpacket_time
- the normalized packet time (in sampling periods) used to calculate the next timestampjava.io.IOException
public void close()