This project consist of 4 classes
The central class among these four is RTPPacket.java. The client class sends the RTP Packets constructed using RTPPacket.java to Server.java. The Server.java receives the RTP Packets, computes latency and jitter, send the results back to client. All these happen in a real-time environment. Find the details and description of each class below.
This class doesn’t have a main function, as it never executes by itself, however, it act as a helper class for the Client.java and Server.java to construct RTP Packets. It has numerous variables declared in accordance with the RTP Protocol. It has the functions for construction or encoding RTP Packets and for decoding RTP packets. Client use the createPacket(ByteBuffer) to construct RTP Packets, whereas, Receiver.java uses the constructor RTPPacket(ByteBuffer) to decode the received packets. There are some mutator and accessor functions that support the encapsulation of private variables and still make the accessible to other classes. Some of the mutator functions are setPayload(byte), setTimesTamp(long), etc. The corresponding accessor functiosn are getPayload(byte) and getTimeStamp(), etc.
The client reads a sample .wav file (audio file), constructs packets and sends them to Server, who is already waiting for the client at port number 3033. All the RTP Packets constructed have a payload of 256 bytes in accordance with the G.711 protocol. Client uses the RTPPacket class to construct packet, first it calls the default constructor RTPPacket() to construct an empty packet and then using various functions of RTPPacket class populate the packets with appropriate information. Client then sends the packets one by one which server starts receiving after some delay. We use DatagramPackets and DatagramSockets of java.net package that simulates the UDP Protocol to send packets as suggested in VOIP protocol document.
Client also has another function, receiveQosFromServer(String) to receive jitter and latency from Server.java. This function executes after finishing the transmission of packets to Server. Here we use the Socket and ServerSocket class to simulate a TCP protocol. This is because we don’t want to lose this information. Had we used UDP protocol, there is no guarantee that the packet will arrive at the Client. This code executes at port number 1236, which is different from port no. 3033 at which RTP execute.
Server.java executes first at port no. 3033 waiting for RTP Packets from...