Solved

JMF Receiving media by RTP

Posted on 2004-04-24
4
3,537 Views
Last Modified: 2013-11-23
I'm working on program for transmitting and receiving audio through RTP in local machine, but the program doesn't receive the data. It never goes into update(ReceiveStreamEvent event).  The following is the portion of the code. is there any problem? Thx a lot

public class ReceiveMeida  implements ReceiveStreamListener, ControllerListener  {
public ReceiveMeida() {
      RTPManager rtpManager;
      SessionAddress localAddr;
      int port = 5000;
      
      try {
            localAddr = new SessionAddress(InetAddress.getLocalHost(),port);
            rtpManager = RTPManager.newInstance();
            rtpManager.initialize(localAddr);
            
            rtpManager.addReceiveStreamListener(this);
            
            
      }
      catch (Exception  e) {
      }
}


public void update(ReceiveStreamEvent event) {
               
        if (event instanceof NewReceiveStreamEvent) {
             Player newplayer;
             
             try {
                 ReceiveStream receiveStream = event.getReceiveStream();
                 DataSource dsource = receiveStream.getDataSource();
                 
                 newplayer = Manager.createPlayer(dsource);

             }
             catch (Exception e) {
             }
 
             if (newplayer == null) return;
 

             newplayer.addControllerListener(this);
             newplayer.realize();
           
             

         }
         
}
public synchronized void controllerUpdate (ControllerEvent e) {
           if (e instanceof RealizeCompleteEvent) {
                 newplayer.start();
           }
}
}
0
Comment
Question by:appleminii
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
Tommy Braas earned 125 total points
ID: 10910624
One problem is that you have try - catch clauses where you do nothing with the exception! BAD!!! Add a e.printStackTrace() to each of your catch clauses. I am sure you will find a clue to what the problem is.
0
 
LVL 7

Expert Comment

by:maheshexp
ID: 10910866
do u get any runtime error()....where did u call update(...) function
0
 
LVL 15

Expert Comment

by:Javatm
ID: 10910974
Try changing your codes to like this to get any possible errors :

public class ReceiveMeida  implements ReceiveStreamListener, ControllerListener  {
public ReceiveMeida() {

     RTPManager rtpManager;
     SessionAddress localAddr;
     int port = 5000;
     
     try {
          localAddr = new SessionAddress(InetAddress.getLocalHost(),port);
          rtpManager = RTPManager.newInstance();
          rtpManager.initialize(localAddr);
          rtpManager.addReceiveStreamListener(this);  
     }
     catch (Exception  e) {
     System.err.println(""+ e);
     }
}


public void update(ReceiveStreamEvent event) {
             
        if (event instanceof NewReceiveStreamEvent) {
             Player newplayer;
             
             try {
                 ReceiveStream receiveStream = event.getReceiveStream();
                 DataSource dsource = receiveStream.getDataSource();
                 
                 newplayer = Manager.createPlayer(dsource);

             }
             catch (Exception e) {
             System.err.println(""+ e);
             }
 
             if (newplayer == null) return;
             newplayer.addControllerListener(this);
             newplayer.realize();
           
         }
         
}

public synchronized void controllerUpdate (ControllerEvent e) {

          if (e instanceof RealizeCompleteEvent) {
               newplayer.start();
          }
}
}

Here is a sweet tutorial for that :
http://java.sun.com/docs/books/tutorial/essential/exceptions/handling.html

Hope that helps . . .
Javatm
0
 
LVL 14

Expert Comment

by:Tommy Braas
ID: 10912949
=-)
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question