public class CachingPushBufferStream extends Object implements javax.media.protocol.PushBufferStream
An example use of this functionality is pacing a PushBufferStream which pushes more data units in a single step than a CaptureDevice. When these two undergo audio mixing, the different numbers of per-push data units will cause the PushBufferStream "play" itself faster than the CaptureDevice.
| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_BUFFER_LENGTH
The default length in milliseconds of the buffering to be performed by
CachePushBufferStreams.
|
| Constructor and Description |
|---|
CachingPushBufferStream(javax.media.protocol.PushBufferStream stream)
Initializes a new CachingPushBufferStream instance which is
to pace the number of per-push data units a specific
PushBufferStream provides.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
endOfStream()
Implements
SourceStream.endOfStream(). |
javax.media.protocol.ContentDescriptor |
getContentDescriptor()
Implements
SourceStream.getContentDescriptor(). |
long |
getContentLength()
Implements
SourceStream.getContentLength(). |
Object |
getControl(String controlType)
Implements
Controls.getControl(String). |
Object[] |
getControls()
Implements
Controls.getControls(). |
javax.media.Format |
getFormat()
Implements
PushBufferStream.getFormat(). |
javax.media.protocol.PushBufferStream |
getStream()
Gets the PushBufferStream wrapped by this instance.
|
void |
read(javax.media.Buffer buffer)
Implements
PushBufferStream.read(Buffer). |
void |
setTransferHandler(javax.media.protocol.BufferTransferHandler transferHandler)
Implements
PushBufferStream.setTransferHandler(BufferTransferHandler). |
protected void |
transferData(javax.media.protocol.BufferTransferHandler transferHandler)
Reads data from the wrapped/input PushBufferStream into the
cache of this stream if the cache accepts it.
|
public static final long DEFAULT_BUFFER_LENGTH
public CachingPushBufferStream(javax.media.protocol.PushBufferStream stream)
stream - the PushBufferStream to be paced with respect to
the number of per-push data units it providespublic boolean endOfStream()
SourceStream.endOfStream(). Delegates to the wrapped
PushBufferStream when the cache of this instance is fully read;
otherwise, returns false.endOfStream in interface javax.media.protocol.SourceStreampublic javax.media.protocol.ContentDescriptor getContentDescriptor()
SourceStream.getContentDescriptor(). Delegates to the
wrapped PushBufferStream.getContentDescriptor in interface javax.media.protocol.SourceStreampublic long getContentLength()
SourceStream.getContentLength(). Delegates to the
wrapped PushBufferStream.getContentLength in interface javax.media.protocol.SourceStreampublic Object getControl(String controlType)
Controls.getControl(String). Delegates to
the wrapped PushBufferStream and gives access to the
BufferControl of this instance if such a controlType is
specified and the wrapped PushBufferStream does not have such a
control available.getControl in interface javax.media.ControlscontrolType - a String value which names the type of the
control of the wrapped PushBufferStream to be retrievedpublic Object[] getControls()
Controls.getControls(). Delegates to the
wrapped PushBufferStream and adds the BufferControl of
this instance if the wrapped PushBufferStream does not have a
control of such type available.getControls in interface javax.media.Controlspublic javax.media.Format getFormat()
PushBufferStream.getFormat(). Delegates to the wrapped
PushBufferStream.getFormat in interface javax.media.protocol.PushBufferStreampublic javax.media.protocol.PushBufferStream getStream()
public void read(javax.media.Buffer buffer)
throws IOException
PushBufferStream.read(Buffer). If an
IOException has been thrown by the wrapped stream when data was
last read from it, re-throws it. If there has been no such exception,
reads from the cache of this instance.read in interface javax.media.protocol.PushBufferStreambuffer - the Buffer to receive the read media dataIOException - if the wrapped stream has thrown such an exception
when data was last read from itpublic void setTransferHandler(javax.media.protocol.BufferTransferHandler transferHandler)
PushBufferStream.setTransferHandler(BufferTransferHandler).
Delegates to the wrapped PushBufferStream but wraps the specified
BufferTransferHandler in order to intercept the calls to
BufferTransferHandler.transferData(PushBufferStream) and read
data from the wrapped PushBufferStream into the cache during the
calls in question.setTransferHandler in interface javax.media.protocol.PushBufferStreamtransferHandler - the BufferTransferHandler to be notified
by this PushBufferStream when media data is available for
readingprotected void transferData(javax.media.protocol.BufferTransferHandler transferHandler)
transferHandler - the BufferTransferHandler which has been
notifiedCopyright © 2022 jitsi.org. All rights reserved.