Help regarding Audio streams

Hi
I am a final yr student currently working on my voice chat project. I have been facing a sets of problems in my project
The streams which i send from the client to the server(client and server running on the same computer with loopback address 127.0.0.1) are not played by the server properly
Some streams r played thrice and some r not played at all though all streams r received by the server
I am posting my client server program below
Plz help me
this is the client named CaptureSound1.java
import javax.media.*;
import javax.media.rtp.*;
import javax.media.protocol.*;
import javax.media.format.*;
import java.util.Vector;
import javax.media.protocol.*;
import javax.media.control.TrackControl;
import jmapps.util.StateHelper;
import java.io.*;
import com.sun.media.rtp.*;
import java.net.*;
import java.util.*;
import javax.media.rtp.event.*;
public class CaptureSound1
public static void main(String args[])
     System.out.println("Client Started");
     Capture capture = new Capture();
     capture.startcapturing();
     System.out.println("Recording");
class Capture implements SendStreamListener
     Processor p;
     DataSink sink;
     DataSource ds;
     RTPManager rtp;
     SendStream sendstream;
     Capture()
          p=null;
     public void startcapturing()
          try
          Format format = new Format("Linear");
          Vector vector = CaptureDeviceManager.getDeviceList(format);
          CaptureDeviceInfo info = (CaptureDeviceInfo)vector.firstElement();
          MediaLocator source = info.getLocator();
          p = Manager.createProcessor(source);
          while(p.getState() < p.Configured)
               p.configure();
          p.setContentDescriptor(new ContentDescriptor(ContentDescriptor.RAW_RTP));
          TrackControl track[] = p.getTrackControls();
          for (int i = 0 ; i < track.length ; i++)
          Format suppFormats[] = track.getSupportedFormats() ;
          if (suppFormats.length > 0)
          track[i].setFormat(suppFormats[0]) ;
          else
          track[i].setEnabled(false) ;
          //System.err.println(track[i].getFormat()) ;
          while(p.getState() < p.Realized)
               p.realize();
          rtp = RTPSessionMgr.newInstance();
          rtp.addSendStreamListener(this);
          SessionAddress clientadd = new SessionAddress(InetAddress.getLocalHost(),5052);
          rtp.initialize(clientadd);
          SessionAddress serveradd = new SessionAddress(InetAddress.getByName("127.0.0.1"),5050);
          rtp.addTarget(serveradd);
          p.start();
          ds = p.getDataOutput();
          PushBufferDataSource pbds = (PushBufferDataSource)(ds);
          PushBufferStream pbs[] = pbds.getStreams();
          for(int i = 0;i<pbs.length;i++)
               sendstream = rtp.createSendStream(ds,i);
               sendstream.start();
          }catch(IOException e)
               System.out.println("Input Output Exception");
          }catch(NoProcessorException e)
               System.out.println("No Processor Present");
          }catch(InvalidSessionAddressException e)
               System.out.println("Invalid IP");
          }catch(UnsupportedFormatException e)
               System.out.println("Unsupported format");
     public void update(SendStreamEvent event)
          if(event instanceof ActiveSendStreamEvent)
This is my server Server.java
import javax.media.*;
import javax.media.rtp.*;
import javax.media.protocol.*;
import javax.media.format.*;
import java.util.Vector;
import javax.media.protocol.*;
import javax.media.control.TrackControl;
import jmapps.util.StateHelper;
import java.io.*;
import com.sun.media.rtp.*;
import java.net.*;
import java.util.*;
import javax.media.rtp.event.*;
import com.sun.media.rtp.RTPSessionMgr;
class Server
     public static void main(String args[])
          System.out.println("Server Started");          
          playsound sound = new playsound();
     sound.player();
     System.out.println("End");     
