TrackControl[] tracks = processor.getTrackControls(); processor.setContentDescriptor(cd); PacketSizeControl pktCtrl = (PacketSizeControl) processor.getControl(PacketSizeControl.class.getName()); if (pktCtrl != null) { try { dataOutput = processor.getDataOutput();
private synchronized boolean waitForState(Processor p, int state) { p.addControllerListener(new StateListener()); failed = false; // Call the required method on the processor if (state == Processor.Configured) { p.configure(); } else if (state == Processor.Realized) { p.realize(); } // Wait until we get an event that confirms the // success of the method, or a failure event. // See StateListener inner class while (p.getState() < state && !failed) { synchronized (getStateLock()) { try { getStateLock().wait(); } catch (InterruptedException ie) { return false; } } } return !failed; }
/** * Starts the transmission. Returns null if transmission started ok. * Otherwise it returns a string with the reason why the setup failed. * Starts receive also. * * @return result description */ public synchronized String start() { if (started) return null; // Create a processor for the specified jmf locator String result = createProcessor(); if (result != null) { started = false; } // Create an RTP session to transmit the output of the // processor to the specified IP address and port no. result = createTransmitter(); if (result != null) { processor.close(); processor = null; started = false; } else { started = true; } // Start the transmission processor.start(); return null; }
processor.removeControllerListener(processorControllerListener); processor.stop(); if (logger.isTraceEnabled()) logger + processor.hashCode()); if (processor.getState() == Processor.Realized) dataOutput = processor.getDataOutput(); processor.deallocate(); processor.close(); processorIsPrematurelyClosed = false;
processor.setContentDescriptor(AUDIO_CONTENT_DESCRIPTOR); if (!AUDIO_CONTENT_DESCRIPTOR.equals(cd)) for (TrackControl track : processor.getTrackControls()) processor.realize(); desc.dataSource = processor.getDataOutput(); processor.start();
TrackControl[] trackControls = player.getTrackControls(); player.setContentDescriptor(null); player.realize();
== null); localPlayer.addControllerListener( new ControllerListener() localPlayer.configure();
player.setContentDescriptor(null); player.realize(); player.start();
TrackControl[] tcs = player.getTrackControls();
if ((processor != null) && (processor.getState() >= Processor.Realized)) TrackControl[] trackControls = processor.getTrackControls();
|| ((processor.getState() < Processor.Realized) && !waitForState(processor, Processor.Realized))) outputDataSource = null; else outputDataSource = processor.getDataOutput(); if (logger.isTraceEnabled() && (outputDataSource != null))
/** * Starts a specific <tt>Processor</tt> if this <tt>MediaDeviceSession</tt> * has been started and the specified <tt>Processor</tt> is not started. * * @param processor the <tt>Processor</tt> to start */ protected void startProcessorInAccordWithDirection(Processor processor) { if (startedDirection.allowsSending() && (processor.getState() != Processor.Started)) { processor.start(); if (logger.isTraceEnabled()) { logger.trace( "Started Processor with hashCode " + processor.hashCode()); } } }
throw new IOException("Couldn't configure transcoding processor."); TrackControl[] trackControls = processor.getTrackControls(); throw new IOException("Couldn't realize transcoding processor."); DataSource outputDataSource = processor.getDataOutput();
/** * Stops the transmission if already started. * Stops the receiver also. */ public void stop() { if (!started) return; synchronized (this) { try { started = false; if (processor != null) { processor.stop(); processor = null; for (RTPManager rtpMgr : rtpMgrs) { rtpMgr.removeReceiveStreamListener(audioReceiver); rtpMgr.removeSessionListener(audioReceiver); rtpMgr.removeTargets("Session ended."); rtpMgr.dispose(); } sendStreams.clear(); } } catch (Exception e) { LOGGER.log(Level.WARNING, "exception", e); } } }
/** * Implements {@link DataSource#disconnect()}. Stops and undoes the whole * setup of the very transcoding process i.e. disconnects from the output * <tt>DataSource</tt> of the transcodingProcessor and disposes of the * <tt>transcodingProcessor</tt>. */ @Override public synchronized void disconnect() { if (outputDataSource == null) return; try { stop(); } catch (IOException ioex) { throw new UndeclaredThrowableException(ioex); } outputDataSource.disconnect(); transcodingProcessor.deallocate(); transcodingProcessor.close(); transcodingProcessor = null; outputDataSource = null; }
CaptureDeviceInfo webcamInfooo = new CaptureDeviceInfo("Camera", new MediaLocator("vfw://0"), null); MediaLocator camDeviceMediaLocator = webcamInfooo.getLocator(); DataSource source = Manager.createDataSource(camDeviceMediaLocator); Processor mediaProcessor = Manager.createRealizedProcessor(new ProcessorModel(source, FORMATS, CONTENT_DESCRIPTOR)); //MediaLocator outputMediaLocator = new MediaLocator("rtp://" + addr.getHostAddress() + ":" + PORT + "/video"); MediaLocator outputMediaLocator = new MediaLocator("rtp://192.168.1.6:20000/video"); DataSink dataSink = Manager.createDataSink(mediaProcessor.getDataOutput(), outputMediaLocator);
.addControllerListener(processorControllerListener); .removeControllerListener( processorControllerListener); processor = null;
@Override public void run() { // delay configuring the processors for the different // audio streams to decrease the probability that they // run together. try { int ms = 450 * (streamCount - 1); logger.warn("Sleeping for " + ms + "ms before" + " configuring processor for SSRC=" + ssrc+ " "+System.currentTimeMillis()); Thread.sleep(ms); } catch (Exception e) {} p.configure(); } }.run();