Class AbstractStream

java.lang.Object
org.red5.server.stream.AbstractStream
All Implemented Interfaces:
IStream
Direct Known Subclasses:
AbstractClientStream, ServerStream

public abstract class AbstractStream extends Object implements IStream
Abstract base implementation of IStream. Contains codec information, stream name, scope, event handling, and provides stream start and stop operations.
Author:
mondain
See Also:
  • Field Details

    • log

      protected org.slf4j.Logger log
    • isTrace

      protected boolean isTrace
    • isDebug

      protected boolean isDebug
    • codecInfo

      protected IStreamCodecInfo codecInfo
      Stream audio and video codec information
    • metaData

      protected transient AtomicReference<Notify> metaData
      Stores the streams metadata
    • stateListeners

      protected transient CopyOnWriteArraySet<PropertyChangeListener> stateListeners
      Contains PropertyChangeListeners registered with this stream and following its changes of state.
    • creationTime

      protected long creationTime
      Timestamp the stream was created.
    • startTime

      protected long startTime
      Timestamp the stream was started.
    • state

      protected final transient AtomicReference<StreamState> state
      Current state
  • Constructor Details

    • AbstractStream

      public AbstractStream()
  • Method Details

    • fireStateChange

      protected void fireStateChange(StreamState oldState, StreamState newState)
      Creates a new PropertyChangeEvent and delivers it to all currently registered state listeners.
      Parameters:
      oldState - the StreamState we had before the change
      newState - the StreamState we had after the change
    • addStateChangeListener

      public void addStateChangeListener(PropertyChangeListener listener)
      Adds to the list of listeners tracking changes of the StreamState of this stream.
      Parameters:
      listener - the listener to register
    • removeStateChangeListener

      public void removeStateChangeListener(PropertyChangeListener listener)
      Removes from the list of listeners tracking changes of the StreamState of this stream.
      Parameters:
      listener - the listener to remove
    • getName

      public String getName()
      Return stream name.
      Specified by:
      getName in interface IStream
      Returns:
      Stream name
    • getCodecInfo

      public IStreamCodecInfo getCodecInfo()
      Return codec information.
      Specified by:
      getCodecInfo in interface IStream
      Returns:
      Stream codec information
    • getMetaData

      public Notify getMetaData()
      Returns a copy of the metadata for the associated stream, if it exists.
      Returns:
      stream meta data
    • setMetaData

      public void setMetaData(Notify metaData)
      Set the metadata.
      Parameters:
      metaData - stream meta data
    • getScope

      public IScope getScope()
      Return scope.
      Specified by:
      getScope in interface IStream
      Returns:
      Scope
    • getCreationTime

      public long getCreationTime()
      Returns timestamp at which the stream was created.
      Specified by:
      getCreationTime in interface IStream
      Returns:
      creation timestamp
    • getStartTime

      public long getStartTime()
      Returns timestamp at which the stream was started.
      Specified by:
      getStartTime in interface IStream
      Returns:
      started timestamp
    • setName

      public void setName(String name)
      Setter for name.
      Parameters:
      name - Stream name
    • setCodecInfo

      public void setCodecInfo(IStreamCodecInfo codecInfo)
      Setter for codec info.
      Parameters:
      codecInfo - Codec info
    • setScope

      public void setScope(IScope scope)
      Setter for scope.
      Parameters:
      scope - Scope
    • getState

      public StreamState getState()
      Return stream state.
      Returns:
      StreamState
    • setState

      public void setState(StreamState newState)
      Sets the stream state.
      Parameters:
      newState - stream state
    • getStreamAwareHandler

      protected IStreamAwareScopeHandler getStreamAwareHandler()
      Return stream aware scope handler or null if scope is null.
      Returns:
      IStreamAwareScopeHandler implementation