Class 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
    • Field Detail

      • SUPPORTED_FORMATS

        public static final javax.media.Format[] SUPPORTED_FORMATS
        The Formats supported as input/output by this Effect.
    • 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

      • doOpen

        protected void doOpen()
                       throws javax.media.ResourceUnavailableException
        Opens this Codec and acquires the resources that it needs to operate. A call to PlugIn.open() on this instance will result in a call to doOpen only if AbstractCodec.opened is false. All required input and/or output formats are assumed to have been set on this Codec before doOpen is called.
        Specified by:
        doOpen in class AbstractCodec2
        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:
        doProcess in class AbstractCodec2
        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?