Package org.jitsi.impl.neomedia.codec
Class SilenceEffect
- java.lang.Object
-
- net.sf.fmj.media.AbstractControls
-
- net.sf.fmj.media.AbstractPlugIn
-
- net.sf.fmj.media.AbstractCodec
-
- org.jitsi.impl.neomedia.codec.AbstractCodec2
-
- org.jitsi.impl.neomedia.codec.SilenceEffect
-
- All Implemented Interfaces:
javax.media.Codec,javax.media.Controls,javax.media.Effect,javax.media.PlugIn
public class SilenceEffect extends AbstractCodec2 implements javax.media.Effect
An Effect which detects discontinuities in an audio stream by monitoring the input Buffers' timestamps and lengths, and inserts silence to account for missing data.- Author:
- Boris Grozev
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSilenceEffect.Listener
-
Field Summary
Fields Modifier and Type Field Description static javax.media.Format[]SUPPORTED_FORMATSThe Formats supported as input/output by this Effect.-
Fields inherited from class org.jitsi.impl.neomedia.codec.AbstractCodec2
BUFFER_FLAG_FEC, BUFFER_FLAG_PLC, EMPTY_FORMATS, features, MAX_AUDIO_SEQUENCE_NUMBERS_TO_PLC, SEQUENCE_MAX, SEQUENCE_MIN
-
-
Constructor Summary
Constructors Constructor Description SilenceEffect()Initializes a new SilenceEffect, which is to use the input Buffers' timestamps (as opposed to using their RTP timestamps).SilenceEffect(int rtpClockRate)Initializes a new SilenceEffect, which is to use the input Buffers' RTP timestamps.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoClose()protected voiddoOpen()Opens this Codec and acquires the resources that it needs to operate.protected intdoProcess(javax.media.Buffer inBuf, javax.media.Buffer outBuf)Processes inBuf, and either copies its data to outBuf or copies silencevoidresetSilence()Resets the state of this SilenceEffect.voidsetListener(SilenceEffect.Listener listener)-
Methods inherited from class org.jitsi.impl.neomedia.codec.AbstractCodec2
calculateLostSeqNoCount, close, discardOutputBuffer, getMatchingOutputFormats, getName, getSupportedOutputFormats, incrementSeqNo, matches, open, process, setInputFormat, setOutputFormat, specialize, updateOutput, validateByteArraySize, validateShortArraySize
-
Methods inherited from class net.sf.fmj.media.AbstractCodec
checkInputBuffer, dump, getInputFormat, getOutputFormat, getSupportedInputFormats, isEOM, propagateEOM
-
Methods inherited from class net.sf.fmj.media.AbstractControls
addControl, getControl, getControls, removeControl
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Constructor Detail
-
SilenceEffect
public SilenceEffect()
Initializes a new SilenceEffect, which is to use the input Buffers' timestamps (as opposed to using their RTP timestamps).
-
SilenceEffect
public SilenceEffect(int rtpClockRate)
Initializes a new SilenceEffect, which is to use the input Buffers' RTP timestamps.- Parameters:
rtpClockRate- the clock rate that the RTP timestamps use.
-
-
Method Detail
-
doClose
protected void doClose()
- Specified by:
doClosein classAbstractCodec2
-
doOpen
protected void doOpen() throws javax.media.ResourceUnavailableExceptionOpens this Codec and acquires the resources that it needs to operate. A call toPlugIn.open()on this instance will result in a call to doOpen only ifAbstractCodec.openedis false. All required input and/or output formats are assumed to have been set on this Codec before doOpen is called.- Specified by:
doOpenin classAbstractCodec2- Throws:
javax.media.ResourceUnavailableException- if any of the resources that this Codec needs to operate cannot be acquired
-
doProcess
protected int doProcess(javax.media.Buffer inBuf, javax.media.Buffer outBuf)Processes inBuf, and either copies its data to outBuf or copies silence- Specified by:
doProcessin classAbstractCodec2- Parameters:
inBuf- the input Buffer.outBuf- the output Buffer.- Returns:
- BUFFER_PROCESSED_OK if inBuf's date was copied to outBuf, and INPUT_BUFFER_NOT_CONSUMED if silence was inserted instead.
-
resetSilence
public void resetSilence()
Resets the state of this SilenceEffect. TODO: is it appropriate to override the reset() method?
-
setListener
public void setListener(SilenceEffect.Listener listener)
-
-