Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia.device
Class ReceiveStreamPushBufferDataSource

java.lang.Object
  extended by javax.media.protocol.DataSource
      extended by javax.media.protocol.PushBufferDataSource
          extended by net.java.sip.communicator.impl.neomedia.protocol.CaptureDeviceDelegatePushBufferDataSource
              extended by net.java.sip.communicator.impl.neomedia.protocol.PushBufferDataSourceDelegate<javax.media.protocol.PushBufferDataSource>
                  extended by net.java.sip.communicator.impl.neomedia.device.ReceiveStreamPushBufferDataSource
All Implemented Interfaces:
javax.media.Controls, javax.media.Duration, javax.media.protocol.CaptureDevice

public class ReceiveStreamPushBufferDataSource
extends PushBufferDataSourceDelegate<javax.media.protocol.PushBufferDataSource>

Wraps the DataSource of a specific ReceiveStream so that calls to its DataSource.disconnect() can be explicitly controlled. It is introduced because it seems that after the DataSource of a ReceiveStream is disconnected, it cannot be connected to or started and if a Processor is created on it, it freezes in the Processor.Configuring state.

Author:
Lubomir Marinov

Field Summary
 
Fields inherited from class net.java.sip.communicator.impl.neomedia.protocol.PushBufferDataSourceDelegate
dataSource
 
Fields inherited from class net.java.sip.communicator.impl.neomedia.protocol.CaptureDeviceDelegatePushBufferDataSource
captureDevice, EMPTY_STREAMS
 
Fields inherited from interface javax.media.Duration
DURATION_UNBOUNDED, DURATION_UNKNOWN
 
Constructor Summary
ReceiveStreamPushBufferDataSource(javax.media.rtp.ReceiveStream receiveStream, javax.media.protocol.PushBufferDataSource dataSource)
          Initializes a new ReceiveStreamPushBufferDataSource instance which is to wrap a specific DataSource of a specific ReceiveStream for the purposes of enabling explicity control of calls to its DataSource.disconnect().
ReceiveStreamPushBufferDataSource(javax.media.rtp.ReceiveStream receiveStream, javax.media.protocol.PushBufferDataSource dataSource, boolean suppressDisconnect)
          Initializes a new ReceiveStreamPushBufferDataSource instance which is to wrap a specific DataSource of a specific ReceiveStream for the purposes of enabling explicity control of calls to its DataSource.disconnect() and, optionally, activates the suppresses the call in question.
 
Method Summary
 void disconnect()
          Implements DataSource.disconnect().
 javax.media.rtp.ReceiveStream getReceiveStream()
          Gets the ReceiveStream which has its DataSource wrapped by this instance.
 javax.media.protocol.PushBufferStream[] getStreams()
          Implements PushBufferDataSource.getStreams().
 void setSuppressDisconnect(boolean suppressDisconnect)
          Sets the indicator which determines whether calls to DataSource.disconnect() on the wrapped DataSource are to be suppressed when there are such calls on this instance.
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.protocol.PushBufferDataSourceDelegate
connect, getContentType, getControl, getControls, getDataSource, getDuration, getLocator, start, stop
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.protocol.CaptureDeviceDelegatePushBufferDataSource
getCaptureDeviceInfo, getFormatControls
 
Methods inherited from class javax.media.protocol.DataSource
initCheck, setLocator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReceiveStreamPushBufferDataSource

public ReceiveStreamPushBufferDataSource(javax.media.rtp.ReceiveStream receiveStream,
                                         javax.media.protocol.PushBufferDataSource dataSource)
Initializes a new ReceiveStreamPushBufferDataSource instance which is to wrap a specific DataSource of a specific ReceiveStream for the purposes of enabling explicity control of calls to its DataSource.disconnect().

Parameters:
receiveStream - the ReceiveStream which is to have its DataSource
dataSource - the DataSource of receiveStream which is to be wrapped by this instance

ReceiveStreamPushBufferDataSource

public ReceiveStreamPushBufferDataSource(javax.media.rtp.ReceiveStream receiveStream,
                                         javax.media.protocol.PushBufferDataSource dataSource,
                                         boolean suppressDisconnect)
Initializes a new ReceiveStreamPushBufferDataSource instance which is to wrap a specific DataSource of a specific ReceiveStream for the purposes of enabling explicity control of calls to its DataSource.disconnect() and, optionally, activates the suppresses the call in question.

Parameters:
receiveStream - the ReceiveStream which is to have its DataSource
dataSource - the DataSource of receiveStream which is to be wrapped by this instance
suppressDisconnect - true if calls to DataSource#disconnect() on the wrapped dataSource are to be suppressed when there are such calls on the new instance; otherwise, false
Method Detail

disconnect

public void disconnect()
Implements DataSource.disconnect(). Disconnects the wrapped DataSource if it has not been explicitly suppressed by setting the suppressDisconnect property of this instance.

Specified by:
disconnect in interface javax.media.protocol.CaptureDevice
Overrides:
disconnect in class PushBufferDataSourceDelegate<javax.media.protocol.PushBufferDataSource>

getReceiveStream

public javax.media.rtp.ReceiveStream getReceiveStream()
Gets the ReceiveStream which has its DataSource wrapped by this instance.

Returns:
the ReceiveStream which has its DataSource wrapped by this instance

getStreams

public javax.media.protocol.PushBufferStream[] getStreams()
Implements PushBufferDataSource.getStreams(). Delegates to the wrapped DataSource of the ReceiveStream.

Specified by:
getStreams in class PushBufferDataSourceDelegate<javax.media.protocol.PushBufferDataSource>
Returns:
an array of the PushBufferStreams of the wrapped DataSource of the ReceiveStream

setSuppressDisconnect

public void setSuppressDisconnect(boolean suppressDisconnect)
Sets the indicator which determines whether calls to DataSource.disconnect() on the wrapped DataSource are to be suppressed when there are such calls on this instance.

Parameters:
suppressDisconnect - true to suppress calls to DataSource#disconnect() on the wrapped DataSource when there are such calls on this instance; otherwise, false

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.