org.red5.server.stream
Class SingleItemSubscriberStream

java.lang.Object
  extended by org.red5.server.stream.AbstractStream
      extended by org.red5.server.stream.AbstractClientStream
          extended by org.red5.server.stream.SingleItemSubscriberStream
All Implemented Interfaces:
IClientStream, ISingleItemSubscriberStream, IStream, ISubscriberStream

public class SingleItemSubscriberStream
extends AbstractClientStream
implements ISingleItemSubscriberStream

Stream of a single play item for a subscriber

Author:
Paul Gregoire ([email protected])

Nested Class Summary
 class SingleItemSubscriberStream.Notifier
          Handles notifications in a separate thread.
 
Field Summary
protected  int bufferCheckInterval
          Interval in ms to check for buffer underruns in VOD streams.
protected  long creationTime
          Timestamp this stream was created.
protected  PlayEngine engine
          Plays items back
protected static ScheduledThreadPoolExecutor executor
          Executor that will be used to schedule stream playback to keep the client buffer filled.
protected  int underrunTrigger
          Number of pending messages at which a NetStream.Play.InsufficientBW message is generated for VOD streams.
 
Fields inherited from class org.red5.server.stream.AbstractStream
lock, metaData, state
 
Fields inherited from interface org.red5.server.api.stream.IClientStream
MODE_APPEND, MODE_LIVE, MODE_PUBLISH, MODE_READ, MODE_RECORD
 
Constructor Summary
SingleItemSubscriberStream()
           
 
Method Summary
 void close()
          Close this stream.
 ScheduledThreadPoolExecutor getExecutor()
          Return the executor to use.
 boolean isPaused()
          Check if the stream is currently paused.
 void onChange(StreamState state, Object... changed)
          Notification of state change and associated parameters.
 void pause(int position)
          Pause at a position for current playing item.
 void play()
          Start playing.
 void receiveAudio(boolean receive)
          Should the stream send audio to the client?
 void receiveVideo(boolean receive)
          Should the stream send video to the client?
 void resume(int position)
          Resume from a position for current playing item.
 void seek(int position)
          Seek into a position for current playing item.
 void setBufferCheckInterval(int bufferCheckInterval)
          Set interval to check for buffer underruns.
 void setExecutor(ScheduledThreadPoolExecutor executor)
          Set the executor to use.
 void setPlayItem(IPlayItem item)
          Setter for property 'playItem'.
 void setUnderrunTrigger(int underrunTrigger)
          Set maximum number of pending messages at which a NetStream.Play.InsufficientBW message will be generated for VOD streams
 void start()
          Start this stream.
 void stop()
          Stop playing.
 
Methods inherited from class org.red5.server.stream.AbstractClientStream
getBroadcastStreamPublishName, getClientBufferDuration, getConnection, getStreamId, setBroadcastStreamPublishName, setClientBufferDuration, setConnection, setStreamId
 
Methods inherited from class org.red5.server.stream.AbstractStream
getCodecInfo, getCreationTime, getMetaData, getName, getScope, getState, getStreamAwareHandler, setCodecInfo, setName, setScope, setState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.red5.server.api.stream.ISubscriberStream
getState, setState
 
Methods inherited from interface org.red5.server.api.stream.IClientStream
getBroadcastStreamPublishName, getClientBufferDuration, getConnection, getStreamId, setClientBufferDuration
 
Methods inherited from interface org.red5.server.api.stream.IStream
getCodecInfo, getCreationTime, getName, getScope
 

Field Detail

executor

protected static ScheduledThreadPoolExecutor executor
Executor that will be used to schedule stream playback to keep the client buffer filled.


bufferCheckInterval

protected int bufferCheckInterval
Interval in ms to check for buffer underruns in VOD streams.


underrunTrigger

protected int underrunTrigger
Number of pending messages at which a NetStream.Play.InsufficientBW message is generated for VOD streams.


creationTime

protected long creationTime
Timestamp this stream was created.


engine

protected PlayEngine engine
Plays items back

Constructor Detail

SingleItemSubscriberStream

public SingleItemSubscriberStream()
Method Detail

setPlayItem

public void setPlayItem(IPlayItem item)
Description copied from interface: ISingleItemSubscriberStream
Setter for property 'playItem'.

Specified by:
setPlayItem in interface ISingleItemSubscriberStream
Parameters:
item - Value to set for property 'playItem'.

play

public void play()
          throws IOException
Description copied from interface: ISubscriberStream
Start playing.

Specified by:
play in interface ISubscriberStream
Throws:
IOException - if an IO error occurred while starting to play the stream

pause

public void pause(int position)
Pause at a position for current playing item.

Specified by:
pause in interface ISubscriberStream
Parameters:
position - Position for pause in millisecond.

resume

public void resume(int position)
Resume from a position for current playing item.

Specified by:
resume in interface ISubscriberStream
Parameters:
position - Position for resume in millisecond.

stop

public void stop()
Stop playing.

Specified by:
stop in interface IStream
Specified by:
stop in interface ISubscriberStream

seek

public void seek(int position)
          throws OperationNotSupportedException
Seek into a position for current playing item.

Specified by:
seek in interface ISubscriberStream
Parameters:
position - Position for seek in millisecond.
Throws:
OperationNotSupportedException - if the stream doesn't support seeking.

isPaused

public boolean isPaused()
Description copied from interface: ISubscriberStream
Check if the stream is currently paused.

Specified by:
isPaused in interface ISubscriberStream
Returns:
stream is paused

receiveVideo

public void receiveVideo(boolean receive)
Should the stream send video to the client?

Specified by:
receiveVideo in interface ISubscriberStream

receiveAudio

public void receiveAudio(boolean receive)
Should the stream send audio to the client?

Specified by:
receiveAudio in interface ISubscriberStream

setExecutor

public void setExecutor(ScheduledThreadPoolExecutor executor)
Set the executor to use.

Parameters:
executor - the executor

getExecutor

public ScheduledThreadPoolExecutor getExecutor()
Return the executor to use.

Specified by:
getExecutor in interface ISubscriberStream
Returns:
the executor

setBufferCheckInterval

public void setBufferCheckInterval(int bufferCheckInterval)
Set interval to check for buffer underruns. Set to 0 to disable.

Parameters:
bufferCheckInterval - interval in ms

setUnderrunTrigger

public void setUnderrunTrigger(int underrunTrigger)
Set maximum number of pending messages at which a NetStream.Play.InsufficientBW message will be generated for VOD streams

Parameters:
underrunTrigger - the maximum number of pending messages

start

public void start()
Description copied from interface: IStream
Start this stream.

Specified by:
start in interface IStream

close

public void close()
Description copied from interface: IStream
Close this stream.

Specified by:
close in interface IStream

onChange

public void onChange(StreamState state,
                     Object... changed)
Notification of state change and associated parameters.

Specified by:
onChange in interface ISubscriberStream
Parameters:
state - new state
changed - parameters associated with the change


Copyright © 2006-2012 The Red5 Project