public class AudioStreamer extends java.lang.Object implements MediaStreamer, RtpStreamSenderListener, RtpStreamReceiverListener
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_BIG_ENDIAN
By default whether using big-endian rule for byte ordering
|
static int |
DEFAULT_CHANNELS
Default number of audio channels (1 for mono, 2 for stereo)
|
static java.lang.String |
DEFAULT_CODEC_NAME
Default codec
|
static int |
DEFAULT_FRAME_RATE
Default codec frame rate [frame/sec]
|
static int |
DEFAULT_FRAME_SIZE
Default codec frame size [byte]
|
static int |
DEFAULT_PACKET_TIME
Default inter-packet time [millisecs]
|
static int |
DEFAULT_PAYLOAD_TYPE
Default payload type
|
static int |
DEFAULT_SAMPLE_RATE
Default sample rate [sample/sec]
|
static boolean |
DEFAULT_SYMMETRIC_RTP
Whether using symmetric RTP by default
|
static int |
INTERNAL_BUFFER_SIZE
Internal buffer size.
|
static boolean |
RTP_BANDWIDTH_EFFICIENT_MODE
Whether using RTP payload format in Bandwidth-Efficient Mode
|
protected RtpStreamReceiver |
rtp_receiver
RtpStreamReceiver
|
protected RtpStreamSender |
rtp_sender
RtpStreamSender
|
static boolean |
SEQUENCE_CHECK
Whether discarding out-of-sequence and duplicated packets
|
static boolean |
SILENCE_PADDING
Whether filling silence intervals with (silence-equivalent) void data
|
static java.lang.String |
TONE
Test tone
|
static double |
TONE_AMPL
Test tone amplitude (from 0.0 to 1.0)
|
static int |
TONE_FREQ
Test tone frequency [Hz]
|
static int |
TONE_SAMPLE_SIZE
Test tone sample size [bits]
|
static int |
UNKNOWN_PAYLOAD_TYPE
Unknown payload type
|
static boolean |
VERBOSE_DEBUG
Verbose debug mode
|
Constructor and Description |
---|
AudioStreamer(FlowSpec flow_spec,
java.lang.String audiofile_in,
java.lang.String audiofile_out,
boolean direct_convertion,
Codec additional_encoding,
boolean do_sync,
int random_early_drop,
boolean symmetric_rtp,
boolean rtcp,
Logger logger)
Creates a new audio streamer.
|
AudioStreamer(FlowSpec flow_spec,
java.lang.String audiofile_in,
java.lang.String audiofile_out,
boolean direct_convertion,
Codec additional_encoding,
boolean do_sync,
int random_early_drop,
boolean symmetric_rtp,
Logger logger)
Creates a new audio streamer.
|
AudioStreamer(RtpStreamSender rtp_sender,
RtpStreamReceiver rtp_receiver,
boolean symmetric_rtp,
Logger logger)
Creates a new audio streamer.
|
Modifier and Type | Method and Description |
---|---|
boolean |
halt()
Stops media streams.
|
boolean |
isSymmetricRtp()
whether symmetric RTP mode is set.
|
protected void |
log(LogLevel level,
java.lang.Exception e)
Adds the Exception message to the default Log
|
protected void |
log(LogLevel level,
java.lang.String str)
Adds a new string to the default Log
|
protected void |
log(java.lang.String str)
Adds a new string to the default Log
|
void |
onRemoteSoAddressChanged(RtpStreamReceiver rr,
SocketAddress remote_soaddr)
From RtpStreamReceiverListener.
|
void |
onRtpStreamReceiverTerminated(RtpStreamReceiver rr,
java.lang.Exception error)
From RtpStreamReceiverListener.
|
void |
onRtpStreamSenderTerminated(RtpStreamSender rs,
java.lang.Exception error)
From RtpStreamSenderListener.
|
protected static void |
println(java.lang.String str)
Prints a new string message.
|
void |
setRED(int random_early_drop)
Sets the receiver packet random early drop (RED) value; if greater than 0, it is the inverse of the packet drop rate.
|
void |
setSymmetricRtp(boolean symmetric_rtp)
Sets symmetric RTP mode.
|
void |
setSyncAdj(long sync_adj)
Sets the synchronization adjustment time (in milliseconds).
|
boolean |
start()
Starts media streams.
|
public static boolean VERBOSE_DEBUG
public static final int INTERNAL_BUFFER_SIZE
public static boolean RTP_BANDWIDTH_EFFICIENT_MODE
public static final boolean DEFAULT_SYMMETRIC_RTP
public static boolean SEQUENCE_CHECK
public static boolean SILENCE_PADDING
public static final int UNKNOWN_PAYLOAD_TYPE
public static final java.lang.String DEFAULT_CODEC_NAME
public static final int DEFAULT_PAYLOAD_TYPE
public static final int DEFAULT_SAMPLE_RATE
public static final int DEFAULT_CHANNELS
public static final int DEFAULT_FRAME_SIZE
public static final int DEFAULT_FRAME_RATE
public static final int DEFAULT_PACKET_TIME
public static final boolean DEFAULT_BIG_ENDIAN
public static final java.lang.String TONE
public static int TONE_FREQ
public static double TONE_AMPL
public static int TONE_SAMPLE_SIZE
protected RtpStreamSender rtp_sender
protected RtpStreamReceiver rtp_receiver
public AudioStreamer(RtpStreamSender rtp_sender, RtpStreamReceiver rtp_receiver, boolean symmetric_rtp, Logger logger)
public AudioStreamer(FlowSpec flow_spec, java.lang.String audiofile_in, java.lang.String audiofile_out, boolean direct_convertion, Codec additional_encoding, boolean do_sync, int random_early_drop, boolean symmetric_rtp, Logger logger)
flow_spec
- the flow specificationdirect_convertion
- whether using explicit external converter (i.e. direct access to an external conversion provider)
instead of that provided by javax.sound.sampled.spi.
It applies only when javax sound is used, that is when no other audio streamers (such as jmf or rat) are usedadditional_encoding
- additional audio encoder/decoder (optional)do_sync
- whether enforcing time synchronization to RTP source stream.
If synchronization is explicitly performed, the departure time of each RTP packet is equal to its nominal time.
Note that when using audio capturing, synchronization with the sample rate
is implicitly performed by the audio capture device and frames are read at constant bit rate.
However, an explicit re-synchronization is suggested
in order to let the read() method be non-blocking (in the other case
the UA audio performance seems decreasingrandom_early_drop
- receiver random early drop (RED) rate.
Actually it is the inverse of packet drop rate.
It can used to prevent long play back delay.
A value less or equal to 0 means that no packet dropping is explicitly
performed at the RTP receiversymmetric_rtp
- whether using symmetric_rtplogger
- a logger for recording log messages (or null)public AudioStreamer(FlowSpec flow_spec, java.lang.String audiofile_in, java.lang.String audiofile_out, boolean direct_convertion, Codec additional_encoding, boolean do_sync, int random_early_drop, boolean symmetric_rtp, boolean rtcp, Logger logger)
flow_spec
- the flow specificationdirect_convertion
- whether using explicit external converter (i.e. direct access to an external conversion provider)
instead of that provided by javax.sound.sampled.spi.
It applies only when javax sound is used, that is when no other audio streamers (such as jmf or rat) are usedadditional_encoding
- additional audio encoder/decoder (optional)do_sync
- whether enforcing time synchronization to RTP source stream.
If synchronization is explicitly performed, the departure time of each RTP packet is equal to its nominal time.
Note that when using audio capturing, synchronization with the sample rate
is implicitly performed by the audio capture device and frames are read at constant bit rate.
However, an explicit re-synchronization is suggested
in order to let the read() method be non-blocking (in the other case
the UA audio performance seems decreasingrandom_early_drop
- receiver random early drop (RED) rate.
Actually it is the inverse of packet drop rate.
It can used to prevent long play back delay.
A value less or equal to 0 means that no packet dropping is explicitly
performed at the RTP receiversymmetric_rtp
- whether using symmetric_rtprtcp
- whether using rtcplogger
- a logger for recording log messages (or null)public boolean start()
start
in interface MediaStreamer
public boolean halt()
halt
in interface MediaStreamer
public void setSymmetricRtp(boolean symmetric_rtp)
public boolean isSymmetricRtp()
public void onRemoteSoAddressChanged(RtpStreamReceiver rr, SocketAddress remote_soaddr)
onRemoteSoAddressChanged
in interface RtpStreamReceiverListener
public void onRtpStreamReceiverTerminated(RtpStreamReceiver rr, java.lang.Exception error)
onRtpStreamReceiverTerminated
in interface RtpStreamReceiverListener
public void onRtpStreamSenderTerminated(RtpStreamSender rs, java.lang.Exception error)
onRtpStreamSenderTerminated
in interface RtpStreamSenderListener
public void setSyncAdj(long sync_adj)
sync_adj
- the difference between the actual inter-packet sending time respect to the nominal value (in milliseconds).public void setRED(int random_early_drop)
random_early_drop
- the number of packets that separates two drops at receiver; a value of 0 means no drop.protected void log(java.lang.String str)
protected void log(LogLevel level, java.lang.String str)
protected void log(LogLevel level, java.lang.Exception e)
protected static void println(java.lang.String str)