Comunicacion en java rtp

Solo disponible en BuenasTareas
  • Páginas : 2 (391 palabras )
  • Descarga(s) : 0
  • Publicado : 9 de diciembre de 2011
Leer documento completo
Vista previa del texto
package Transmision;
import java.io.IOException;
import java.util.Vector;
import javax.media.CaptureDeviceInfo;
import javax.media.CaptureDeviceManager;
import javax.media.DataSink;
importjavax.media.Manager;
import javax.media.MediaLocator;
import javax.media.NoPlayerException;
import javax.media.NoProcessorException;
import javax.media.NotRealizedError;
import javax.media.Player;import javax.media.Processor;
import javax.media.control.FormatControl;
import javax.media.control.TrackControl;
import javax.media.format.AudioFormat;
importjavax.media.protocol.ContentDescriptor;
import javax.media.protocol.DataSource;
public class SimpleVoiceTransmiter {
/**
* @param args
*/
public static void main(String[] args) {
// First find a capture device that willcapture linear audio
// data at 8bit 8Khz
AudioFormat format= new AudioFormat(AudioFormat.LINEAR,8000,8,1);
Vector devices= CaptureDeviceManager.getDeviceList( format);CaptureDeviceInfo di= null;
if (devices.size() > 0) {
di = (CaptureDeviceInfo) devices.elementAt( 0);
}
else {
// exit if we could not find the relevant capturedevice.
System.exit(-1);}
// Create a processor for this capturedevice & exit if we
// cannot create it
Processor processor = null;
try {
processor = Manager.createProcessor(di.getLocator());} catch (IOException e) {
System.exit(-1);
} catch (NoProcessorException e) {
System.exit(-1);
}

// configure the processor
processor.configure();
while(processor.getState() != Processor.Configured){
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}processor.setContentDescriptor(
new ContentDescriptor( ContentDescriptor.RAW));
TrackControl track[] = processor.getTrackControls();
boolean encodingOk = false;
// Go through...
tracking img