class playsound implements ReceiveStreamListener, ControllerListener
Player p;
RTPManager rtp;
Socket sock;
     public void player()
          try
          rtp = RTPSessionMgr.newInstance();
          SessionAddress serveradd = new SessionAddress(InetAddress.getLocalHost(),5050);
          rtp.initialize(serveradd);
          SessionAddress clientadd = new SessionAddress(InetAddress.getByName("127.0.0.1"),5052);
          rtp.addTarget(clientadd);
          rtp.addFormat(new AudioFormat(AudioFormat.G723_RTP),0);
          rtp.addReceiveStreamListener(this);
               while(true);     
          }catch(UnknownHostException e)
               System.out.println("Unknown IP");
          }catch(IOException e)
          System.out.println("IO Exception");      
          }catch(InvalidSessionAddressException e)
               System.out.println("Invalid Sessions" + e);
public void update(ReceiveStreamEvent event)
          if(event instanceof NewReceiveStreamEvent)
               ReceiveStream rs = null;
               p = null;
               rs = event.getReceiveStream();
               try
               p = Manager.createPlayer(rs.getDataSource());
               System.out.println("Realizing");
               if(p.getState()<p.Realized)
                    p.realize();
               p.addControllerListener(this);
               System.out.println(rs.getSourceReceptionStats().toString());
               System.out.println(p.getDuration().toString());
               p.start();
               System.out.println("Hi");
               }catch(NoPlayerException e)
                    System.out.println("Player cannot be Created");
               }catch(IOException e)
                    System.out.println("IO Exception");
               //rs=null;
     public void controllerUpdate(ControllerEvent event)
          if(event instanceof RealizeCompleteEvent)
               System.out.println("Player realized");
     if(event instanceof EndOfMediaEvent)
          p.stop();
          System.out.println("END of media");
My email id is : [email protected]

Well I was able to resolve my prob by removing the while loop in server.java and instead of that adding Thread.sleep(50000); but another problem is disturbing me
Whenever i am connected to net and try to run my prog with the loopback address no voice transmission takes place but when i am disconnected form net and run the same program using eclipse IDE it works fine and the prog also doesnt work on LAN
PLZ help me

