Directly sending RTP Packets

Hello,
I have a media file divided in chunks on disk.
I want to stream the whole media file with RTP. How can I do that? Can you directly send RTP Packets?
For example:
for every chunk i
   for (every 1000 bytes b[] in i)
      sendRTPPacket(b[]) //this creates a new RTP Packet with the contents of b[] and sends itIs that possible?
If that is not possible, I have another idea:
If I open a different RTP session for each chunk (so I can just specify as dataSource the actual chunk file), can I synchronize that at the receiver side? how can I then reconstruct the whole file ?
How would you do that?
Thank you!

Hello,
after searchig the internet, I found this:
http://forums.sun.com/thread.jspa?threadID=5356475&tstart=1
I think creating a customized Push DataSource will work fine, what do you think? it would push data each time a new chunk is available.
I tried the example on http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/LiveData.html but I'm not sure how to use it: I cannot register it.
I would like to see the results on a player, so I used a player that I have:
DataSource dataSource = new DataSource();
               //dataSource.connect();
               //dataSource.start();
               player = Manager.createPlayer(dataSource);But I get Error: DataSource not connected
If I call dataSource.connect() I get:
java.lang.ClassCastException: [B cannot be cast to [I
     at com.omnividea.media.renderer.video.Java2DRenderer.bufferToImage(Java2DRenderer.java:131)
     at com.omnividea.media.renderer.video.Java2DRenderer.process(Java2DRenderer.java:105)
     at com.sun.media.BasicRendererModule.processBuffer(BasicRendererModule.java:728)
     at com.sun.media.BasicRendererModule.scheduleBuffer(BasicRendererModule.java:499)
     at com.sun.media.BasicRendererModule.doProcess(BasicRendererModule.java:400)
     at com.sun.media.RenderThread.process(BasicRendererModule.java:1114)
     at com.sun.media.util.LoopThread.run(LoopThread.java:135)
Do you have a media player where this works? or can you tell me how to use the example, maybe without explicitly registering the new dataSource, to play media in a media player?
What do you think about the idea of creating a similar DataSource (push) in order to push the data chunks that we have already into it?
Thanks!
Edited by: thawxx on Mar 11, 2009 7:20 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • How to send RTP packet through SIP Dialog

    Hello there !
    I work on a Java softphone which use JMF and Jain-SIP. I know JMF is "old" but I think it would be simple to capture and transmit RTP audio. So, my SIP dialog is working, I can send text messages but now, I would like to send RTP with this SIP session. I know I have to send SDP messages for codec convenience but then, what is the MediaLocator for RTP packet ? Only SIP User Agent IP or something else ?
    I also accept all ressources that can help me achieve my work :)

    I have no idea how SIP works, but, RTP packets go to an IP:PORT... theoretically, in the SIP phonecall setup, I'd imagine you'd have to be given the address to send RTP packets to the remote phone. Or perhaps the port is already well-defined by the SIP standard.
    Either way, you should have a way of knowing / finding out which PORT to send to for your SIP call, either from the call setup or the SIP standard itself.

  • RVS4000 mangles RTP Packets

    I've come across a strange issue with a Cisco RVS4000 router, firmware      V2.0.2.7
    First of all, ALG is turned off in the router!  The RTP port range 10001-10999 is forwarded to the PBX internal IP.
    A PBX sitting behind NAT with ports forwarded establishes a given  incoming call with a SIP trunk provider.  Packet sniffs have shown the  PBX and Trunk agree on given IP's and port numbers in Session  Description Protocol for the conversation.  The PBX behaves as you would  expect, sending the audio from the agreed ports: PBX  PrivateIP/Port(10202) --> Trunk PublicIP/Port(53544).
    The strangeness sets in when the packets come out of the WAN side of  the router.  The call setup is identical however, the first 10 RTP  packets are changed to appear to come from a different port: PBX  PublicIP/Port(51062) --> Trunk PublicIP/Port(53544).
    The remaining RTP packets after the first 10 come from the correct  port: PBX PublicIP/Port(10202) --> Trunk PublicIP/Port(53544).
    The SIP trunk provider sends audio in the reverse direction: Trunk PublicIP/Port(53544) --> PBX  PublicIP/Port(51062)
    However, the incoming audio works and arrives at the PBX on port 10202 - therefore the router is obviously applying NAT to those packets.
    The result is that the SIP trunk provider ignore all RTP packets  after the first 10 (and thus one-way audio from the trunk to the PBX) because their system accepted the first 10 from the  "wrong" port and therefore ignores the remaining packets coming from the  "right" port.
    To make things even stranger, the router behaves properly on  subsequent calls.  The issue usually only appears after a long period  without incoming calls (> 30 min.)
    Business telephones in Calgary
    www.atcomsystems.ca

    I wish to put the time of my computer...or have you any other idea to generate timestamp?

  • How to use jmf convert the rtp packet (captured by jpcap) in to wav file?

    I use the jpcap capture the rtp packets(payload: ITU-T G.711 PCMU ,from voip)
    and now I want to use JMF read those data and convert in to wav file
    How to do this? please help me

    pedrorp wrote:
    Hi Captfoss!
    I fixed it but now I have another problem. My application send me this message:
    Cannot initialize audio renderer with format: LINEAR, Unknown Sample Rate, 16-bit, Mono, LittleEndian, Signed
    Unable to handle format: ALAW/rtp, Unknown Sample Rate, 8-bit, Mono, FrameSize=8 bits
    Failed to prefetch: com.sun.media.PlaybackEngine@1b45ddc
    Error: Unable to prefetch com.sun.media.PlaybackEngine@1b45ddc
    This time the fail is prefetching. I have no idea why this problem is. Could you help me?The system cant play an audio file / stream if it doesn't know the sample rate...somewhere along the way, in your code, the sample rate got lost. Sample rates are highly important, because they tell the system how fast to play the file.
    You need to go look through your code and find where the sample rate information is getting lost...

  • SUN OS 5.8 --Sending Null packets originating from 127.0.0.1

    Hia,
    I am running Sun Solaris 5.8 on E-250 Sparc machine. The problem is my machine is continuously sending unwanted packets with a Src address 127.0.0.1 to the network. If I stop ot put down lo0 inrterface, the bombardment stopped....
    Any suggestions....

    This forum is for C++. To clarify, you appear to be talking about C code compiled with the C compiler. Is that correct? (There is a separate forum for C: [http://forums.sun.com/forum.jspa?forumID=849]
    Please post code examples between "code" tags. Otherwise, the forum software interprets some punctuation as formatting directives, changing the code beyond recognition.
    Please clarify whether you are talking about integer or floating-point divide-by-zero, and whether the zero divisor is a compile-time constant.
    Finally, please show the compiler options being used. They can also make a difference.

  • Packet sniffer only picks up UDP and no RTP packets when using JMF???

    Hi,
    I am developing a voice mail application to interface with asterisk. Here is the problem.
    I am using ethereal packet sniffer to sniff the packets. When I connect two regular SIP phones and sniff , I can sniff the RTP packets.
    But when I use JMF AVtransmit2.java and AVReceive2.java I sniff only UDP packets and no RTP packets.
    I am very confused. What is going on? If JMF sends over RTP (that uses UDP underneath), then why cannot packet sniffers detect it.

    Hi,
    I am developing a voice mail application to interface with asterisk. Here is the problem.
    I am using ethereal packet sniffer to sniff the packets. When I connect two regular SIP phones and sniff , I can sniff the RTP packets.
    But when I use JMF AVtransmit2.java and AVReceive2.java I sniff only UDP packets and no RTP packets.
    I am very confused. What is going on? If JMF sends over RTP (that uses UDP underneath), then why cannot packet sniffers detect it.

  • On how to avoid sending  RR packet

    Could anybody do me a favor? Right now ,I'm doing some research on the JMF platform, and the protocol requires one-way(uni-directional) channels only. So how to prevent the receiver from sending RR packets , and should I change(extend) RtpManager class ?

    I'm not sure what to tell you. The only way I can see you might get confused between the messages in the list is if you don't have a contact name associated with a phone number. If that's the case, you/your girlfriend should make sure to update the Contacts database (you can do so from a message by clicking Add Contact).
    Once that's done, the name of each person appears both in the message list, and above the message thread. There's not a lot of room in that top space in the thread, so if it's a long name, it will be truncated (13 characters, I think, is about the limit). So if you have one frequently-texted friend called John Appleseed and one called John Appleseeger, that would cause problems. But you can always turn the phone on its side to switch orientation and double-check the name.
    You might check the app store for txt apps, but I believe all of them use an "alternate" SMS system (ie, not the one built into your phone) so may charge for txts. However, here's one that displays contact photos and then uses the built-in SMS to write a message (I haven't tried it):
    http://itunes.apple.com/us/app/sms-favorites-text-messaging/id401901736?mt=8
    Matt

  • How to capture rtp packet??

    Hi,
    can someone plz tell me how to capture rtp packets. And also can u tell me how to remove the rtp header. I want to add another header to the rtp packet. I will be glad if u can also send me some code samples too.
    Thank you in advance.
    bye
    R.Ravi Kiran

    To Capture the RTP Packet all you need to do is listen for a UDP packet on the destination address and you will be able to receive the data. The Data field is by default 256 bytes long (just to let you know).
    So you will send the RTP Packet to Localhost port 4444
    To capture the packet you need to be listening for a UDP packet on that Address
    it would look something like this:
    byte[] buf = new byte[256];
    DatagramSocket socket = new DatagramSocket(4444);
    DatagramPacket packet = new DatagramPacket(buf, buf.length);
    socket.receive(packet);
    then you just have to do what you want with the buf array
    I'm not to sure about the RTP Header I'm working on that as well.. so if I find anything I will let you know.

  • Create one player to play RTP packets from many clients

    Hi,
    Am a JMF newbie and I want to create one player to play packets from many clients.
    So I wrote a small UDPserver thread within the app to receive rtp packets from the clients on the LAN which in turn forwards them to the player.
    I instatiated two threads one to forward RTP packets and another to forward RTCP packets which listens on RTPPort+1
    The reason why i do this is that i don't want the whole internet to bombard the player with anonymous voice transmissions.So the server thread is acting as a firewall. To filter out packets from from unknown ip addresses.
    this is a snippet of the player.
    MY_IPADDRESS =   InetAddress.getLocalHost().getHostAddress();+
    url = "rtp://" + MY_IPADDRESS + ":" + RTPPlayer.PORT + "/audio/1";
    MediaLocator mrl = new MediaLocator(url);
    player = Manager.createPlayer(mrl);
    More code which starts the server thread
    if (player != null) {
           player.addControllerListener(this);
           player.realize();
    player.start();When the server thread receives the packet it calls its forward method to forward the packet to the player by resetting the only the IP and PORT.
    public void forward(DatagramPacket rtpPacket) {
             //print out packet info to view which packets are being received
             System.out.println("forwarding "+request.getAddress() + " -> " + MY_IPADDRESS+":"+portToSend);
             //set address of packet to MY_IPADDRESS
           rtpPacket.setAddress(
                   InetAddress.getByName(RTPPlayer.MY_IPADDRESS));
              //set the port to the rtp port
           rtpPacket.setPort(RTPPlayer.PORT);
           datagramSocket.send(rtpPacket);
    }This works fine for two clients.
    When the clients become three(c1, c2 and c3),
    two clients communicate well(c1 and c2) but c3's voice cannot be heard on any other pc(c1 or c2) though it plays voice from both c1 and c2.
    But System.out.println("forwarding "+request.getAddress() + " -> " + MY_IPADDRESS+":"+portToSend);in the forward() method shows that packets from all clients on each pc are being received.
    Does any one have an idea why this happens?
    Are the packets so many that they overwhelm the player so it discards some or all?
    Is this the best way of doing this?
    Just to let u know all the mics are working fine.
    Thx in advance
    Edited by: noryak on Oct 29, 2008 10:29 AM

    THAT IS MY MAIN PROBLEM. In the future, please do a little bit of research before you shout at people trying to help you. I'm so so sorry if you find my answer bothersom because it sheds some light on the fact that you have absolutely no idea what you're doing.
    Your problem is that you obviously do not understand how JMF works...and you obviously havn't bothered to do any sort of research into it.
    You also don't seem to understand the concept of streaming media, concurrency, politeness, good design, proper programming, audio interleaving, or common sense.
    At least i have implemented a player playing packets from 2 different clients.Yeah, you implemented a player that plays packets from 2 different clients using a horrible workaround that doesn't treat the data correctly and manages to just drop data after scaling past 2 clients.
    Oh yeah, you've definately found the holy grail there. At least.
    You wanna know what your player is actually doing? It's playing a peice of data from A, and then a peice of data from B. It might sound like it's playing them both at the same time, but it's not. It's playing the data from one client in the gaps where there's no data, and once you've filled up the gaps in time by adding more nodes, you'll end up with data getting dropped (and that's the best case scenerio).
    my issue is that i wouldn't like to create a player for each participant imagine they were people in a conference that makes it 10 players. Please understand that if you have 10 players, you'll receive 10 times as much data as you can play with one player. You end up either having to drop 90% of your data, or having to play the data at 1/10th the speed... because you're not mixing the audio data, you're interleaving it.
    I just want to use one standard port on each client so that all clients send to the same port: The RTPManager class will allow you to receive as many streams as you want on a single port.
    As a matter of fact, had you bothered to play with any of the source code readily available online, you'd realize there is a file that does exactly what you want.
    [http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/AVReceive2.java]
    It handles receiving multiple RTP streams from a single port, and plays them all simultaniously using an array of player objects.
    Does absolutely everything you want, out of the box.
    That sounds like alot of threadsIf you're concerned that it's too many threads, well, maybe you should stick to hello world and other things less scary. Concurrent data processing requires threads...one per peice of concurrent data, as a matter of fact, and you're dealing with a lot of streams of concurrent data here.

  • Sending TCP packets to many IP addresses after downloading a program

    I constantly monitor UDP and TCP packets sent to IP addresses on my Windows 7 computer. After downloading a free online program to convert media video files, I soon noticed my computer constantly and rapidly sending out packets to more
    than 10 IP addresses (and quite a few were going to China, Russia and Germany). I tried a search on my hard drive for the file that contained those specific IP addresses and found nothing.
    Note: For Viewing Folders, I do not hide operating system files, and I show hidden files, folders and drives.
    Then I  tried searching my windows registry (via REGEDIT) for those IP addresses and found nothing.
    I assumed these IP addresses may have been hidden and included in a .dll file. I could not find an answer on the internet to determine where these hacking IP addresses originated from, so I deleted the program and rebooted.
    The problem still existed, so I had to restore to a previous backup date. The restore fixed the problem.  I am so confused. If I wasn't monitoring my connections I would never have known about this hacking flaw in Windows 7 security. I
    still don't know what type of file(s) were causing this problem. Or what causes my computer to send unsolicited packets to so many IP addresses (to domestic, foreign and hostile locations). 

    Message to members... DO NOT download the software in this area.
    Contains malicious code.
    Thank you FangZhou Chen for your response. I am not exactly sure which of these two programs (listed below) was the culprit for this problem, but I do know that both programs have issues with malicious code. Understand I have used both of these programs
    in the past, but stopped using them because of these issues. The Freeware #1 was my favorite and was user friendly, until the malicious code was added, and may be the real culprit.
    Malicious Freeware #1: Any Video Converter (program name: avc-free.exe)
    This program contains PUP.Optional.OpenCandy - While PUP.Optional.OpenCandy is not technically a virus, this PUP can be extremely annoying and quite difficult to get rid of. It comes loaded with adware, which as anyone who has been infected by adware can tell
    you, can drive you to the brink of insanity with its relentless adverts, plus it will very likely hijack your browser and install a strange and unwanted toolbar on your machine too. Not only do unwanted toolbars get in the way but they can direct you to websites
    that the creators want you to visit and can in general make using your computer a real user-unfriendly experience. PUP.Optional.OpenCandy is also a form of spyware which enables it to be installed deep within your PC’s operating system so that it is harder
    for you to find – and therefore delete.
    Link to site:              any-video-converter.com/products/for_video_free/             
    Link to download program:  any-video-converter.com/download-avc-free.php
    Malicious Freeware #2: SUPER © Media Converter Encoder
    This program is bundled with other software. I don't remember the malicious type or effects.
    Link to site:             erightsoft.com/SUPER.html
    Link to download program:  erightsoft.info/GetFile3.php?SUPERsetup.exe
    Hope this helps. Again thanks! God Bless.
    P.S. - Excellent tools in cleaning up maleware have been to use Malwarebytes, AdwCleaner and  HitmanPro (both recommended by the malwarebytes.org website).

  • Sending RTP using JMDS

    Hi, I'm developing an application which captures from multiple cameras and send it over the net using JMF. I did it, but It just worked with one camera, so I started using JMDS. But now the problem is that it can't encode into H263_RTP format, which worked correctly before I changed to JMDS. What's wrong?
    This is the code:
    public void creaProcesador() throws Exception{      
           try {
                DSCaptureDeviceInfo[] devices = DSCaptureDeviceManager.getCaptureDevices();
                ds = new DSDataSource[devices.length];
                for (int deviceNum = 0; deviceNum < devices.length; deviceNum++) {               
                    DSCapturePin pin = (devices[deviceNum].getPins())[0];               
                    ds[deviceNum] = new DSDataSource(pin);
                    Format formatos[] = pin.getFormats();
                    ds[deviceNum].connect();               
                    boolean rgb = false;
                    FormatControl formatControl = (FormatControl) ds[deviceNum].getControl(FormatControl.class.getName());
                    for (int i = 0; i < formatos.length; i++) {
                        if (formatos.getEncoding().equals(VideoFormat.RGB)) {
    rgb = true;
    formatControl.setFormat(formatos[i]);
    break;
    if (! rgb) {
    throw new Exception("\n\tNo se pudo cambiar el formato a RGB");
    } catch(Exception e) {
    throw new Exception("Error al capturar dispositivos : " + e.getMessage());
    try {
    for (int i = 0; i < proc.length; i++) {
    proc[i] = Manager.createProcessor((DataSource)ds[i]);
    } catch (Exception e) {
    throw new Exception("Error al inicializar el compresor \n" + e.getMessage());
    for (int i = 0; i < proc.length; i++) {
    if (! sh[i].configure(cte.getTconfig()))
    throw new Exception("El procesador " + i + " no logr� configurarse antes de " + cte.getTconfig() / 1000 + " segundos");
    // Creamos el nuevo formato
    creaFormato(proc[i], cte.getFormato(i), cte.getWidth(i), cte.getHeight(i));
    try {
    //proc[i].setContentDescriptor(new ContentDescriptor(cte.getFormato(i)));
    proc[i].setContentDescriptor(new ContentDescriptor(ContentDescriptor.RAW_RTP));
    } catch (Exception e) {
    throw new Exception ("El formato elegido no es compatible para el procesador " + i);
    if (!sh[i].realize(cte.getTconfig()))
    throw new Exception("El procesador " + i + " no logr� realizarse antes de " + cte.getTconfig() / 1000 + " segundos");
    private void creaFormato(Processor p, String formato, int w, int h) throws Exception {
    TrackControl[] tracks = p.getTrackControls();
    if (tracks == null) {
    throw new Exception("No se pudo encontrar pistas en el procesador");
    boolean disponible = false;
    for (int i = 0; i < tracks.length; i++) {
    Format format = tracks[i].getFormat();
    if (tracks[i].isEnabled() && format instanceof VideoFormat && !disponible) {
    float fr = ((VideoFormat)format).getFrameRate();
    VideoFormat miFormato = new VideoFormat(formato,
    new Dimension(w, h),
    Format.NOT_SPECIFIED,
    Format.byteArray,
    fr);
    tracks[i].setFormat(miFormato);
    tracks[i].setEnabled(true);
    disponible = true;
    } else {
    tracks[i].setEnabled(false);
    if (! disponible)
    throw new Exception("No se pudo encontrar un track de video adecuado");
    Thank You

    search4rajat wrote:
    I want to ask how to send RTP stream in jmf in a format compatible enough for mobile. Does whatever i tried is in right direction or not.That's going to be dependant upon the mobile platform, isn't it?

  • RTP Packet Data

    Hi again,
    As anyone who's been following my posts can tell, I've been working on an RTP application. I've got a Server-Client program set up (mainly it's just the AVTransmit and AVReceive stuff on this website) and I'm looking for a bit of code that will tell the clien that RTP packets are arriving
    eg
    while ( RTPArriving () == true ) System.out.println ( "RTP Arriving" );
    Does any such code exist?
    Thanks ;-)

    This is copied directly from AVReceive2.java, which
    you claim to base your app on...
    if (evt instanceof RemotePayloadChangeEvent) { ... }
    else if (evt instanceof NewReceiveStreamEvent) { ...
    else if (evt instanceof StreamMappedEvent) { ... }
    else if (evt instanceof ByeEvent) { ... }Might this be what you where searching, but not
    lookin, for? Did you look at all?Yes, I looked through the code. The code you printed above tells you that, yes a Stream event of some sort or a "bye" event has occured. It doesn't tell you how many RTP packets are arrving. As far as I'm aware it just tells you that a Stream is open.
    Is it actually possible to inspect or count the number of RTP packets arriving at all?

  • How to send a packet through a specific Inferface ?

    Hello!
    I have 3 interfaces in my pc : LAN / WLAN / 3G
    On LAN I have a global IP.
    On WLAN and 3G I'm behind NAT.
    I'm coding a program (client+srv) >
    I watch a video streaming on LAN then I switch to WLAN or 3G and I want it to happen seamless. So basecly seamless vertical handover is my goal.
    Because I'm behind a NAT (3G,WLAN) First I have to send a packet to the server (connection initialization). When the server sends the stream to me it actually sends it to the NAT and the NAT will fwd it to me.
    The NAT send the packets back to me only if>
    1. the server sends from the same port which it received the request form the NAT
    2. It have to send to the same NAT (ip+port) address where the request came from
    3. NAT will send then the packet back to my PC to the same port where I sent my request from.
    Here comes my big problem!
    I have a socket bound to a IP1 and port (e.g. WLAN) if I want to send a packet to an destination IPx for which the route table has the LAN interface as default gateway (IP2), then it will send my packet trough the LAN (IP2) but the source IP will be IP1 in the packet.
    Basecly I have a WLAN package on my LAN.
    This is bad for me in 2 ways.
    1. there won't be a NAT binding for my WLAN
    2. the packet won't even make it to the server because the very first router will throw it away since it's source IP is not a LAN IP
    SO,
    is there a way in Java, to send a packet thorugh a specific interface???
    Thx for the kind help!
    r0hamkuka

    I used NetworkInterface.getNetworkInterfaces() to get all avaliable interfaces. After that I used this: interfaceSocket = new DatagramSocket(6000, interfaceIp); for all my interfaces with different interfaceIp of course
    The I tried to send a packet to 153.66.200.155 for example (LAN address) through my WLAN interface (ip for example: 192.168.1.101) using WLAN's interfaceSocket.send()
    But the packet goes out on my LAN interface (ip 153.66.200.166) while the src ip is still 192.168.1.101 in the packet. That is why I sad WLAN packet on LAN interface.
    I guess the reason is still the routing table. Because routing table tells which IF to use for a destination IP. Of course for dest 153.66.x.x routing table contains 153.66.200.166 as the gateway and not 192.168.1.101. So Win uses this the LAN IF to send the packet.

  • DVI/RTP packet decode

    Hi,
    I need to stream audio and/or video to a PDA device. There is a trick here which is:
    The PDA must receive the stream from a multicast address. For this I have implemented a Bridge application which joins the multicast group on behalf of the PDA and receives the Multicast RTP packets (which are sent from JMStudio) and Unicasts them to the PDA.(HP iPAQ) I had no problem implementing this. The streaming is done using JMStudio player which encodes the streaming audio data into a number of encodings (DVI/RTP in my case). I choose DVI/RTP and stream a .wav audio file.
    Now I have to accept the packets and play the stream on the PDA.
    The j2me application receives all the RTP packets successfully and I can extract usefull information from the packets such as: Timestamp, sequence number, payload type. The payload type is 5 which means it is a DVI4 encoding.
    I use the following method to decode the samples:
    public int decode(Object state, byte[] input, int inp, int len, short[] output, int outp) {
    int sign;
    int delta;
    int vpdiff;
    //int valprev = audio.Convert.byte2short(input, inp);
    //int index = input[inp + 2];
    int valprev=0,index=0;
    int inputbuffer = 0;
    int bufferstep = 0;
    valprev = input[0] <<8;
    valprev |= input[1] &0xff;
    index = input[2] &0xff;
    if ( index < 0 ) index = 0;
    else if ( index > 88 ) index = 88;
    int step = stepsizeTable[index];
    inp += 4;
    len = (len - 4) * 2;
    int count = len;
    while(count-- > 0) {
    if ( 0 == bufferstep ) {
    inputbuffer = input[inp++];
    delta = (inputbuffer >> 4) & 0xf;
    bufferstep = 1;
    } else {
    delta = inputbuffer & 0xf;
    bufferstep = 0;
    index += indexTable[delta];
    if ( index < 0 ) index = 0;
    else if ( index > 88 ) index = 88;
    sign = delta & 8;
    delta = delta & 7;
    vpdiff = step >> 1;
    if ( (delta & 4) == 4 ) vpdiff += (step << 2);
    if ( (delta & 2) == 2 ) vpdiff += (step << 1);
    if ( (delta & 1) == 1 ) vpdiff += step;
    vpdiff >>= 2;
    if ( 0 != sign )
    valprev -= vpdiff;
    else
    valprev += vpdiff;
    if ( valprev > 32767 )
    valprev = 32767;
    else if ( valprev < -32768 )
    valprev = -32768;
    step = stepsizeTable[index];
    output[outp++] = (short) valprev;
    ((AdpcmState)state).valprev = valprev;
    ((AdpcmState)state).index = index;
    return len;
    which stores the result into a short[] array.
    I then convert this short[] array into a byte[] array with the following way:
    s is the short[] array
    adp is the byte array
    for(int g=0,k=0;g<s.length;g++,k=k+2){
    audio.Convert.short2byte(s[g],adp,k);
    public static void short2byte(short ival, byte b[], int offset) {
    int i;
    int bits = 16;
    for(i = 0; i >< 2; i++) {
    bits -= 8;
    b[offset + i] = (byte) ((ival >> bits) & 0xff);
    The final result is loaded to the player as follows:
    ByteArrayInputStream input1 = new ByteArrayInputStream(adp);
    player = Manager.createPlayer(input1, "audio/x-wav");//create new player
    player.addPlayerListener(this);
    player.prefetch();
    player.realize();
    player.start();
    The player begins to play but I only get horrible sounds instead of the original wave file
    The player now initializes ok without any problem but I can only hear a meesed up sound rather than the original. So now I strongly believe that the problem is in the decoding of the samples of the DVI/RTP codec.

    thesti wrote:
    how JMF deal with RTP packet loss? since my application doesn't handle anything due to RTP packet loss, i believe that JMF has a mechanism to deal with it.It "deals" with it by having a blank spot in the rendering where that packet would have gone...

  • Problem while sending RTP stream to QuickTime player

    Hello,
    I am trying to send a RTP video stream from a local file to a Quicktime player.
    The player is waiting for the stream in its default ports (6970/6971). I archieve this by using my own RTSP server.
    I start the transmission by using a processor and a datasink. It seems that I send one or two RTCP packages to port 6971, but not RTP packages are sent.
    This is my code:
    pr = Manager.createProcessor( new MediaLocator("file:/rootDirectory/file.mpg"));
    pr.configure();
    while(pr.getState()==Processor.Configuring){}
    TrackControl[] tracks = pr.getTrackControls();
    tracks[0].setFormat(new VideoFormat(VideoFormat.JPEG_RTP));
    tracks[0].setEnabled(true);
    pr.realize();
    while(pr.getState()==Processor.Realizing){}
    DataSource ds = null;
    ds = pr.getDataOutput();
    String url1 = "rtp://193.147.59.231:6970/video/10"
    MediaLocator m1 = new MediaLocator(url1);
    DataSink d1 = Manager.createDataSink(ds, m1);
    d1.open();
    d1.start();JMF doesn't show any error, but my application just is not sending RTP packages. What could be wrong in my code?
    Kind regards.

    Any clue please? I am frustrated!!

Maybe you are looking for

  • SetBackground() Is Not Working in Windows 7

    It looks like inheritance is broken in the component hierarchy for JFrame in Windows 7 JDK 1.6.0_23-b05. Run this code to reproduce the issue. public class Main public static void main(String[] args) JFrame frame = new JFrame(); frame.setTitle("Test

  • Java NIO

    I have made a socketchannel non-blocking and after I write some data to the socket channel , I am closing the socket channel.Why I am doing like this because I am not able to send data properly to the client without closing the socket channel.Now wha

  • TS4644 Hi, I have put in the wrong number in the security chain by mistake, how can i change that number

    Hi While setting up isecurity chain ,I have put in the wrong number when instrument aske me to write the number that I trust. How can this number be changed. Thanks AP758

  • Unable to view tabs and layouts on web sites

    When I log into myspace or Facebook I am unable to view tabs or page layout. Even at yahoo, My pages come out plain == This happened == Every time Firefox opened == As soon as I downloaded Fire Fox

  • Can anybody please help me with an Elements 10 problem?

    I have been using Elements for several years now. Progressing from 5 to 7 then onto 10 without any problems of this type. The original start up screen showed the first few thumbnails of all the photo's in the catalogue from where I could scroll down