Rtp session problem

HI, I’m using a custom data source for jmf to send audio over a RTPManager using javasound for capturing live audio from a microphone and at the same time receiving audio from a RTP session using jmf, the code for the custom data Source is one posted in here a while ago which is working fine the problem is that when I start sending audio the incoming audio stop but the sound is send correctly to the other part, so if a don’t send audio I get the audio from the rtp session if I send audio I don’t listen the incoming audio, I’m only talking of one side of the call because the other part is sending the rtp session by a sip server that is connected to a regular phone line and I don’t know exactly how that work I only know that works. anyone know what can be wrong with this? Can it be a buffer problem? Or a blocking device or just a error on the code? Thanks in advance.

Your question doesn't make a whole lot of sense, but I'd assume you've coded something incorrectly.

Similar Messages

  • JMF error - Format of Stream not supported in RTP Session Manager

    java.io.IOException: Format of Stream not supported in RTP Session Manager
    at com.sun.media.datasink.rtp.Handler.open(Handler.java:139)
    why this erro occors?
    I already created the DataSink.
    When I try to do this...
    dsk.open(); //here the error got
    dsk.start();     Code of server of media
    I want to sent audio (wav) like a radio, but from file. Without stop to send streaming. PullBufered
    *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.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.
    Exactally in this method raises erros.
    Ive tried another formats (avi, mp3) but all with the same error, what I can do?
    [code] 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)

    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
    The fact that it doesn't know what the format is
    might have to do with the problem. I've had similar
    problems, and I've traced it back to missing jars and
    codecs. Have you tried running the same code locally
    without the transmission to see if you player will
    even play the file?Already and it works, I used Player to play it and play normally, I try to make it with the diferents codecs of audio and video, but no sucess.

  • Help on RTP session!

    Actually, i'm currently testing a java program that can send voice through the network but i faced problem on only windows 2000. I had tested on windows 98, windows Xp and windows 2000 locally. But when i send voice over 2 windows 2000 PCs, this error come out - "Cannot create the RTP session: Can't open local data port: 12468". Can anybody tell me what is the error means? Thank you.

    Sorry by my english im from spain.
    The problem is in the transmiter because he send the stream by the same port that the receiver will go to receive.
    I change this code in AVTransmiter2
    private String createTransmitter() {
    int port,port2;
    port2 =portBase - 2*i -2;
    localAddr = new SessionAddress( InetAddress.getLocalHost(),port2);
    And now you can utilice in the same mahine AVTransmit2 and AVReceive2.
    PD: if you want have the sound in mpg archive you must put in AvReceive other sesion with the port + 2.

  • RTP transmition problems!!!

    I write a application that send video stream to the other PC. The RTP transimition code is like the AVTransmit sample. It works well.but when I want to close or shut down my RTP transmition, there is a big problem that how can I close it absolutely without qiut the application. The close method is like this:
    public void stopTrans()
    //synchronized (this)
    if (processor != null)
    processor.stop();
    processor.close();
    processor = null;
    for (int i = 0; i < rtpMgrs.length; i++)
    rtpMgrs.removeTargets("Session ended.");
    rtpMgrs[i].dispose();
    rtpMgrs[i] = null;
    rtpMgrs = null;
    when I press the send button to start a new transmition again, there is a exception said:
    Can not create RTP session: javax.media.rtp.InvalidSessionAddressException: Can't open local data port: 3000
    port 3000 is the port number I used last time. So if I want to create transmition again using the same port, it failed. Why , how can I release the port form a RTP transmition? Please help me. Thank you very much.

    I have exactly the same problem with Rick.T, that is I cant use the same port 2nd time.... I get the message "can't open local data port xxxxx"
    For every unicast session I use 4 ports per client, 2 to transmit (video-audio) 2 to receive (video-audio). So, it doesnt make sense to use every time new ports...
    I have tried to close/stop/deallocate the Processor, to stop/disconnect DataSource, to stop/close SendStream and of course to removeTargets/dispose the RTPManager.... But I still face the same problem
    Its the very final stage of my project and I dont know what else to try....
    I have searched for other similar topics here but there is no answer to that problem.
    Is there anyone who has the solution to release the ports??
    thanx in advance

  • Video RTP transmittion problem

    Hey guys (and girls),
    I'm writing two programs that either send or receive a RTP video stream captured with a webcam. Using JMStudio I can capture and transmit the video and happily receive it with my client program, but when I try to capture and transmit the video using my server program the client can't realize because it's not got any data.
    Here is my transmitter code, my server class creates a new instance of the camTransmitter class.
    import java.io.*;
    import java.awt.*;
    import java.util.Vector;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.media.*;
    import javax.media.format.*;
    import javax.media.protocol.*;
    import javax.media.control.*;
    import javax.media.ControllerListener;
    import javax.media.rtp.*;
    import javax.media.rtp.rtcp.*;
    import javax.media.rtp.event.*;
    import javax.media.rtp.SendStreamListener.*;
    import java.net.InetAddress;
    public class camTransmitter implements ControllerListener
         Processor p = null;
         CaptureDeviceInfo di = null;
         boolean configured, realized = false;
         public String ipAddress = "192.168.123.150";
         public int port = 22222;
         public RTPManager rtpMgrs[];
         public DataSource vDS;
         public SessionAddress localAddr, destAddr;
         public InetAddress ipAddr;
         public SendStream sendStream;
        public camTransmitter()
         // First, we'll need a DataSource that captures live video
         Format vFormat = new VideoFormat(VideoFormat.RGB);
         Vector devices = CaptureDeviceManager.getDeviceList(vFormat);
         if (devices.size() > 0)
              di = (CaptureDeviceInfo) devices.elementAt(0);
         else
              // exit if we could not find the relevant capture device.
              System.out.println("no devises");          
              System.exit(-1);
         MediaLocator camLoctation = di.getLocator();
         // Create a processor for this capture device & exit if we
         // cannot create it
         try
              vDS = Manager.createDataSource(camLoctation);
              p = Manager.createProcessor(vDS);
              p.addControllerListener(this);
         catch (IOException e) {
              System.exit(-1);
         }catch (NoProcessorException e) {
              System.exit(-1);
         }catch(NoDataSourceException e) {
              System.exit(-1);
         // at this point, we have succesfully created the processor.
         // Realize it and block until it is configured.
         p.configure();
         while(configured != true){}
         // block until it has been configured
         p.setContentDescriptor(new ContentDescriptor(ContentDescriptor.RAW_RTP));
         TrackControl track[] = p.getTrackControls();
         boolean encodingOk = false;
         // Go through the tracks and try to program one of them to
         // output ULAW_RTP data.
         for (int i = 0; i < track.length; i++)
              if (!encodingOk && track[i] instanceof FormatControl)
                   if (((FormatControl)track).setFormat(vFormat) == null)
                        track[i].setEnabled(false);
                   else
                        encodingOk = true;
              else
                   // we could not set this track to gsm, so disable it
                   track[i].setEnabled(false);
         // Realize it and block until it is realized.
         p.realize();
         while(realized != true){}
         // block until realized.
         // get the output datasource of the processor and exit
         // if we fail
         DataSource ds = null;
         try
              ds = p.getDataOutput();
         catch (NotRealizedError e)
              System.exit(-1);
         PushBufferDataSource pbds = (PushBufferDataSource)ds;
         PushBufferStream pbss[] = pbds.getStreams();
         rtpMgrs = new RTPManager[pbss.length];
         for (int i = 0; i < pbss.length; i++) {
         try {
              rtpMgrs[i] = RTPManager.newInstance();
              ipAddr = InetAddress.getByName(ipAddress);
              localAddr = new SessionAddress(InetAddress.getLocalHost(),port);
              destAddr = new SessionAddress(ipAddr, port);
              System.out.println(localAddr);
              rtpMgrs[i].initialize(destAddr);
              rtpMgrs[i].addTarget(destAddr);
              System.out.println( "Created RTP session: " + ipAddress + " " + port);
              sendStream = rtpMgrs[i].createSendStream(ds, i);          
              sendStream.start();
         } catch (Exception e) {
              System.err.println(e.getMessage());
         //System.out.println("RTP Stream created and running");
    public void controllerUpdate(ControllerEvent e)
         if(e instanceof ConfigureCompleteEvent)
              System.out.println("Configure Complete");
              configured = true;
         if(e instanceof RealizeCompleteEvent)
              System.out.println("Ralizing complete");
              realized = true;
    When I run this the processor realizes and the RTP seems to stream, but I have no idea why I can't receive the video from this.
    Pls help if anyone can Thanks

    Dear andreyvk ,
    I've read your post
    http://forum.java.sun.com/thread.jspa?threadID=785134&tstart=165
    about how to use a single RTP session for both media reception and trasmission (I'm referring to you RTPSocketAdapter modified version), but, at the moment, I'receive a BIND error.
    I think that your post is an EXCELLENT solution. I'modified AVReceive3 and AVTransmit3 in order to accept all parameters (Local IP & Port, Remote IP & Port).
    Can you please give me a simple scenario so I can understand what the mistake?
    I'use AVTransmit3 and AVReceive3 from different prompts and if I run these 2 classes contemporarely both in 2 different PC (172.17.32.27 and 172.17.32.30) I can transmit the media (vfw://0 for example) using AVTransmit3 but I'can't receive nothing if I run also AVReceive3 in the same PC?
    What's the problem? Furthermore, If I run first AVReceive3 from a MSDOS Prompt and subsequently I run AVTransmit3 from another prompt I see a BIND error (port already in use).
    How can I use your modified RTPSocketAdapter in order to send and receive a single media from the same port (e.g. 7500).
    I've used this scenario PC1: IP 172.17.32.30 Local Port 5000 and PC2:IP 172.17.32.27 LocalPort 10000
    So in the PC1 I run:
    AVTransmit3 vfw://0 <Local IP 172.17.32.30> <5000> <Remote IP 172.17.32.27> <10000>
    AVReceive3 <Local IP 172.17.32.30/5000> <Remote IP 172.17.32.27/10000>
    and in PC2:
    AVTransmit3 vfw://0 <Local IP 172.17.32.27> <10000> <Remote IP 172.17.32.30> <5000>
    AVReceive3 <Local IP 172.17.32.27/10000> <Remote IP 172.17.32.30/5000>
    I'd like to use the same port 5000 (in PC1) and 10000 (in PC2) in order to transmit and receive rtp packets. How can i do that without receive a Bind Error? How can I receive packets (and playing these media if audio &/or video) from the same port used to send stream over the network?
    How can I obtain a RTP Symmetric Transmission/Reception solution?
    Please give me an hint. If you can't post this is my email: [email protected]

  • Rtp transmitting problem

    i am passing with a problem.......
    i read in JMF api that are three methods to transmit voice onthe network
    1-e a MediaLocator that has the parameters of the RTP session to construct an RTP DataSink by calling Manager.createDataSink.
    2-e a session manager to create send streams for the content and control the transmission.
    3-through sockets..
    i got the code for ist method of datasinking....
    but i dont know that how to get this string....
    that is url
    // hand this datasource to manager for creating an RTP
    // datasink our RTP datasimnk will multicast the audio
    try {
    String url= "rtp://224.144.251.104:49150/audio/1";
    MediaLocator m = new MediaLocator(url);
    DataSink d = Manager.createDataSink(ds, m);
    d.open();
    d.start();
    } catch (Exception e) {
    System.exit(-1);
    }

    I've faced a similar problem, what I did was to use TWO session managers, one for transmitter and the other for receiver. I then used this objects in a container.
    Both peer use the same port, and know each other's address.
    For receiving data from the peer I do:
    RTPManager mymgr = RTPManager.newInstance();
    // add as listener to create players for each incoming stream
    mymgr.addReceiveStreamListener(this);
    SessionAddress localaddr =new SessionAddress( InetAddress.getLocalHost(), port);
    SessionAddress sessaddr = new SessionAddress( peerAddress, port);
    mymgr.initialize(localaddr);
    mymgr.addTarget( sessaddr);For transmitting data to the peer I do:
    RTPManager mymgr = RTPManager.newInstance();
    // add as listener to create players for each incoming stream
    mymgr.addReceiveStreamListener(this);
    SessionAddress localaddr =new SessionAddress( InetAddress.getLocalHost(), SessionAddress.ANY_PORT);
    SessionAddress sessaddr = new SessionAddress( peerAddress, port);
    mymgr.initialize(localaddr);
    mymgr.addTarget( sessaddr);
    // the processor is capturing audio from the mic
    processor.start();
    SendStream sendStream = mymgr.createSendStream(processor.getDataOutput(), i);
    sendStream.start();I probably forgot something when doing copy paste from my code... but I think this might help you
    Good luck
    Marco

  • Cannot create the RTP Session: Can't open local data port

    Hi,
    I'm trying to connect to two webcams simultaneously in the order:
    MediaLocator inputLocator1 = new MediaLocator("rtp://hostname1:8000/video");
    MediaLocator inputLocator2 = new MediaLocator("rtp://hostname2:8000/video");
    But I get this during the second connection:
    Cannot create the RTP Session: Can't open local data port: 8000
    And I can't see the video from hostname2.
    I did a check via netstat, and it seems that both mycomputer is receiving the video from both hostname1 & hostname2:
    TCP mycomputer:3236 hostname1:8000 ESTABLISHED
    TCP mycomputer:3264 hostname2:8000 ESTABLISHED
    TCP connections to both host were established!! But why can't I see the video of hostname2???? I've thought of 2 possible reasons why I cannot see the video of hostname2:
    1. Is this set of local data port maintained by Java? i.e It's not the same as the TCP port 8000 that I see in mycomputer's netstat. If yes, Java has assigned its local data port 8000 to hostname1, so it fails to reassign that port 8000 to hostname2 while hostname1 is still connected. Any other way to fix this apart from changing the portnumber of hostname2?
    2. It has to do with the custom.jar? I've read in an article somewhere in the forum that the custom.jar has to be customized (using JFMCustomizer) to receive video from two hosts with the same portnumber. Can someone elaborate the necessary boxes to check in the JFMCustomizer?
    Thanks much,
    Rach

    After all this while, I finally figured out the problem. In my code, I use MediaLocator to code the receiver and the transmitter. E.g.:
    MediaLocator inputLocator1 = new MediaLocator("rtp://hostname1:8000/video");
    player1 = Manager.createPlayer(inputLocator1)
    MediaLocator inputLocator2 = new MediaLocator("rtp://hostname2:8000/video");
    player2 = Manager.createPlayer(inputLocator2)
    Manager would complain "Cannot create the RTP Session: Can't open local data port: 8000" because port 8000 is already used up by player1, i.e.:
    mycomputer:8000 maps to hostname1:8000
    mycomputer:8000 cannot re-map to hostname2:8000
    To work around this, I'll need to use SessionAddress. SessionAddress provides the flexibility to do an independent local port mapping, e.g.:
    mycomputer:5000 maps to hostname1:8000
    mycomputer:5002 maps to hostname2:8000
    Rach

  • Java Session problem while sending mail(using javamail) using Pl/SQL

    Hello ...
    i am using Java stored procedure to send mail. but i'm getting java session problem. means only once i can execute that procedure
    pls any help.

    props.put("smtp.gmail.com",host);I doubt javamail recognizes the 'smtp.gmail.com' property. I think it expects 'mail.host'. Of course since it cannot find a specified howt it assumes by default localhost
    Please format your code when you post the next time, there is a nice 'code' button above the post area.
    Mike

  • NoPlayerException in a RTP session

    hi, I'm learning jmf and follow the jmf2_0-guide. However, when I run the following code, it always says "Error:javax.media.NoPlayerException: Cannot find a Player for :rtp://192.168.1.22:8080/jmfstudy/testMedia.avi". 192.168.1.22:8080 is my ip and port. Could anyone help me?Thanks.
    String url = "rtp://192.168.1.22:8080/jmfstudy/testMedia.avi";
              MediaLocator mrl = new MediaLocator(url);
              if (mrl == null) {
                   System.err.println("Can't build MRL for RTP");
                   return false;
              // Create a player for this rtp session
              try {
                   player = Manager.createPlayer(mrl);
              } catch (NoPlayerException e) {
                   System.err.println("Error:" + e);
                   return false;
              } catch (MalformedURLException e) {
                   System.err.println("Error:" + e);
                   return false;
              } catch (IOException e) {
                   System.err.println("Error:" + e);
                   return false;
              }

    Thank you. I use Tomcat as my server and when I visit "http://192.168.1.22:8080/jmfstudy/testMedia.avi" my media player startup and play the movie. But it doesn't work in my programme.

  • Session problem in jsp application

    I face a session problem. I setting everything in a session and when pass back to a main page, the value is not display in the screen. But after refresh the value will display in the screen and this kind of problem only come out very few time and i dun knw how to solve this...
    Anyone here can give me some idea and suggestion or the way to solve this kind of problem!!!

    define "2 different clients"
    1) You have 2 different PCs and it's using the same session ID for both? I doubt this. I think the server is advanced enough not to use give a session ID that's already been created.
    2) You have 1 PC and are using IE or Netscape and using File > New Window to open a new window and connect again. This you can't fix without using only URL rewriting to manage session, because the different windows will share the same session cookies.

  • Cannot create the RTP Session

    we have made multithread rtp streaming server and tried to transmit the mpg file in a applet on a web page using tom-cat server.
    we got the following error...
    Cannot create the RTP Session: Local Data AddressDoes not belong to any of this hosts local interfaces
    Failed to initialize the sessions.
    java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkExit(Unknown Source)
         at java.lang.Runtime.exit(Unknown Source)
         at java.lang.System.exit(Unknown Source)
         at Receive.start(MyPlayer.java:90)
         at MyPlayer.start(MyPlayer.java:30)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)

    I am really surprised that no one has answer for my query?????

  • Help with RTP: Format of Stream not supported in RTP Session Manager

    Hello everyone,
    I am quite new to JMF and RTP. So far I've succeeded in capturing audio from the microphone and playing it back. However, I failed when I tried to send the stream over using RTP.
    Here's my program, all it does is: get a DataSource from the CaptureDevice, create a Processor with that DataSource, convert the tracks in the Processor to one of the RTP formats, and create an RTP SendStream using the Processor's output DataSource.
    I can hear sound by creating a Player for the DataSource; however I get errors when I try to create RTP SendStream for the same output DataSource.
    Here's my code:
                CaptureDeviceInfo cdinfo;
                Format fmt = new AudioFormat(AudioFormat.LINEAR, 8000, 8, 1);
                Vector deviceList = CaptureDeviceManager.getDeviceList(fmt);
                if (deviceList.size() > 0) {
                    System.out.println("Device Found.");
                    cdinfo = (CaptureDeviceInfo) deviceList.firstElement();
                } else {
                    System.out.println("No device!");
                    return;
                DataSource ds = Manager.createDataSource(cdinfo.getLocator());
                Processor processor = Manager.createProcessor(ds);
                StateHelper sh = new StateHelper(processor);
                if (!sh.configure(10000)) {
                    System.out.println("Could not configure...");
                    System.exit(-1);
                // Get the track control objects
                TrackControl track[] = processor.getTrackControls();
                System.out.println("Number of tracks:" + track.length);
                boolean encodingPossible = false;
                // Go through the tracks and try to program one of them to outout some "RTP format"
                for (int i = 0; i < track.length; i++) {
                    try {
                        track.setFormat(new AudioFormat(AudioFormat.DVI_RTP));
    encodingPossible = true;
    } catch (Exception e) {
    // cannot convert
    track[i].setEnabled(false);
    if (!encodingPossible) {
    System.out.println("Could not encode..");
    sh.close();
    return;
    processor.setContentDescriptor(new ContentDescriptor(ContentDescriptor.RAW));
    if (!sh.realize(10000)) {
    System.out.println("Could not realize...");
    System.exit(-1);
    System.out.println("Realized...");
    DataSource outSource = processor.getDataOutput();
    System.out.println(outSource.getContentType());
    processor.start();
    player = Manager.createRealizedPlayer(outSource);
    player.start();
    SessionAddress addr = new SessionAddress(InetAddress.getByName("224.144.251.104"), 8194, 4);
    manager.initialize(addr);
    //manager.addFormat(new AudioFormat(AudioFormat.GSM_RTP), 1);
    System.out.println("RTP Session started...");
    stream = manager.createSendStream(processor.getDataOutput(), 0);
    I get an error on the last line, the error is: javax.media.format.UnsupportedFormatException: Format of Stream not supported in RTP Session Manager And again, if I try to encode the tracks into *AudioFormat.GSM_RTP* instead of *DVI_RTP*, I get a different error on the same line:Exception in thread "AWT-EventQueue-0" java.lang.NullPointerExceptionWell I don't understand what's happening, is there something I need to do before I can use RTP?
    Hope you guys help :)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi,
    seems that you are encoding a track to RTP format but outputting a RAW format.
    Your encoding section is also a little bit lazy as you don't check supported formats...
    Try this between configured and realized state:
              // Get the tracks from the processor
              TrackControl [] tracks = processor.getTrackControls();
              // Do we have at least one track?
              if (tracks == null || tracks.length < 1)
                  return "Couldn't find tracks in processor";
              // Set the output content descriptor to RAW_RTP
              // This will limit the supported formats reported from
              // Track.getSupportedFormats to only valid RTP formats.
              ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);
              processor.setContentDescriptor(cd);
              Format supported[];
              Format chosen;
              boolean atLeastOneTrack = false;
              // Program the tracks.
              for (int i = 0; i < tracks.length; i++) {
                  Format format = tracks.getFormat();
              log.info("Input format for RTP conversion: " + format);
              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.
                   if (supported.length > 0) {
                        if (supported[i] instanceof VideoFormat) {
                             tracks[i].setEnabled(false);
                             continue;
                   else if (supported[i] instanceof AudioFormat) {
                        // set audio format for RTP transmission
                        chosen = new AudioFormat(AudioFormat.DVI_RTP);
                        tracks[i].setFormat(chosen);
                        tracks[i].setEnabled(true);
                        atLeastOneTrack = true;
                   else
                        tracks[i].setEnabled(false);
                   else
                   tracks[i].setEnabled(false);
              else
                   tracks[i].setEnabled(false);
              if (!atLeastOneTrack)
              return "Couldn't set any of the tracks to a valid RTP format";
    The important thing should be theContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);part.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Session problem in a new window created by window.open()

    hello,
    I have a drugsearch.jsp page, I sessioned an durgCollection object on this jsp page using session.setAttribute("drugCollection",drugCollection);
    there is a link on this jsp which will call a javascript to open a new window .
    here is the javascript to open another new window:
    function openReportWindow()
    window.open("/drug/Report.jsp","report", "toolbar,scrollbars,width=800,height=800,left=100,top=10");
    but in the Report.jsp, I won't be able to get the same session object as in the calling jsp ( drugsearch.jsp) by calling session.getAttribute("drugCollection").
    if I change the link on drugsearch.jsp to link to the Report.jsp directly instead of opening a new window, then I can get the same session object from the Report.jsp.
    what's the problem? can someone give me an advice?
    thanks

    A session is assosiated with one client(browser).
    when you open a new browser, a new session is created. In order to have common place for both the browsers, try storing the data in the 'Servlet Context'

  • Session problem in ADF BC

    We have an application developed in Jdev 10.1.3.4 (JSP, Struts, ADF BC) and running on OAS. Now we have a big problem with session, hope somebody can help with some ideas.
    We set session time to 45 min in the web.xml. The problem is that sometimes some user work on a page with form,for instance performing some edit activity. If he/she leave the page open inactive for more than 45 minutes and come back from lunch, press the ’save’ button, the application would then commit the change to the wrong row in database, most probably the top row in the View Object(VO) instance. This is because the application module actually does a rollback when session expires, it loses all user data.(e.g. row currency in VO instance).
    To avoid saving wrong data to the wrong place, we implemented a session Filter(see att. Below: ApplicationSessionExpiryFilter.java) to catch session time-out and forward request to an error page alerting user that their session has expired due to long time of inactivity. The Filter works as it should but it gives another problem. If user already has one of our application page open for very long time and open another page in a new browser (e.g. click a link from an email), he/she will get session-expire error immediately in the new browser. I guess it is because the session in the first browser already expires and the newly opened the browser shares the same session with the first one. That is how browsers works, we can do nothing about it.
    But our users are of course not very happy about getting the session errors in a newly opened browser. So we tried implementing a heartbeat funtion in AJAX(see att. Below: Heartheat.html and Template.jsp) to keep the session alive until the page is closed. Basically what we do is adding an invisible div tag in every jsp page and invoke AJAX funtion to periodically update the div tag with a small html page. In this way, a request is being sent to the server every 5 minutes thus the session should be kept alive until the page/browser is closed.
    It sounds to us like a very logical solution but it doesn’t work very properly. We sometimes still get the session error page immediately after opening a new page while we have another page open for long time.
    Could anyone please help to look at our Filter and heatbeat funtion? Is there anything wrong with our Filter or the heartbeat? Why does the session still expire before we close the page?
    All we do here is to try to avoid the initial probelm with saving data after session and the application module expires. If anyone has a better solution to this problem, we would very much like to try. Appreciate if anyone can share some ideas!
    Thanks in advance!
    *1. ApplicationSessionExpiryFilter.java*
    public class ApplicationSessionExpiryFilter implements Filter {
    private FilterConfig _filterConfig = null;
    public void init(FilterConfig filterConfig) throws ServletException {
    _filterConfig = filterConfig;
    public void destroy() {
    _filterConfig = null;
    public void doFilter(ServletRequest request, ServletResponse response,
    FilterChain chain) throws IOException, ServletException {
    HttpServletRequest httpRequest = (HttpServletRequest)request;
    boolean sessionInvalid = false;
    if(httpRequest.getRequestedSessionId() != null) {
    if(!httpRequest.isRequestedSessionIdValid()) {
    if (!httpRequest.getRequestURI().endsWith("sessionExpired.do")) {
    sessionInvalid = true;
    if (sessionInvalid) {
    ((HttpServletResponse) response).sendRedirect(_filterConfig.getInitParameter("SessionTimeoutRedirect"));
    else {
    chain.doFilter(request, response);
    *2. Heartheat.html* (A small html page to be invoked by template.jsp periodically)
    <html>
    <head>
    <META Http-Equiv="Cache-Control" Content="no-cache, must-revalidate">
    <META Http-Equiv="Pragma" Content="no-cache">
    <META Http-Equiv="Expires" Content="Expires: Mon, 26 Jul 1997 05:00:00 GMT">
    </head>
    <body>
    heartbeat to keep session alive!
    </body>
    </html>
    *3. Template.jsp* (Template page to be extended by all jsp pages, invoke heart.html every 5 min)
    <Html>
    <body>
    <div id="heartbeat" style="display:none">
    </div>
    <script type="text/javascript" language="javascript">
    new Ajax.PeriodicalUpdater('heartbeat','jsp/template/heartbeat.html',{ method: 'post', frequency: 300, decay: 1 }); // update heartbeat.html every 300 sec(5min)
    </script>
    </body></html>

    Hi Shay,
    Reviewing ADFContex methods it seems that this object shouldn't be accessible from BC. Example:
    public static ADFContext initADFContext(java.lang.Object context,
                                            java.lang.Object session,
                                            java.lang.Object request,
                                            java.lang.Object response)
        Initializes the ADFContext for the environment of the specified context.
        Parameters:
            context - the ServletContext or PortletContext of the current execution environment.
            session - the HttpSession or PortletSession of the current execution environment. OPTIONAL.
            request - the HttpServletRequest or PortletRequest of the current execution environment. OPTIONAL.
            response - the HttpServletResponse or PortletResponse of the current execution environment. OPTIONAL.
        Returns:
            the ADFContext that was current when init was invoked. Should be passed back to resetADFContext after the block requiring the ADFContext has completed.Kuba

  • Urgent: Sessions problem pls help me

    Hi all,
    Its already late to post this problem.pls help me urgently.
    I have a servlet & two jsp's. first i request servlet, it processes something and forwards request to my first jsp. In that jsp on a button click, i'm displaying a new popup by calling showModalDialog. this dialog gets data from the same servlet but it forwards to my second jsp.(second jsp can be seen in dialog)
    Now if i submit form from my second(dialog) jsp, the servlet reports that session has expired. I tried a lot but invain. any one who helps me is appreciated well by all of our forum.
    waiting 4 u r reply,

    It could be that you have cookies turned off and you're not using URL Rewriting.
    In J2EE, the first time your browser makes a request to the server, the server responds and appends a SESSION_ID parameter to the request as well as storing a cookie with the SESSION_ID.
    The second time your browser makes a request, the server checks for the cookie. If it doesn't exist it checks for the parameter. If neither exist the server assumes its the first time your browser has made a request and behaves as describe in the previous paragraph.
    In your case when you submit the form if you have disabled cookies and the action attribute doesn't have the SESSION_ID paramter appended to the url, the browser will assume it's a first request. The user will not be logged in, hence your session has expired error.
    To fix this you need to encode the URL in your JSP. You can use the struts html:rewrite tag or the HttpServletReponse.encodeURL method, or if you're using JSP 2.0 the JSTL c:url tag.

Maybe you are looking for