if (bc != null) { int bl = 160; bc.setBufferLength(bl);
bufferLength = bufferControl.setBufferLength(bufferLength); if (logger.isTraceEnabled()) logger.trace("Set receiver buffer length to " + bufferLength); bufferControl.setEnabledThreshold(minimumThreshold > 0); bufferControl.setMinimumThreshold(minimumThreshold);
/** * 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); } } }
/** * 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(); }
/** * Implements {@link BufferControl#getMinimumThreshold()}. Gets the minimum * threshold in milliseconds for the buffering performed by the owner of the * wrapped <tt>BufferControl</tt>. * * @return the minimum threshold in milliseconds for the buffering performed * by the owner of the wrapped <tt>BufferControl</tt> */ public long getMinimumThreshold() { return bufferControl.getMinimumThreshold(); }
/** * Implements {@link BufferControl#getEnabledThreshold()}. Gets the * indicator of the wrapped <tt>BufferControl</tt> which determines whether * threshold calculations are enabled. * * @return <tt>true</tt> if threshold calculations are enabled in the * wrapped <tt>BufferControl</tt>; otherwise, <tt>false</tt> */ public boolean getEnabledThreshold() { return bufferControl.getEnabledThreshold(); }
/** * Implements {@link javax.media.Control#getControlComponent()}. Gets the UI * <tt>Component</tt> representing this instance and exported by the owner * of the wrapped <tt>BufferControl</tt>. * * @return the UI <tt>Component</tt> representing the wrapped * <tt>BufferControl</tt> and exported by its owner if such a * <tt>Component</tt> is available; otherwise, <tt>null</tt> */ public java.awt.Component getControlComponent() { return bufferControl.getControlComponent(); }
/** * 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(); } }
/** * Performs any optional configuration on the <tt>BufferControl</tt> of the * specified <tt>RTPManager</tt> which is to be used as the * <tt>RTPManager</tt> of this <tt>MediaStreamImpl</tt>. * * @param rtpManager the <tt>RTPManager</tt> which is to be used by this * <tt>MediaStreamImpl</tt> * @param bufferControl the <tt>BufferControl</tt> of <tt>rtpManager</tt> on * which any optional configuration is to be performed */ @Override protected void configureRTPManagerBufferControl( StreamRTPManager rtpManager, BufferControl bufferControl) { super.configureRTPManagerBufferControl(rtpManager, bufferControl); bufferControl.setBufferLength(BufferControl.MAX_VALUE); }
Player p = Manager.createRealizedPlayer( f.toURI().toURL() ); BufferControl bc = (BufferControl) p.getControl( "javax.media.control.BufferControl" ); if ( bc != null ) bc.setBufferLength( 500 ); // buffer length specified in milliseconds p.start(); System.out.println( "Player playing" ); Thread.sleep( 1000 ); System.out.println( " Clip is at time: " + p.getMediaTime().getSeconds() ); p.stop(); System.out.println( " Clip is at time: " + p.getMediaTime().getSeconds() );
bufferControl.setBufferLength(60 /* millis */);
if (bc != null) { int bl = 160; bc.setBufferLength(bl);
if (bc != null) { int bl = 160; bc.setBufferLength(bl);