Format of Stream not supported in RTP Session Manager

Track 0 is set to transmit as:

unknown, 44100.0 Hz, 16-bit, Stereo, LittleEndian, Signed, 176400.0 frame rate, FrameSize=32 bits

java.io.IOException: Format of Stream not supported in RTP Session Manager

why this erro occors?

if need i put more code and more explanation here.

(was .wav)

[325 byte] By [dreampeppers99a] at [2007-11-27 4:14:26]
# 1
I already created the DataSink.When I try to do this...dsk.open(); //here the error gotdsk.start();
dreampeppers99a at 2007-7-12 9:20:48 > top of Java-index,Security,Cryptography...
# 2
java.io.IOException: Format of Stream not supported in RTP Session Managerat com.sun.media.datasink.rtp.Handler.open(Handler.java:139)The error stack.
dreampeppers99a at 2007-7-12 9:20:48 > top of Java-index,Security,Cryptography...
# 3

/**

*

*Class Server that you offers Streaming of midia

*

*/

public class Servidor {

private MediaLocator ml;

private Processor pro;

private javax.media.protocol.DataSource ds;

private DataSink dsk;

private boolean codificado = false;

//start the server service, passing the adress of media

// ex: d:\music\music.wav

// pass the ip and port, to make a server works

public void iniciarServicoServidor(String end,String ip, int porta)

{

try {

//capture media

capturarMidia(end);

//creates processor

criarProcessor();

// configure the processor

configurarProcessor();

//setContent RAW

descreverConteudoEnviado();

//format the media in right RTP format

formatRTP();

//creat the streaming

criarStreaming();

//configure the server

configurarServidor(ip, porta);

//in this method raise the excepition

iniciarServidor();

//when I try to open the DataSink.open() raises the exception

//java.io.IOException: Format of Stream not supported in RTP Session //Manager

//at com.sun.media.datasink.rtp.Handler.open(Handler.java:139)

} catch (RuntimeException e) {

System.out.println("Houve um erro em iniciarServicoServidor");

e.printStackTrace();

}

}

public void capturarMidia(String endereco)

{

try {

System.out.println("**************************************************************");

System.out.println("Iniciando processo de servidor de multimidia em " + Calendar.getInstance().getTime().toString());

ml = new MediaLocator("file:///" + endereco);

System.out.println("Midia realizada com sucesso.");

System.out.println ("[" + "file:///" + endereco +"]");

} catch (RuntimeException e) {

System.out.println("Houve um erro em capturarMidia");

e.printStackTrace ();

}

}

public void criarProcessor()

{

try {

System.out.println("**************************************************************");

pro = Manager.createProcessor(ml);

System.out.println("Processor criado com sucesso.");

System.out.println("Midia com durcao:" + pro.getDuration().getSeconds());

} catch (NoProcessorException e) {

System.out.println("Houve um erro em criarProcessor");

e.printStackTrace();

} catch (IOException e) {

System.out.println ("Houve um erro em criarProcessor");

e.printStackTrace();

}

}

public void configurarProcessor()

{

try {

System.out.println("**************************************************************");

System.out.println("Processor em estado de configura玢o.");

pro.configure();

System.out.println("Processor configurado.");

} catch (RuntimeException e) {

System.out.println("Houve um erro em configurarProcessor");

e.printStackTrace();

}

}

public void descreverConteudoEnviado()

{

try {

System.out.println("**************************************************************");

pro.setContentDescriptor(new ContentDescriptor(ContentDescriptor.RAW));

System.out.println("Descritor de conteudo:" + pro.getContentDescriptor().toString());

} catch (NotConfiguredError e) {

System.out.println("Houve um erro em descreverConteudoEnviado");

e.printStackTrace();

}

}

private Format checkForVideoSizes(Format original, Format supported) {

int width, height;

Dimension size = ((VideoFormat)original).getSize();

Format jpegFmt = new Format(VideoFormat.JPEG_RTP);

Format h263Fmt = new Format(VideoFormat.H263_RTP);

if (supported.matches(jpegFmt)) {

// For JPEG, make sure width and height are divisible by 8.

width = (size.width % 8 == 0 ? size.width :

(int)(size.width / 8) * 8);

height = (size.height % 8 == 0 ? size.height :

(int)(size.height / 8) * 8);

} else if (supported.matches(h263Fmt)) {

// For H.263, we only support some specific sizes.

if (size.width < 128) {

width = 128;

height = 96;

} else if ( size.width < 176) {

width = 176;

height = 144;

} else {

width = 352;

height = 288;

}

} else {

// We don't know this particular format. We'll just

// leave it alone then.

return supported;

}

return (new VideoFormat(null,

new Dimension(width, height),

Format.NOT_SPECIFIED ,

null,

Format.NOT_SPECIFIED)).intersects(supported);

}

public void formatRTP()

{

try {

// Program the tracks.

TrackControl tracks[] = pro.getTrackControls();

Format supported[];

Format chosen;

for (int i = 0; i < tracks.length; i++) {

Format format = tracks[i].getFormat();

if (tracks[i].isEnabled()) {

supported = tracks[i].getSupportedFormats();

// We've set the output content to the RAW_RTP.

// So all the supported formats should work with RTP.

// We'll just pick the first one.

if (supported.length > 0) {

if (supported[0] instanceof VideoFormat) {

// For video formats, we should double check the

// sizes since not all formats work in all sizes.

chosen = checkForVideoSizes(tracks[i].getFormat(),

supported[0]);

} else

chosen = supported[0];

tracks[i].setFormat(chosen);

System.err.println("Track " + i + " is set to transmit as:");

System.err.println(" " + chosen);

codificado = true;

} else

tracks[i].setEnabled(false);

} else

tracks[i].setEnabled(false);

}

} catch (RuntimeException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

public void tocar()

{

pro.start();

}

public void criarStreaming()

{

try {

System.out.println("**************************************************************");

if (codificado)

{

System.out.println("Midia codificada...");

System.out.println("Processor entra em estado de realize.");

pro.realize();

System.out.println("Processor realized.");

System.out.println("Adquirindo o streaming a ser enviado.");

ds = pro.getDataOutput();

System.out.println("Streaming adquirido pronto a ser enviado.");

}

} catch (NotRealizedError e) {

System.out.println("Houve um erro em criarStreaming");

System.out.println(e.getMessage());

e.printStackTrace();

}

catch (Exception e) {

System.out.println(e.getMessage());

}

}

public void configurarServidor(String ip, int porta)

{

System.out.println("**************************************************************");

String url = "rtp://" + ip + ":" + porta + "/audio/1";

System.out.println("Servidor ira atender em " + url);

MediaLocator mml = new MediaLocator(url);

System.out.println("Localizador de midia ja criado");

try {

System.out.println("Criando um DataSink a ser enviado.");

dsk = Manager.createDataSink(ds, mml);

System.out.println("DataSink criado.");

} catch (NoDataSinkException e) {

e.printStackTrace();

}

}

public void iniciarServidor()

{

try {

System.out.println("**************************************************************");

dsk.open();

System.out.println("Servidor ligado.");

dsk.start();

System.out.println("Servidor iniciado.");

} catch (SecurityException e) {

e.printStackTrace();

} catch (IOException e) {

e.printStackTrace();

}

}

}

Gives that output console.

All methods are executed but the last doesnt works.

The method that open the DataSink.

What can I do?

**************************************************************

Iniciando processo de servidor de multimidia em Sun May 13 22:37:02 BRT 2007

Midia realizada com sucesso.

[file:///c:\radio.wav ]

**************************************************************

Processor criado com sucesso.

Midia com durcao:9.223372036854776E9

**************************************************************

Processor em estado de configura玢o.

Processor configurado.

**************************************************************

Descritor de conteudo:RAW

**************************************************************

Midia codificada...

Processor entra em estado de realize.

Processor realized.

Adquirindo o streaming a ser enviado.

Streaming adquirido pronto a ser enviado.

**************************************************************

Servidor ira atender em rtp://127.0.0.1:22000/audio/1

Localizador de midia ja criado

Criando um DataSink a ser enviado.

streams is [Lcom.sun.media.multiplexer.RawBufferMux$RawBufferSourceStream;@a0dcd9 : 1

sink: setOutputLocator rtp://127.0.0.1:22000/audio/1

DataSink criado.

**************************************************************

Track 0 is set to transmit as:

unknown, 44100.0 Hz, 16-bit, Stereo, LittleEndian, Signed, 176400.0 frame rate, FrameSize=32 bits

java.io.IOException: Format of Stream not supported in RTP Session Manager

at com.sun.media.datasink.rtp.Handler.open(Handler.java:139)

at br.org.multimidiasi.motor.Servidor.iniciarServidor(Servidor.java:291)

at br.org.multimidiasi.motor.Servidor.iniciarServicoServidor(Servidor.java:43)

at br.org.multimidiasi.motor.ConsoleServidor.main(ConsoleServidor.java:30)

****************************************************************************

Since already thanks so much.

Message was edited by:

dreampeppers99

dreampeppers99a at 2007-7-12 9:20:48 > top of Java-index,Security,Cryptography...
# 4

Exactally in this method raises erros.

public void iniciarServidor()

{

try {

System.out.println("**************************************************************");

dsk.open();

System.out.println("Servidor ligado.");

dsk.start();

System.out.println("Servidor iniciado.");

} catch (SecurityException e) {

e.printStackTrace();

} catch (IOException e) {

e.printStackTrace();

}

}

Track 0 is set to transmit as:

unknown, 44100.0 Hz, 16-bit, Stereo, LittleEndian, Signed, 176400.0 frame rate, FrameSize=32 bits

java.io.IOException: Format of Stream not supported in RTP Session Manager

at com.sun.media.datasink.rtp.Handler.open(Handler.java:139)

at br.org.multimidiasi.motor.Servidor.iniciarServidor(Servidor.java:291)

at br.org.multimidiasi.motor.Servidor.iniciarServicoServidor(Servidor.java:43)

at br.org.multimidiasi.motor.ConsoleServidor.main(ConsoleServidor.java:30)

dreampeppers99a at 2007-7-12 9:20:48 > top of Java-index,Security,Cryptography...