public abstract class Stream
extends java.lang.Object
State management include, but not limited to: - CallingNOTE:internalStop()only after0 != streamHandle- CallingsendData(Frame)only after0 != streamHandle- CallinginternalStart(StreamStatusListener)only after0 == streamHandle
- An ideal TXStream's lifecycle would be:
STARTED -> DESTROYED
- An ideal RXStream's lifecycle would be:
CREATED -> STARTED -> STOPPED -> DESTROYED
| Modifier and Type | Class and Description |
|---|---|
static class |
Stream.State
An enum indicating the state of this stream.
|
static class |
Stream.StateException
Constructs an illegal state exception with the specified detail message and cause.
|
static interface |
Stream.StreamStatusListener
A listener which is used for updating the stream status and passing back the stream data.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Stream(java.lang.String sdp,
java.lang.String networkId,
int channelId,
long streamId) |
| Modifier and Type | Method and Description |
|---|---|
int |
getChannelId() |
long |
getId() |
java.lang.String |
getNetworkId() |
java.lang.String |
getSdp() |
long |
getSourceNodeId()
Get the source nodeId of this stream.
|
Stream.State |
getStatus() |
protected void |
internalSetSourceNodeId(long nodeId) |
protected void |
internalSetStatus(Stream.State status) |
protected void |
internalStart(Stream.StreamStatusListener listener)
Starts the stream.
|
protected void |
internalStop()
Stop listening and sending to the stream.
|
protected abstract boolean |
isTxStream() |
protected void |
sendData(Frame frame)
Send data to other nodes subscribed to this stream.
|
java.lang.String |
toString() |
protected Stream(java.lang.String sdp,
java.lang.String networkId,
int channelId,
long streamId)
protected abstract boolean isTxStream()
public Stream.State getStatus()
public java.lang.String getNetworkId()
public int getChannelId()
public long getId()
public java.lang.String getSdp()
public long getSourceNodeId()
protected void internalSetSourceNodeId(long nodeId)
protected void internalSetStatus(Stream.State status)
protected final void internalStart(Stream.StreamStatusListener listener)
Stream.StreamStatusListener.onStreamDataReceived(Frame)
else this stream object will be for sending data to other nodes
using sendData(Frame)
NOTE: If the stream id is not set. Then a new stream will be created.
listener - The listener for getting the status updatesprotected void sendData(Frame frame)
frame - The audio/video frame which has to be transmittedStream.StateException - If this is a listening RX streamprotected final void internalStop()
Stream.State.STOPPED.public java.lang.String toString()
toString in class java.lang.Object