/** * Implements {@link BufferControl#getBufferLength()}. Gets the length in * milliseconds of the buffering performed by the owner of the wrapped * <tt>BufferControl</tt>. * * @return the length in milliseconds of the buffering performed by the * owner of the wrapped <tt>BufferControl</tt> */ public long getBufferLength() { return bufferControl.getBufferLength(); }
/** * Gets the length in milliseconds of the buffering performed by this * <tt>PushBufferStream</tt>. * * @return the length in milliseconds of the buffering performed by this * <tt>PushBufferStream</tt> if such a value has been set; otherwise, * {@link BufferControl#DEFAULT_VALUE} */ private long getBufferLength() { synchronized (bufferControlSyncRoot) { return (bufferControl == null) ? BufferControl.DEFAULT_VALUE : bufferControl.getBufferLength(); } }
/** * Attempts to equalize the length in milliseconds of the buffering * performed by the <tt>inStreams</tt> in order to always read and mix * one and the same length in milliseconds. */ void equalizeInStreamBufferLength() { synchronized (inStreamsSyncRoot) { if ((inStreams == null) || (inStreams.length < 1)) return; /* * The first inStream is expected to be from the CaptureDevice * and no custom BufferControl is provided for it so the * bufferLength is whatever it says. */ BufferControl bufferControl = getBufferControl(inStreams[0]); long bufferLength = (bufferControl == null) ? CachingPushBufferStream.DEFAULT_BUFFER_LENGTH : bufferControl.getBufferLength(); for (int i = 1; i < inStreams.length; i++) { BufferControl inStreamBufferControl = getBufferControl(inStreams[i]); if (inStreamBufferControl != null) inStreamBufferControl.setBufferLength(bufferLength); } } }