public interface MediaStream
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PNAME_LOCAL_SSRC
The name of the property which indicates whether the local SSRC is
currently available.
|
static java.lang.String |
PNAME_REMOTE_SSRC
The name of the property which indicates whether the remote SSRC is
currently available.
|
Modifier and Type | Method and Description |
---|---|
void |
addDynamicRTPPayloadType(byte rtpPayloadType,
MediaFormat format)
Adds a new association in this MediaStream of the specified RTP
payload type with the specified MediaFormat in order to allow it
to report rtpPayloadType in RTP flows sending and receiving
media in format.
|
void |
addDynamicRTPPayloadTypeOverride(byte originalPt,
byte overloadPt)
Adds an additional RTP payload mapping that will overriding one that
we've set with
addDynamicRTPPayloadType(byte, MediaFormat) . |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a property change listener to this stream so that it would be
notified upon property change events like for example an SSRC ID which
becomes known.
|
void |
addRTPExtension(byte extensionID,
RTPExtension rtpExtension)
Adds or updates an association in this MediaStream mapping the
specified extensionID to rtpExtension and enabling or
disabling its use according to the direction attribute of
rtpExtension.
|
void |
clearDynamicRTPPayloadTypes()
Clears the dynamic RTP payload type associations in this
MediaStream.
|
void |
clearRTPExtensions()
Clears the RTP header extension associations stored in this instance.
|
void |
close()
Releases the resources allocated by this instance in the course of its
execution and prepares it to be garbage collected.
|
java.util.Map<java.lang.Byte,RTPExtension> |
getActiveRTPExtensions()
Returns a map containing all currently active RTPExtensions in
use by this stream.
|
MediaDevice |
getDevice()
Gets the device that this stream uses to play back and capture media.
|
MediaDirection |
getDirection()
Gets the direction in which this MediaStream is allowed to
stream media.
|
byte |
getDynamicRTPPayloadType(java.lang.String codec)
Returns the payload type number that has been negotiated for the
specified encoding or -1 if no payload type has been
negotiated for it.
|
java.util.Map<java.lang.Byte,MediaFormat> |
getDynamicRTPPayloadTypes()
Gets the existing associations in this MediaStream of RTP
payload types to MediaFormats.
|
MediaFormat |
getFormat()
Returns the MediaFormat that this stream is currently
transmitting in.
|
MediaFormat |
getFormat(byte payloadType)
Returns the MediaFormat that is associated to the payload type
passed in as a parameter.
|
long |
getLocalSourceID()
Returns the synchronization source (SSRC) identifier of the local
participant or -1 if that identifier is not yet known at this
point.
|
MediaStreamStats2 |
getMediaStreamStats()
Returns a MediaStreamStats object used to get statistics about
this MediaStream.
|
MediaStreamTrackReceiver |
getMediaStreamTrackReceiver()
Gets the
MediaStreamTrackReceiver of this MediaStream . |
java.lang.String |
getName()
Returns the name of this stream or null if no name has been
set.
|
REDBlock |
getPrimaryREDBlock(ByteArrayBuffer baf)
Deprecated.
|
REDBlock |
getPrimaryREDBlock(RawPacket pkt)
Gets the primary
REDBlock that contains the payload of the RTP
packet passed in as a parameter. |
java.lang.Object |
getProperty(java.lang.String propertyName)
Gets the value of a specific opaque property of this
MediaStream.
|
java.net.InetSocketAddress |
getRemoteControlAddress()
Returns the address that this stream is sending RTCP traffic to.
|
java.net.InetSocketAddress |
getRemoteDataAddress()
Returns the address that this stream is sending RTP traffic to.
|
long |
getRemoteSourceID()
Gets the synchronization source (SSRC) identifier of the remote peer or
-1 if that identifier is not yet known at this point in the
execution.
|
java.util.List<java.lang.Long> |
getRemoteSourceIDs()
Gets the synchronization source (SSRC) identifiers of the remote peer.
|
RetransmissionRequester |
getRetransmissionRequester() |
RTPTranslator |
getRTPTranslator()
Gets the
RTPTranslator which forwards RTP and RTCP traffic
between this and other MediaStream s. |
SrtpControl |
getSrtpControl()
The ZrtpControl which controls the ZRTP for this stream.
|
StreamRTPManager |
getStreamRTPManager()
Gets the
StreamRTPManager which is to forward RTP and RTCP
traffic between this and other MediaStream s. |
MediaStreamTarget |
getTarget()
Returns the target of this MediaStream to which it is to send
and from which it is to receive data (e.g.
|
TransformEngineChain |
getTransformEngineChain()
Gets the
TransformEngineChain of this MediaStream . |
StreamConnector.Protocol |
getTransportProtocol()
Returns the transport protocol used by the streams.
|
void |
injectPacket(RawPacket pkt,
boolean data,
TransformEngine after)
Sends a given RTP or RTCP packet to the remote peer/side.
|
boolean |
isKeyFrame(byte[] buf,
int off,
int len)
Utility method that determines whether or not a packet is a key frame.
|
boolean |
isKeyFrame(RawPacket pkt)
Utility method that determines whether or not a packet is a key frame.
|
boolean |
isMute()
Determines whether this MediaStream is set to transmit "silence"
instead of the media being fed from its MediaDevice.
|
boolean |
isStarted()
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes the specified property change listener from this stream
so that it won't receive further property change events.
|
void |
removeReceiveStreamForSsrc(long ssrc)
Removes the ReceiveStream with SSRC ssrc, if there is
such a ReceiveStream, from the receive streams of this
MediaStream
|
void |
setConnector(StreamConnector connector)
Sets the StreamConnector to be used by this MediaStream
for sending and receiving media.
|
void |
setDevice(MediaDevice device)
Sets the device that this stream should use to play back and capture
media.
|
void |
setDirection(MediaDirection direction)
Sets the direction in which media in this MediaStream is to be
streamed.
|
void |
setExternalTransformer(TransformEngine transformEngine)
Sets the external (application-provided) TransformEngine of
this MediaStream.
|
void |
setFormat(MediaFormat format)
Sets the MediaFormat that this MediaStream should
transmit in.
|
void |
setMute(boolean mute)
Causes this MediaStream to stop transmitting the media being fed
from this stream's MediaDevice and transmit "silence" instead.
|
void |
setName(java.lang.String name)
Sets the name of this stream.
|
void |
setProperty(java.lang.String propertyName,
java.lang.Object value)
Sets the value of a specific opaque property of this
MediaStream.
|
void |
setRTPTranslator(RTPTranslator rtpTranslator)
Sets the RTPTranslator which is to forward RTP and RTCP traffic
between this and other MediaStreams.
|
void |
setSSRCFactory(SSRCFactory ssrcFactory)
Sets the SSRCFactory which is to generate new synchronization
source (SSRC) identifiers.
|
void |
setTarget(MediaStreamTarget target)
Sets the target of this MediaStream to which it is to send and
from which it is to receive data (e.g.
|
void |
setTransportCCEngine(TransportCCEngine engine)
Sets the
TransportCCEngine of this media stream. |
void |
start()
Starts capturing media from this stream's MediaDevice and then
streaming it through the local StreamConnector toward the
stream's target address and port.
|
void |
stop()
Stops all streaming and capturing in this MediaStream and closes
and releases all open/allocated devices/resources.
|
static final java.lang.String PNAME_LOCAL_SSRC
static final java.lang.String PNAME_REMOTE_SSRC
void addDynamicRTPPayloadType(byte rtpPayloadType, MediaFormat format)
rtpPayloadType
- the RTP payload type to be associated in this
MediaStream with the specified MediaFormatformat
- the MediaFormat to be associated in this
MediaStream with rtpPayloadTypevoid clearDynamicRTPPayloadTypes()
void addDynamicRTPPayloadTypeOverride(byte originalPt, byte overloadPt)
addDynamicRTPPayloadType(byte, MediaFormat)
.
This is necessary so that we can support the RFC3264 case where the
answerer has the right to declare what payload type mappings it wants to
receive RTP packets with even if they are different from those in the
offer. RFC3264 claims this is for support of legacy protocols such as
H.323 but we've been bumping with a number of cases where multi-component
pure SIP systems also need to behave this way.
originalPt
- the payload type that we are overridingoverloadPt
- the payload type that we are overriging it withvoid addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- the listener that we'd like to register for
PropertyChangeEventsvoid addRTPExtension(byte extensionID, RTPExtension rtpExtension)
extensionID
- the ID that is mapped to rtpExtension for
the lifetime of this MediaStream.rtpExtension
- the RTPExtension that we are mapping to
extensionID.void clearRTPExtensions()
void close()
java.util.Map<java.lang.Byte,RTPExtension> getActiveRTPExtensions()
MediaDevice getDevice()
MediaDirection getDirection()
java.util.Map<java.lang.Byte,MediaFormat> getDynamicRTPPayloadTypes()
addDynamicRTPPayloadType(byte, MediaFormat)
and not globally or
well-known associations reported by
MediaFormat.getRTPPayloadType()
.byte getDynamicRTPPayloadType(java.lang.String codec)
codec
- the encoding whose payload type we are trying to obtain.MediaFormat getFormat()
MediaFormat getFormat(byte payloadType)
payloadType
- the payload type of the MediaFormat to get.long getLocalSourceID()
MediaStreamStats2 getMediaStreamStats()
java.lang.String getName()
java.lang.Object getProperty(java.lang.String propertyName)
propertyName
- the name of the opaque property of this
MediaStream the value of which is to be returnedjava.net.InetSocketAddress getRemoteControlAddress()
java.net.InetSocketAddress getRemoteDataAddress()
long getRemoteSourceID()
Warning: A MediaStream may receive multiple RTP streams
and may thus have multiple remote SSRCs. Since it is not clear how this
MediaStream instance chooses which of the multiple remote SSRCs
to be returned by the method, it is advisable to always consider
getRemoteSourceIDs()
first.
java.util.List<java.lang.Long> getRemoteSourceIDs()
StreamRTPManager getStreamRTPManager()
StreamRTPManager
which is to forward RTP and RTCP
traffic between this and other MediaStream
s.StreamRTPManager
which is to forward RTP and RTCP
traffic between this and other MediaStream
sSrtpControl getSrtpControl()
MediaStreamTarget getTarget()
setTarget(MediaStreamTarget)
StreamConnector.Protocol getTransportProtocol()
boolean isMute()
boolean isStarted()
void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- the listener that we'd like to remove.void removeReceiveStreamForSsrc(long ssrc)
ssrc
- the SSRC for which to remove a ReceiveStreamvoid setConnector(StreamConnector connector)
connector
- the StreamConnector to be used by this
MediaStream for sending and receiving mediavoid setDevice(MediaDevice device)
device
- the MediaDevice that this stream should use to
play back and capture media.void setDirection(MediaDirection direction)
start()
later on will start it only in the specified
direction. If it is currently started in a direction different
than the specified, directions other than the specified will be stopped.direction
- the MediaDirection in which this
MediaStream is to stream media when it is startedvoid setFormat(MediaFormat format)
format
- the MediaFormat that this MediaStream
should transmit in.void setMute(boolean mute)
mute
- true if we are to start transmitting "silence" and
false if we are to use media from this stream's
MediaDevice again.void setName(java.lang.String name)
name
- the name of this stream or null if no name has been
set.void setProperty(java.lang.String propertyName, java.lang.Object value)
propertyName
- the name of the opaque property of this
MediaStream the value of which is to be set to the specified
valuevalue
- the value of the opaque property of this
MediaStream specified by propertyName to be setvoid setRTPTranslator(RTPTranslator rtpTranslator)
rtpTranslator
- the RTPTranslator which is to forward RTP
and RTCP traffic between this and other MediaStreamsRTPTranslator getRTPTranslator()
RTPTranslator
which forwards RTP and RTCP traffic
between this and other MediaStream
s.RTPTranslator
which forwards RTP and RTCP traffic
between this and other MediaStream
s or null
void setSSRCFactory(SSRCFactory ssrcFactory)
ssrcFactory
- the SSRCFactory which is to generate new
synchronization source (SSRC) identifiers or null if this
MediaStream is to employ internal logic to generate new
synchronization source (SSRC) identifiersvoid setTarget(MediaStreamTarget target)
target
- the MediaStreamTarget describing the data
(e.g. RTP) and the control data (e.g. RTCP) locations to which this
MediaStream is to send and from which it is to receivevoid start()
void stop()
void setExternalTransformer(TransformEngine transformEngine)
transformEngine
- the TransformerEngine to use.void injectPacket(RawPacket pkt, boolean data, TransformEngine after) throws TransmissionFailedException
pkt
- the packet to send.data
- true
to send an RTP packet or false
to send
an RTCP packet.after
- the TransformEngine
in the TransformEngine
chain of this MediaStream
after which the injection is to begin.
If the specified after
is not in the TransformEngine
chain of this MediaStream
, pkt
will be injected at the
beginning of the TransformEngine
chain of this
MediaStream
. Generally, the value of after
should be
null
unless the injection is being performed by a
TransformEngine
itself (while executing transform
or
reverseTransform
of a PacketTransformer
of its own even).TransmissionFailedException
- if the transmission failed.boolean isKeyFrame(byte[] buf, int off, int len)
buf
- the buffer that holds the RTP packet.off
- the offset in the buff where the RTP packet is found.len
- then length of the RTP packet in the buffer.boolean isKeyFrame(RawPacket pkt)
pkt
- the packet.@Deprecated REDBlock getPrimaryREDBlock(ByteArrayBuffer baf)
REDBlock
that contains the payload of the RTP
packet passed in as a parameter.baf
- the ByteArrayBuffer
that holds the RTP payload.REDBlock
that contains the payload of the RTP
packet passed in as a parameter, or null if the buffer is invalid.REDBlock getPrimaryREDBlock(RawPacket pkt)
REDBlock
that contains the payload of the RTP
packet passed in as a parameter.RetransmissionRequester getRetransmissionRequester()
RetransmissionRequester
for this media stream.TransformEngineChain getTransformEngineChain()
TransformEngineChain
of this MediaStream
.MediaStreamTrackReceiver getMediaStreamTrackReceiver()
MediaStreamTrackReceiver
of this MediaStream
.MediaStreamTrackReceiver
of this MediaStream
,
or null.void setTransportCCEngine(TransportCCEngine engine)
TransportCCEngine
of this media stream. Note that for
this to take effect it needs to be called early, before the transform
chain is initialized (i.e. before a connector is set).engine
- the engine to set.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.