public abstract class MediaStream extends java.lang.Object implements Stream
| Modifier and Type | Field and Description |
|---|---|
static byte |
MODE_MEDIACODEC_API
Raw audio/video will be encoded using the MediaCodec API with buffers.
|
static byte |
MODE_MEDIACODEC_API_2
Raw audio/video will be encoded using the MediaCode API with a surface.
|
static byte |
MODE_MEDIARECORDER_API
Raw audio/video will be encoded using the MediaRecorder API.
|
static byte |
PIPE_API_LS
A LocalSocket will be used to feed the MediaRecorder object
|
static byte |
PIPE_API_PFD
A ParcelFileDescriptor will be used to feed the MediaRecorder object
|
| Constructor and Description |
|---|
MediaStream() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure()
Configures the stream with the settings supplied with
VideoStream.setVideoQuality(net.majorkernelpanic.streaming.video.VideoQuality)
for a VideoStream and AudioStream.setAudioQuality(net.majorkernelpanic.streaming.audio.AudioQuality)
for a AudioStream. |
long |
getBitrate()
Returns an approximation of the bit rate consumed by the stream in bit per seconde.
|
int[] |
getDestinationPorts()
Returns a pair of destination ports, the first one is the
one used for RTP and the second one is used for RTCP.
|
int[] |
getLocalPorts()
Returns a pair of source ports, the first one is the
one used for RTP and the second one is used for RTCP.
|
AbstractPacketizer |
getPacketizer()
Returns the packetizer associated with the
MediaStream. |
abstract java.lang.String |
getSessionDescription()
Returns a description of the stream using SDP.
|
int |
getSSRC()
Returns the SSRC of the underlying
RtpSocket. |
byte |
getStreamingMethod()
Returns the streaming method in use, call this after
configure() to get an accurate response. |
boolean |
isStreaming()
Indicates if the
MediaStream is streaming. |
void |
setDestinationAddress(java.net.InetAddress dest)
Sets the destination IP address of the stream.
|
void |
setDestinationPorts(int dport)
Sets the destination ports of the stream.
|
void |
setDestinationPorts(int rtpPort,
int rtcpPort)
Sets the destination ports of the stream.
|
void |
setOutputStream(java.io.OutputStream stream,
byte channelIdentifier)
If a TCP is used as the transport protocol for the RTP session,
the output stream to which RTP packets will be written to must
be specified with this method.
|
void |
setStreamingMethod(byte mode)
Sets the streaming method that will be used.
|
void |
setTimeToLive(int ttl)
Sets the Time To Live of packets sent over the network.
|
void |
start()
Starts the stream.
|
void |
stop()
Stops the stream.
|
public static final byte MODE_MEDIARECORDER_API
public static final byte MODE_MEDIACODEC_API
public static final byte MODE_MEDIACODEC_API_2
public static final byte PIPE_API_LS
public static final byte PIPE_API_PFD
public void setDestinationAddress(java.net.InetAddress dest)
setDestinationAddress in interface Streamdest - The destination address of the streampublic void setDestinationPorts(int dport)
setDestinationPorts in interface Streamdport - The destination portpublic void setDestinationPorts(int rtpPort,
int rtcpPort)
setDestinationPorts in interface StreamrtpPort - Destination port that will be used for RTPrtcpPort - Destination port that will be used for RTCPpublic void setOutputStream(java.io.OutputStream stream,
byte channelIdentifier)
setOutputStream in interface Streampublic void setTimeToLive(int ttl)
throws java.io.IOException
setTimeToLive in interface Streamttl - The time to livejava.io.IOExceptionpublic int[] getDestinationPorts()
getDestinationPorts in interface Streampublic int[] getLocalPorts()
getLocalPorts in interface Streampublic void setStreamingMethod(byte mode)
MODE_MEDIARECORDER_API, raw audio/video will be encoded
using the MediaRecorder API. MODE_MEDIACODEC_API or to MODE_MEDIACODEC_API_2,
audio/video will be encoded with using the MediaCodec. MODE_MEDIACODEC_API_2 mode only concerns VideoStream, it makes
use of the createInputSurface() method of the MediaCodec API (Android 4.3 is needed there). mode - Can be MODE_MEDIARECORDER_API, MODE_MEDIACODEC_API or MODE_MEDIACODEC_API_2public byte getStreamingMethod()
configure() to get an accurate response.public AbstractPacketizer getPacketizer()
MediaStream.public long getBitrate()
getBitrate in interface Streampublic boolean isStreaming()
MediaStream is streaming.isStreaming in interface StreamMediaStream is streamingpublic void configure()
throws java.lang.IllegalStateException,
java.io.IOException
VideoStream.setVideoQuality(net.majorkernelpanic.streaming.video.VideoQuality)
for a VideoStream and AudioStream.setAudioQuality(net.majorkernelpanic.streaming.audio.AudioQuality)
for a AudioStream.public void start()
throws java.lang.IllegalStateException,
java.io.IOException
public abstract java.lang.String getSessionDescription()
Stream.configure().getSessionDescription in interface Streamjava.lang.IllegalStateException - Thrown when Stream.configure() was not called.