Solved

JMF Receiving media by RTP

Posted on 2004-04-24
4
3,502 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
  • 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Arrays.asList  VS  ArrayList 4 60
How to convert String matching to regex in java 4 34
servlet example 11 40
Java: anonymous class 4 22
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

803 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