Similar Messages

  • Starting steps required: audio streaming from UDP port

    Hi,
    I need help regarding audio streaming support of JMF. I want to know basic starting steps to stream audio file from UDP port. i am new to JMF so require detailed help..
    Thanks

    [http://wiki.java.net/bin/view/Javapedia/JMFQuickstartGuide]
    I'd recommend reading that. All of it. And then I'd recommend doing everything it tells you to do in the "Getting Started" article.

  • Need help splitting an incomming audio stream

    Just wondering how I would take streaming audio to a server and broadcast it to connected clients. So far I've created a realized processor taking in the audio stream, but I have a problem when I want to use that processor's data output to send to other users via a list of datasinks. I can use the output for the first datasink.. but then when I try to use the same data output for the next, the original datasink loses the output from the processor. I'm assuming there HAS to be a way to fix this problem (even if it means a whole new algorithm). Thx for any help or suggestions anyone can offer :)

    Thx for the suggestion of forwarding the packets. The boss and I figured that would be the ultimate way to get this server working. Using the forwarding should also lighten the server-load considerably, as you mentioned.
    New problem: I've been looking through the .net and .io components and can't quite figure how to do the forwarding. I've looked through many io classes and none seem to serve exactly that purpose. If you (or anyone for this matter) could point me (even moreso than before) in the right direction that would be very much appreciated. Thx in advance.
    - Kris

  • C# Webbrowser using VLCplugin to play online audio stream

    Hello all,
    I have been trying to get the VLC to play a audio stream from a URL address.
    I created a forms application and added a webbroswer from the toolbox. I can navigate no problem but if I goto a link like
    http://audio.wgbh.org/otherWaysToListen/wcai.m3u
    I get a popup dialog that asked do I want to open this file. If i accept VLC opens and it plays no issue.
    However, what I want is it to play without the popup and in my application not with the VLC installed on my computer.
    I have seem many things about VLC selecting files but I have not been able to find a reference for pulling a stream with my C# form when browsing with the webbrowser item on my form.
    Any help would be thankful.

    Hi Badidea,
    >> However, what I want is it to play without the popup and in my application not with the VLC installed on my computer.
    Do you want to open the url without the popup? If so, I think you could block downloads from the webbrowser control, the link below shows the details:
    # How to block downloads in .NET WebBrowser control?
    http://stackoverflow.com/questions/483262/how-to-block-downloads-in-net-webbrowser-control
    But with this way, I am afraid that you could not open the audio. If you want to open the audio without the popup, I think you could automatically download the file, more information you could turn to the link below:
    # Suppressing the Save/Open Dialog box in a WebBrowser control
    http://stackoverflow.com/questions/3538874/suppressing-the-save-open-dialog-box-in-a-webbrowser-control
    But if you want to open the audio in your application without the VLC, I am afraid that you could not achieve that. As you know, the audio needs the special player from the URL, I think it is restricted if you want to open the audio without the player.
    Sorry for the inconvenient.
    Best Regards,
    Edward
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

  • Audio streams un-muted when new participant enters room...

    Hi - I have noticed that in a hosted room (ie. knocking queue enabled) that when a new participant is accepted to enter the room all existing audio streams that I have muted are automatically un-muted and I have to explicitly re-mute them from the owner's view. Is this the intended behavior and is there a way to prevent this from happening?
    Thanks

    Hi ,
    Yes you were right. There was a nasty bug on our side, I ran the test cases today. Thanks for pointing it out to us. I have fixed it and it should be fine with the next drop of SDK.
    If you are using player 9 source to link your application, then I can give you the fix and you can put it in your source. Otherwise, please wait till next drop and till then you can explicitly mute them.
    Thanks again for bringing such issues. It helps us in smoothening our SDK.
    Regards
    Hironmay Basu

  • I want to be able to use airplay to stream audio to another iOS device, and then use that audio stream to be used when recording video instead of the built in microphone / microphone input. Is this possible?

    I want to be able to use airplay to stream audio to another iOS device, and then use that audio stream to be used when recording video instead of the built in microphone / microphone input. Is this possible?

    A third-party app probably cannot obtain a stream from another app. To the best of my knowledge, such a capability is not provided in the software development kit, apps being "sandboxed" from each other and so allowed to communicate only in very specific and limited ways.
    I'm not completely sure what you mean by "limitations on video capture". An iPhone, to the best of my knowledge, can natively record video only through it's built-in camera, and audio while doing video recording only through the built-in microphone or mic/headphone jack. There might be a video recording app that would allow audio input from an external device connected to the dock connector, but I'm not sure.
    Regards.

  • Can I use the new Apple TV without a display for audio streaming only?

    Here's my situation...
    I have an Airport Express in my living room connected to my DSL modem to create a wifi network. I also have a current model MacBook Pro and would like to add an Apple TV to my bedroom system for music and Netflix audio streaming. I do not own a TV to do any setup.
    If I bought an ATV for my bedroom and connected the optical output to my DAC, would I be able to accomplish my goal or is there a setup procedure on the ATV which mandates a display?
    I realize I could just buy another Airport Express for easy audio streaming, but then I wouldn't have the Netflix audio capability which I would like since I watch movies on my MBP. I'm hoping like an Airport Express, the ATV would configure itself for audio streaming once connected to my wifi network.
    Thanks for any help or ideas.

    If you're planning to stream from iTunes to the AppleTV controlling the material via iTunes, I suspect it may just appear as an Airtunes speaker option for iTunes without any setup needed.
    No Netflix in UK so don't know much about it, but I suspect you'd need to control the AppleTV directly for this unless you were viewing on the MBP and used something like Rogue Amoeba's Airfoil to transmit audio.
    If you have no desire for controlling AppleTV either on an TV or using Remote app for iPhone etc (and you'd need to set AppleTV up with a TV for Netflix or AppleTV controlled streaming anyway), you might want to consider using another Express upstairs and hook it's optical out to your DAC if you're just after stereo audio.
    AC

  • Audio Stream Recorder - Error: Audio device is already being used by another prog

    I realized that Audio Stream Recorder is does not "work" through server list feature. So I am simply trying to use the manual method of adding URL's to the interface. However regardless of the type of stream, shoutcast, windows media or real audio, I receive the error "audio device is already being used by another program". Does anyone know how to fix this? I have closed my audio application etc to no avail. <RANT WARNING> I was very excited about using this application when I read about it. However an application that provides none of the stated features is not an application, its false advertising, since it clearly states on the box, help files and website this products "features". Anyway, it'ss very disappointing. Also, does anyone know what the supported steaming formats are, the help file say the application requires RealONE and Windows Media Player but does not mention audio stream formats? Thanks you in advance for any help.

    I have the same issue. I updated to the latest software, to no avail. My first suspicion is that some Microsoft patch caused this, but I cannot verify this.
    Apparently no one at Creative is very interested in this issue.

  • Need help regarding Java decoding of IMAP attachment (IOStream related ques

    Hi ,
    I need some help regarding the processing of an IMAP attachment , It is a basic IOStream related question I guess.
    I have some attachment to a mail , I try to fetch it using javamail and read the content and write it to a file , I was able to do it successfully when I was using stream.read( tempBuffer) function but when I started using stream.read( tempBuffer, 0, m_maxDataSize ); it is giving me following exception
    java.io.IOException: Error in encoded stream: needed at least 2 valid base64 characters, but only got 1 before padding character (=), the 10 most recent characters were: "/59PT/eXQ="
         at com.sun.mail.util.BASE64DecoderStream.decode(BASE64DecoderStream.java:259)
         at com.sun.mail.util.BASE64DecoderStream.read(BASE64DecoderStream.java:148)
    ***Here is the snippet of code that is running this:***
    m_contentObj = m_message.getContent();
    if(m_contentObj instanceof InputStream)
         System.out.println(" Content is type of InputStream");
         InputStream stream = (InputStream) m_contentObj;
         byte[] tempBuffer = new byte[m_maxDataSize];
         stream.skip( m_currPos );
         int bytesRead=stream.read( tempBuffer, 0, m_maxDataSize );
         System.out.println(" Read the following no of bytes from the Object::"+bytesRead);
         m_currPos+=     bytesRead;
    Please suggest what to do.
    Thanks & Regards
    Saurabh

    BUMP, just incase its been missed by a new board member

  • Streaming audio from my IPAD to my Apple TV from Rhapsody application.  when Apple TV go into Screen Saver mode, about 5 minutes after that it stops playing the Audio Stream and goes into Sleep mode.

    I am Streaming audio from my IPAD to my Apple TV from Rhapsody application.  when Apple TV go into Screen Saver mode, about 5 minutes after that it stops playing the Audio Stream and goes into Sleep mode.  I am using the Optical Out from the Apple TV to my receiver, the Apple TV is hard Wired to the Network, the IPAD is Wirelessly attached to the network (it continues to play the Audio Stream).  When the Apple TV is turned back on it resumes playing once I manual select it for output from the IPAD.  All device are on current releases of software.  I have no Video hooked up to the Apple TV.  How do I correct this?

    Intermittent problems are often a result of interference. Interference can be caused by other networks in the neighbourhood or from household electrical items.
    You can download and install iStumbler (NetStumbler for windows users) to help you see which channels are used by neighbouring networks so that you can avoid them, but iStumbler will not see household items.
    Refer to your router manual for instructions on changing your wifi channel or adjusting your multicast rate.
    There are other types of problems that can affect networks, but this is by far the most common, hence worth mentioning first. Networks that have inherent issues can be seen to work differently with different versions of the same software. You might also try moving the Apple TV away from other electrical equipment.

  • How to publish a local audio stream using NetStream?

    As all we know, if we want to publish a stream to FMS or Red5, we can code like below:
    var nc:NetConnection = new NetConnection();
    nc.connect("rtmp://localhost/myApp");
    var ns:NetStream = new NetStream(nc);
    ns.attachAudio(Microphone);
    ns.publish("audio", "live");
    my problem is that we can pass an instance of Microphone to ns.attachAudio() only, if I want to attach a local audio stream,like playing a local sample.flv file to become a audio stream, how can I do?
    this issue has been asked 7 years ago, see the post. but i can not find any solutions.
    any tips will be appreciated. thx in advance.

    how to watch my local network stream using java,help!http://www.ethereal.com - a third party program (but not using java)

  • Real time audio streaming

    Hi, I need to develop a j2me softphone, is there someone who can tell me how to do audio streaming ? I already read jsr135 but nothing important.
    I would appreciate any help.

    Hi Daniel,
    I'm encouraged to receive a response!
    I can't see how the advent of a new codec will affect the issues that I mention above. You still need an unreliable protocol to transport the Speex data! Datagram support is optional in both MIDP2.0 and it's my understanding that it is rarely implemented. The objection about Bluetooth remains - L2CAP support is optional, and setting the flush timeout on an L2CAP connection is impossible.
    Then there is the question of playing and recording at the same time. The anecdotal evidence seems to be that even though you can use threading to start two players at the same time, as soon as you try record and play at the same time, an exception is thrown (sometimes the emulators work but after deploying on the device the exception is thrown).
    Finally, you mention that there are a number of Java ME VOIP applications out there. Do you have links? Personally I can't find any. What I can find is a number of products that operate on different platforms:
    eg Fring that has Symbian, iPhone OS, Windows Mobile and Java ME versions.
    What is telling is that the Java ME version does not support voice, while the other versions do. The same applies to Nimbuzz and Talkonaut. Extensive googling has not revealed any exceptions to this rule.
    If you can prove me wrong it'll make my day :).
    Cheers,
    Fritz

  • How do I Label Audio Streams for Playback

    I am working on a DVD with 2 audio streams and the client would like when toggling from one stream to the next for them to be labeled on the DVD player "5.1" or "2.0". I know I have seen it on retail DVD's. Currently it just reads 1 or 2. How do I change it so it reads "5.1" or "2.0"? Is this a scripting thing? Scripting is the one thing that I am really having a hard time grasping and understanding unfortunately even with tutorials. Any help, info, or tutorials are greatly appreciated. Thanks.

    If you mean labelled on the text display screen on the front of the DVD player hardware, then this isn't something you can control from the disc. It is a feature of the player itself.
    If you want to show the audio choice on the TV screen as the disc plays back (i.e. within a menu where you make an audio stream choice) then that's different - it is possible to do this.
    If you want to change the audio stream using the remote handset and show the change in audio stream dynamically at any time on the TV screen as the disc is playing, then that is also not possible.

  • How to merging two audio stream using jmf?

    I have received two rtp audio stream,i want to merging this to one but createMergingDataSource dou work well。please help 。

    You might use an alternative approach: Run exec task and use a external tool to do the encoding.
    You can for example use "The Swiss army knive of Sound" :) SoX: http://sox.sourceforge.net/
    I think from a performance point of view or to handle large files it would be even recommended in using such tools rather then encoding inside your application ... that might be different if you need to do the encoding in real-time ...
    Sebastian

  • Marking Audio stream as EF in Video-Conferencing?

    Hi,
    Traditionally I have marked both the audio and video streams as AF41/CS4 but increasingly I have seen VC vendors marking the audio streams as EF. According to the Telepresence SRND both streams should be marked as CS4 - is there any benefit is classifying the 2 streams differently?
    Thks

    Hi
    I guess the difference would be that if you mark the voice as EF, it's generally going in the priority queue which means it should always get good service.
    AF41 is more likely to experience congestion and drops.
    Video calls generally involve a G711/G722 voice stream, and a video stream. The two traffic types have different behaviours, so it makes sense for them to be in different classes, especially if you consider that you can generally ignore some video glitches and continue a conversation if the voice stream is arriving happily.
    That said, lots of stuff just does mark everything AF41.. I guess it's something to do with keeping them in sync (i.e. sending both types of traffic with the same markings but to me the arguments do seem a little weak. Here's a snip from the old Video SRND 4.1:The voice component of a call can be classified in one of two ways, depending on the type of call in
    progress. A voice-only (or normal) telephone call would have the media classified as CoS 5
    (IP Precedence 5 or PHB EF), while the audio channel of a video conference would have the media
    classified as CoS 4 (IP Precedence 4 or PHB AF41). All the Cisco IP Video Telephony products adhere
    to the Cisco Corporate QoS Baseline standard, which requires that the audio and video channels of a
    video call both be marked as CoS 4 (IP Precedence 4 or PHB AF41). The reasons for this
    recommendation include, but are not limited to, the following:
    • To preserve lip-sync between the audio and video channels
    • To provide separate classes for audio-only calls and video calls
    Aaron
    Please rate helpful posts...

Maybe you are looking for