public class MediaStreamImpl extends AbstractMediaStream implements javax.media.rtp.ReceiveStreamListener, javax.media.rtp.SendStreamListener, javax.media.rtp.SessionListener, javax.media.rtp.RemoteListener
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
PROPERTY_NAME_RECEIVE_BUFFER_LENGTH
The name of the property indicating the length of our receive buffer.
|
protected boolean |
sendStreamsAreCreated
The indicator which determines whether
createSendStreams() has
been executed for rtpManager . |
rtpTranslator
PNAME_LOCAL_SSRC, PNAME_REMOTE_SSRC
Constructor and Description |
---|
MediaStreamImpl(MediaDevice device,
SrtpControl srtpControl)
Initializes a new MediaStreamImpl instance which will use the
specified MediaDevice for both capture and playback of media.
|
MediaStreamImpl(StreamConnector connector,
MediaDevice device,
SrtpControl srtpControl)
Initializes a new MediaStreamImpl instance which will use the
specified MediaDevice for both capture and playback of media
exchanged via the specified StreamConnector.
|
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) . |
protected void |
addRemoteSourceID(long remoteSourceID)
Sets the remote SSRC identifier and fires the corresponding
PropertyChangeEvent.
|
void |
addRTPExtension(byte extensionID,
RTPExtension rtpExtension)
Maps or updates the mapping between extensionID and
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.
|
protected void |
configureDataInputStream(RTPConnectorInputStream<?> dataInputStream)
Performs any optional configuration on a specific
RTPConnectorInputStream of an RTPManager to be used by
this MediaStreamImpl.
|
protected void |
configureDataOutputStream(RTPConnectorOutputStream dataOutputStream)
Performs any optional configuration on a specific
RTPConnectorOuputStream of an RTPManager to be used by
this MediaStreamImpl.
|
protected void |
configureRTPManagerBufferControl(StreamRTPManager rtpManager,
javax.media.control.BufferControl bufferControl)
Performs any optional configuration on the BufferControl of the
specified RTPManager which is to be used as the
RTPManager of this MediaStreamImpl.
|
protected AbsSendTimeEngine |
createAbsSendTimeEngine()
Creates the
AbsSendTimeEngine for this MediaStream . |
protected CachingTransformer |
createCachingTransformer()
Creates the
CachingTransformer for this MediaStream . |
protected DiscardTransformEngine |
createDiscardEngine()
Creates the
DiscardTransformEngine for this stream. |
protected DtmfTransformEngine |
createDtmfTransformEngine()
A stub that allows audio oriented streams to create and keep a reference
to a DtmfTransformEngine.
|
protected RetransmissionRequesterImpl |
createRetransmissionRequester()
Creates the
RetransmissionRequesterImpl for this
MediaStream . |
protected void |
createSendStreams()
Creates new SendStream instances for the streams of
deviceSession through rtpManager . |
protected SsrcTransformEngine |
createSsrcTransformEngine() |
protected void |
deviceSessionChanged(MediaDeviceSession oldValue,
MediaDeviceSession newValue)
Notifies this MediaStream that the MediaDevice (and
respectively the MediaDeviceSession with it) which this instance
uses for capture and playback of media has been changed.
|
byte |
getActiveRTPExtensionID(RTPExtension rtpExtension)
Returns the ID currently assigned to a specific RTP extension.
|
java.util.Map<java.lang.Byte,RTPExtension> |
getActiveRTPExtensions()
Returns a map containing all currently active RTPExtensions in
use by this stream.
|
CachingTransformer |
getCachingTransformer()
Gets the
CachingTransformer which (optionally) caches outgoing
packets for this MediaStreamImpl , if it exists. |
protected CsrcTransformEngine |
getCsrcEngine()
Returns the engine that is responsible for adding the list of CSRC
identifiers to outgoing RTP packets during a conference.
|
AbstractMediaDevice |
getDevice()
Gets the MediaDevice that this stream uses to play back and
capture media.
|
MediaDeviceSession |
getDeviceSession()
Gets the MediaDeviceSession which represents the work of this
MediaStream with its associated MediaDevice.
|
DiagnosticContext |
getDiagnosticContext()
Gets the
DiagnosticContext of this instance. |
MediaDirection |
getDirection()
Gets the direction in which this MediaStream is allowed to
stream media.
|
byte |
getDynamicRTPPayloadType(java.lang.String encoding)
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.
|
protected TransformEngineWrapper<FECTransformEngine> |
getFecTransformEngine()
Creates the FECTransformEngine for this MediaStream.
|
MediaFormat |
getFormat()
Gets the MediaFormat that this stream is currently transmitting
in.
|
MediaFormat |
getFormat(byte pt)
Returns the MediaFormat that is associated to the payload type
passed in as a parameter.
|
long[] |
getLocalContributingSourceIDs()
Returns the list of CSRC identifiers for all parties currently known
to contribute to the media that this stream is sending toward its remote
counter part.
|
java.net.InetSocketAddress |
getLocalControlAddress()
Gets the local address that this stream is sending RTCP traffic from.
|
java.net.InetSocketAddress |
getLocalDataAddress()
Gets the local address that this stream is sending RTP traffic from.
|
long |
getLocalSourceID()
Gets the synchronization source (SSRC) identifier of the local peer or
-1 if it is not yet known.
|
MediaStreamStats2Impl |
getMediaStreamStats()
Returns the statistical information gathered about this
MediaStream.
|
MediaType |
getMediaType()
Gets the MediaType of this MediaStream.
|
protected PaddingTermination |
getPaddingTermination()
Gets the
PaddingTermination for this MediaStreamImpl . |
REDBlock |
getPrimaryREDBlock(ByteArrayBuffer baf)
Gets the primary
REDBlock that contains the payload of the RTP
packet passed in as a parameter. |
REDBlock |
getPrimaryREDBlock(RawPacket pkt)
Gets the
REDBlock that contains the payload of the packet passed
in as a parameter. |
protected int |
getPriority()
Used to set the priority of the receive/send streams.
|
javax.media.rtp.ReceiveStream |
getReceiveStream(int ssrc)
Gets a ReceiveStream which this instance plays back on its
associated MediaDevice and which has a specific synchronization
source identifier (SSRC).
|
java.util.Collection<javax.media.rtp.ReceiveStream> |
getReceiveStreams()
Gets a list of the ReceiveStreams this instance plays back on
its associated MediaDevice.
|
protected REDTransformEngine |
getRedTransformEngine()
Creates the REDTransformEngine for this MediaStream.
|
RemoteBitrateEstimatorWrapper |
getRemoteBitrateEstimator()
Gets the RemoteBitrateEstimator of this
VideoMediaStream.
|
long[] |
getRemoteContributingSourceIDs()
Returns the List of CSRC identifiers representing the parties
contributing to the stream that we are receiving from this
MediaStream's remote party.
|
java.net.InetSocketAddress |
getRemoteControlAddress()
Gets the address that this stream is sending RTCP traffic to.
|
java.net.InetSocketAddress |
getRemoteDataAddress()
Gets 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() |
protected TransformEngine |
getRTCPTermination()
Gets the RTCP termination for this
MediaStreamImpl . |
protected AbstractRTPConnector |
getRTPConnector()
Gets the RTPConnector through which this instance sends and
receives RTP and RTCP traffic.
|
StreamRTPManager |
getRTPManager()
Gets the RTPManager instance which sends and receives RTP and
RTCP traffic on behalf of this MediaStream.
|
RtxTransformer |
getRtxTransformer()
Gets the
RtxTransformer , if any, used by the MediaStream . |
int |
getSpatialID(RawPacket pkt)
Utility method that determines the spatial layer index (SID) of an RTP
packet.
|
SrtpControl |
getSrtpControl()
Gets the SrtpControl which controls the SRTP of this stream.
|
(package private) StatisticsEngine |
getStatisticsEngine()
Returns the StatisticsEngine of this instance.
|
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.
|
int |
getTemporalID(RawPacket pkt)
Utility method that determines the temporal layer index (TID) of an RTP
packet.
|
TransformEngineChain |
getTransformEngineChain()
Gets the
TransformEngineChain of this MediaStream . |
TransportCCEngine |
getTransportCCEngine()
Gets the
TransportCCEngine instance, if any, for 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 |
isEndOfFrame(RawPacket pkt)
Utility method that determines whether or not a packet is an end of
frame.
|
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()
|
boolean |
isStartOfFrame(RawPacket pkt)
Utility method that determines whether or not a packet is a start of
frame.
|
StreamRTPManager |
queryRTPManager()
Gets the RTPManager instance which sends and receives RTP and
RTCP traffic on behalf of this MediaStream.
|
protected void |
recreateSendStreams()
Recreates the SendStreams of this instance (i.e.
|
protected void |
registerCustomCodecFormats(StreamRTPManager rtpManager)
Registers any custom JMF Formats with a specific
RTPManager.
|
void |
removeReceiveStreamForSsrc(long ssrc)
Removes the ReceiveStream with SSRC ssrc, if there is
such a ReceiveStream, from the receive streams of this
MediaStream
|
protected void |
rtpConnectorChanged(AbstractRTPConnector oldValue,
AbstractRTPConnector newValue)
Notifies this MediaStream implementation that its
RTPConnector instance has changed from a specific old value to a
specific new value.
|
void |
setConnector(StreamConnector connector)
Sets the StreamConnector to be used by this instance for sending
and receiving media.
|
void |
setDevice(MediaDevice device)
Sets the MediaDevice 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.
|
protected void |
setFecTransformEngine(FECTransformEngine fecTransformEngine)
Sets the
FECTransformEngine for this MediaStream
By default, nothing is done with the passed engine, allowing extenders
to implement it |
void |
setFormat(MediaFormat format)
Sets the MediaFormat that this MediaStream should
transmit in.
|
protected void |
setLocalSourceID(long localSourceID)
Sets the local SSRC identifier and fires the corresponding
PropertyChangeEvent.
|
void |
setMute(boolean mute)
Causes this MediaStream to stop transmitting the media being fed
from this stream's MediaDevice and transmit "silence" instead.
|
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.
|
boolean |
supportsFrameBoundaries(RawPacket pkt)
Returns a boolean that indicates whether or not our we're able to detect
the frame boundaries for the codec of the packet that is specified as an
argument.
|
static java.lang.String |
toString(javax.media.protocol.DataSource dataSource)
Returns a human-readable representation of a specific DataSource
instance in the form of a String value.
|
void |
update(javax.media.rtp.event.ReceiveStreamEvent ev)
Notifies this ReceiveStreamListener that the RTPManager
it is registered with has generated an event related to a
ReceiveStream.
|
void |
update(javax.media.rtp.event.RemoteEvent ev)
Method called back in the RemoteListener to notify
listener of all RTP Remote Events.RemoteEvents are one of
ReceiverReportEvent, SenderReportEvent or RemoteCollisionEvent
|
void |
update(javax.media.rtp.event.SendStreamEvent ev)
Notifies this SendStreamListener that the RTPManager it
is registered with has generated an event related to a
SendStream.
|
void |
update(javax.media.rtp.event.SessionEvent ev)
Notifies this SessionListener that the RTPManager it is
registered with has generated an event which pertains to the session as a
whole and does not belong to a ReceiveStream or a
SendStream or a remote participant necessarily.
|
addPropertyChangeListener, assertDirection, firePropertyChange, getMediaStreamTrackReceiver, getName, getProperty, getRTPTranslator, handleAttributes, injectPacket, removePropertyChangeListener, setName, setProperty, setRTPTranslator
protected static final java.lang.String PROPERTY_NAME_RECEIVE_BUFFER_LENGTH
protected boolean sendStreamsAreCreated
createSendStreams()
has
been executed for rtpManager
. If true, the
SendStreams have to be recreated when the MediaDevice,
respectively the MediaDeviceSession, of this instance is
changed.public MediaStreamImpl(MediaDevice device, SrtpControl srtpControl)
device
- the MediaDevice the new instance is to use for
both capture and playback of mediasrtpControl
- an existing control instance to control the SRTP
operationspublic MediaStreamImpl(StreamConnector connector, MediaDevice device, SrtpControl srtpControl)
connector
- the StreamConnector the new instance is to use
for sending and receiving media or null if the
StreamConnector of the new instance is to not be set at
initialization time but specified later ondevice
- the MediaDevice the new instance is to use for
both capture and playback of media exchanged via the specified
StreamConnectorsrtpControl
- an existing control instance to control the ZRTP
operations or null if a new control instance is to be created by
the new MediaStreamImplpublic static java.lang.String toString(javax.media.protocol.DataSource dataSource)
dataSource
- the DataSource to return a human-readable
representation ofpublic DiagnosticContext getDiagnosticContext()
DiagnosticContext
of this instance.public void addDynamicRTPPayloadType(byte rtpPayloadType, MediaFormat format)
addDynamicRTPPayloadType
in interface MediaStream
rtpPayloadType
- the RTP payload type to be associated in this
MediaStream with the specified MediaFormatformat
- the MediaFormat to be associated in this
MediaStream with rtpPayloadTypeMediaStream.addDynamicRTPPayloadType(byte, MediaFormat)
public void clearDynamicRTPPayloadTypes()
clearDynamicRTPPayloadTypes
in interface MediaStream
public 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.
addDynamicRTPPayloadTypeOverride
in interface MediaStream
originalPt
- the payload type that we are overridingoverloadPt
- the payload type that we are overriding it withprotected void addRemoteSourceID(long remoteSourceID)
remoteSourceID
- the SSRC identifier that this stream will be using
in outgoing RTP packets from now on.public void addRTPExtension(byte extensionID, RTPExtension rtpExtension)
addRTPExtension
in interface MediaStream
extensionID
- the ID that is being mapped to rtpExtensionrtpExtension
- the RTPExtension that we are mapping.public void clearRTPExtensions()
clearRTPExtensions
in interface MediaStream
public void close()
close
in interface MediaStream
MediaStream.close()
protected void configureDataInputStream(RTPConnectorInputStream<?> dataInputStream)
dataInputStream
- the RTPConnectorInputStream to be used
by an RTPManager of this MediaStreamImpl and to be
configuredprotected void configureDataOutputStream(RTPConnectorOutputStream dataOutputStream)
dataOutputStream
- the RTPConnectorOutputStream to be used
by an RTPManager of this MediaStreamImpl and to be
configuredprotected void configureRTPManagerBufferControl(StreamRTPManager rtpManager, javax.media.control.BufferControl bufferControl)
rtpManager
- the RTPManager which is to be used by this
MediaStreamImplbufferControl
- the BufferControl of rtpManager on
which any optional configuration is to be performedprotected DtmfTransformEngine createDtmfTransformEngine()
protected void createSendStreams()
deviceSession
through rtpManager
.protected SsrcTransformEngine createSsrcTransformEngine()
protected AbsSendTimeEngine createAbsSendTimeEngine()
AbsSendTimeEngine
for this MediaStream
.AbsSendTimeEngine
.protected CachingTransformer createCachingTransformer()
CachingTransformer
for this MediaStream
.CachingTransformer
.protected RetransmissionRequesterImpl createRetransmissionRequester()
RetransmissionRequesterImpl
for this
MediaStream
.RetransmissionRequesterImpl
.protected void deviceSessionChanged(MediaDeviceSession oldValue, MediaDeviceSession newValue)
oldValue
- the MediaDeviceSession with the
MediaDevice this instance used work withnewValue
- the MediaDeviceSession with the
MediaDevice this instance is to work withpublic TransportCCEngine getTransportCCEngine()
TransportCCEngine
instance, if any, for this
MediaStream
. The instance could be shared between more than one
MediaStream
, if they all use the same transport.public byte getActiveRTPExtensionID(RTPExtension rtpExtension)
rtpExtension
- the RTP extension to get the currently assigned ID ofpublic java.util.Map<java.lang.Byte,RTPExtension> getActiveRTPExtensions()
getActiveRTPExtensions
in interface MediaStream
protected CsrcTransformEngine getCsrcEngine()
public AbstractMediaDevice getDevice()
getDevice
in interface MediaStream
MediaStream.getDevice()
public MediaDeviceSession getDeviceSession()
public MediaDirection getDirection()
getDirection
in interface MediaStream
MediaStream.getDirection()
public byte getDynamicRTPPayloadType(java.lang.String encoding)
getDynamicRTPPayloadType
in interface MediaStream
getDynamicRTPPayloadType
in class AbstractMediaStream
encoding
- the encoding whose payload type we are trying to obtain.public java.util.Map<java.lang.Byte,MediaFormat> getDynamicRTPPayloadTypes()
addDynamicRTPPayloadType(byte, MediaFormat)
and not globally or
well-known associations reported by
MediaFormat.getRTPPayloadType()
.getDynamicRTPPayloadTypes
in interface MediaStream
MediaStream.getDynamicRTPPayloadTypes()
protected TransformEngineWrapper<FECTransformEngine> getFecTransformEngine()
FECTransformEngine
in timeprotected void setFecTransformEngine(FECTransformEngine fecTransformEngine)
FECTransformEngine
for this MediaStream
By default, nothing is done with the passed engine, allowing extenders
to implement itfecTransformEngine
- public MediaFormat getFormat()
getFormat
in interface MediaStream
MediaStream.getFormat()
public MediaFormat getFormat(byte pt)
getFormat
in interface MediaStream
getFormat
in class AbstractMediaStream
pt
- the payload type of the MediaFormat to get.public long[] getLocalContributingSourceIDs()
public java.net.InetSocketAddress getLocalControlAddress()
public java.net.InetSocketAddress getLocalDataAddress()
public long getLocalSourceID()
getLocalSourceID
in interface MediaStream
MediaStream.getLocalSourceID()
public MediaStreamStats2Impl getMediaStreamStats()
getMediaStreamStats
in interface MediaStream
public MediaType getMediaType()
protected int getPriority()
public javax.media.rtp.ReceiveStream getReceiveStream(int ssrc)
ssrc
- the synchronization source identifier of the
ReceiveStream to returnpublic java.util.Collection<javax.media.rtp.ReceiveStream> getReceiveStreams()
protected REDTransformEngine getRedTransformEngine()
public long[] getRemoteContributingSourceIDs()
public java.net.InetSocketAddress getRemoteControlAddress()
getRemoteControlAddress
in interface MediaStream
MediaStream.getRemoteControlAddress()
public java.net.InetSocketAddress getRemoteDataAddress()
getRemoteDataAddress
in interface MediaStream
MediaStream.getRemoteDataAddress()
public 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
MediaStream.getRemoteSourceIDs()
first.
getRemoteSourceIDs()
which may or
may not always be appropriate.getRemoteSourceID
in interface MediaStream
MediaStream.getRemoteSourceID()
public java.util.List<java.lang.Long> getRemoteSourceIDs()
getRemoteSourceIDs
in interface MediaStream
protected AbstractRTPConnector getRTPConnector()
public StreamRTPManager getRTPManager()
public StreamRTPManager getStreamRTPManager()
StreamRTPManager
which is to forward RTP and RTCP
traffic between this and other MediaStream
s.getStreamRTPManager
in interface MediaStream
StreamRTPManager
which is to forward RTP and RTCP
traffic between this and other MediaStream
spublic SrtpControl getSrtpControl()
getSrtpControl
in interface MediaStream
public MediaStreamTarget getTarget()
getTarget
in interface MediaStream
MediaStream.setTarget(MediaStreamTarget)
public StreamConnector.Protocol getTransportProtocol()
getTransportProtocol
in interface MediaStream
public boolean isMute()
isMute
in interface MediaStream
MediaStream.isMute()
public boolean isStarted()
start()
has been called on this
MediaStream without stop()
or close()
afterwards.isStarted
in interface MediaStream
start()
has been called on this
MediaStream without stop()
or close()
afterwardsMediaStream.isStarted()
public StreamRTPManager queryRTPManager()
protected void recreateSendStreams()
protected void registerCustomCodecFormats(StreamRTPManager rtpManager)
rtpManager
- the RTPManager to register any custom JMF
Formats withpublic void removeReceiveStreamForSsrc(long ssrc)
removeReceiveStreamForSsrc
in interface MediaStream
ssrc
- the SSRC for which to remove a ReceiveStreamprotected void rtpConnectorChanged(AbstractRTPConnector oldValue, AbstractRTPConnector newValue)
oldValue
- the RTPConnector of this MediaStream
implementation before it got changed to newValuenewValue
- the current RTPConnector of this
MediaStream which replaced oldValuepublic void setConnector(StreamConnector connector)
setConnector
in interface MediaStream
connector
- the StreamConnector to be used by this instance
for sending and receiving mediapublic void setDevice(MediaDevice device)
Note: Also resets any previous direction set with
setDirection(MediaDirection)
to the direction of the specified
MediaDevice.
setDevice
in interface MediaStream
device
- the MediaDevice that this stream should use to
play back and capture mediaMediaStream.setDevice(MediaDevice)
public 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.setDirection
in interface MediaStream
direction
- the MediaDirection in which this
MediaStream is to stream media when it is startedMediaStream.setDirection(MediaDirection)
public void setFormat(MediaFormat format)
setFormat
in interface MediaStream
format
- the MediaFormat that this MediaStream
should transmit inMediaStream.setFormat(MediaFormat)
protected void setLocalSourceID(long localSourceID)
localSourceID
- the SSRC identifier that this stream will be using
in outgoing RTP packets from now onpublic void setMute(boolean mute)
setMute
in interface MediaStream
mute
- true to have this MediaStream transmit
"silence" instead of the actual media data that it captures from its
MediaDevice; false to transmit actual media data
captured from the MediaDevice of this MediaStreamMediaStream.setMute(boolean)
public void setSSRCFactory(SSRCFactory ssrcFactory)
setSSRCFactory
in interface MediaStream
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) identifierspublic void setTarget(MediaStreamTarget target)
setTarget
in interface MediaStream
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 receiveMediaStream.setTarget(MediaStreamTarget)
public void start()
start
in interface MediaStream
MediaStream.start()
public void stop()
stop
in interface MediaStream
MediaStream.stop()
public void update(javax.media.rtp.event.ReceiveStreamEvent ev)
update
in interface javax.media.rtp.ReceiveStreamListener
ev
- the ReceiveStreamEvent which specifies the
ReceiveStream that is the cause of the event and the very type
of the eventReceiveStreamListener.update(ReceiveStreamEvent)
public void update(javax.media.rtp.event.RemoteEvent ev)
update
in interface javax.media.rtp.RemoteListener
ev
- the eventpublic void update(javax.media.rtp.event.SendStreamEvent ev)
update
in interface javax.media.rtp.SendStreamListener
ev
- the SendStreamEvent which specifies the
SendStream that is the cause of the event and the very type of
the eventSendStreamListener.update(SendStreamEvent)
public void update(javax.media.rtp.event.SessionEvent ev)
update
in interface javax.media.rtp.SessionListener
ev
- the SessionEvent which specifies the source and the
very type of the eventSessionListener.update(SessionEvent)
StatisticsEngine getStatisticsEngine()
public void setExternalTransformer(TransformEngine transformEngine)
setExternalTransformer
in interface MediaStream
transformEngine
- the TransformerEngine to use.public void injectPacket(RawPacket pkt, boolean data, TransformEngine after) throws TransmissionFailedException
injectPacket
in interface MediaStream
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.public int getTemporalID(RawPacket pkt)
pkt
- the packet from which to get the temporal layer idVideoMediaStreamImpl
,
but I don't want to be obliged to cast to use this method.public int getSpatialID(RawPacket pkt)
pkt
- the RTP packet.VideoMediaStreamImpl
,
but I don't want to be obliged to cast to use this method.public boolean supportsFrameBoundaries(RawPacket pkt)
pkt
- the RawPacket
that holds the RTP packet.public boolean isStartOfFrame(RawPacket pkt)
pkt
- raw rtp packet.VideoMediaStreamImpl
,
but I don't want to be obliged to cast to use this method.public boolean isEndOfFrame(RawPacket pkt)
pkt
- raw rtp packet.VideoMediaStreamImpl
,
but I don't want to be obliged to cast to use this method.public boolean isKeyFrame(byte[] buf, int off, int len)
isKeyFrame
in interface MediaStream
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.public boolean isKeyFrame(RawPacket pkt)
isKeyFrame
in interface MediaStream
pkt
- the packet.public CachingTransformer getCachingTransformer()
CachingTransformer
which (optionally) caches outgoing
packets for this MediaStreamImpl
, if it exists.CachingTransformer
for this MediaStreamImpl
.public RetransmissionRequester getRetransmissionRequester()
getRetransmissionRequester
in interface MediaStream
RetransmissionRequester
for this media stream.public TransformEngineChain getTransformEngineChain()
TransformEngineChain
of this MediaStream
.
StreamConnector
is
set for the MediaStreamImpl
via
setConnector(StreamConnector)
or by passing a non-null connector
to the constructor. Until the chain is initialized, this method will
return null.getTransformEngineChain
in interface MediaStream
getTransformEngineChain
in class AbstractMediaStream
public REDBlock getPrimaryREDBlock(ByteArrayBuffer baf)
REDBlock
that contains the payload of the RTP
packet passed in as a parameter.getPrimaryREDBlock
in interface MediaStream
getPrimaryREDBlock
in class AbstractMediaStream
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.public REDBlock getPrimaryREDBlock(RawPacket pkt)
REDBlock
that contains the payload of the packet passed
in as a parameter.getPrimaryREDBlock
in interface MediaStream
getPrimaryREDBlock
in class AbstractMediaStream
pkt
- the packet from which we want to get the primary RED blockREDBlock
that contains the payload of the packet
passed in as a parameter, or null if the buffer is invalid.public RtxTransformer getRtxTransformer()
RtxTransformer
, if any, used by the MediaStream
.RtxTransformer
used by the MediaStream
or
null
protected DiscardTransformEngine createDiscardEngine()
DiscardTransformEngine
for this stream. Allows
extenders to override.protected TransformEngine getRTCPTermination()
MediaStreamImpl
.protected PaddingTermination getPaddingTermination()
PaddingTermination
for this MediaStreamImpl
.public RemoteBitrateEstimatorWrapper getRemoteBitrateEstimator()
public 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).setTransportCCEngine
in interface MediaStream
setTransportCCEngine
in class AbstractMediaStream
engine
- the engine to set.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.