// Path: src/se/omnitor/protocol/rtp/packets/RTPPacket.java
// public class RTPPacket {
// 
//     private long csrcCount;
//     private long sequenceNumber;
//     private long timeStamp;
//     private long ssrc;
//     private byte[] data;
//     private byte markerByte;
// 
//     /**
//      * Gets the CSRC count. <br>
//      * <br>
//      * The CSRC count contains the number of CSRC identifiers that
//      * follow the fixed header.
//      *
//      * @return The CSRC count
//      */
//     public long getCsrcCount() {
// 	return csrcCount;
//     }
// 
//     /**
//      * Sets the CSRC count.
//      *
//      * @param csrcCount The CSRC count to set
//      */
//     public void setCsrcCount(long csrcCount) {
// 	this.csrcCount = csrcCount;
//     }
// 
//     /**
//      * Gets the sequence number. <br>
//      * <br>
//      * The sequence number increments by one for each RTP data packet
//      * sent, and may be used by the receiver to detect packet loss and
//      * to restore packet sequence. The initial value of the sequence
//      * number is random (unpredictable) to make known-plaintext attacks
//      * on encryption more difficult, even if the source itself does not
//      * encrypt, because the packets may flow through a translator that
//      * does.
//      *
//      * @return The sequence number
//      */
//     public long getSequenceNumber() {
// 	return sequenceNumber;
//     }
// 
//     /**
//      * Sets the sequence number
//      *
//      * @param seqNo The sequencenumber
//      */
//     public void setSequenceNumber(long seqNo) {
// 	this.sequenceNumber = seqNo;
//     }
// 
//     /**
//      * Gets the time stamp. <br>
//      * <br>
//      * The timestamp reflects the sampling instant of the first octet
//      * in the RTP data packet.
//      *
//      * @return The time stamp
//      */
//     public long getTimeStamp() {
// 	return timeStamp;
//     }
// 
//     /**
//      * Sets the time stamp
//      *
//      * @param timeStamp The time stamp to set
//      */
//     public void setTimeStamp(long timeStamp) {
// 	this.timeStamp = timeStamp;
//     }
// 
//     /**
//      * Gets the SSRC. <br>
//      * <br>
//      * The SSRC field identifies the synchronization source. This
//      * identifier is chosen randomly, with the intent that no two
//      * synchronization sources within the same RTP session will have
//      * the same SSRC identifier.
//      *
//      * @return The SSRC field
//      */
//     public long getSsrc() {
// 	return ssrc;
//     }
// 
//     /**
//      * Sets the SSRC.
//      *
//      * @param ssrc The SSRC to set
//      */
//     public void setSsrc(long ssrc) {
// 	this.ssrc = ssrc;
//     }
// 
//     /**
//      * Gets the payload, that is the actual payload contained in an RTP Packet.
//      *
//      * @return The payload data
//      */
//     public byte[] getPayloadData() {
// 	return data;
//     }
// 
//     /**
//      * Sets the payload data
//      *
//      * @param payloadData The payload data to set
//      */
//     public void setPayloadData(byte[] payloadData) {
// 	this.data = payloadData;
//     }
// 
//     /**
//      * Sets the marker bit for this packet.
//      *
//      * @param marker true = marker bit set
//      */
//     public void setMarker(boolean marker) {
// 	if(marker) {
// 	    markerByte=0x1;
// 	    return;
// 	}
// 	markerByte=0;
//     }
// 
//     /**
//      * Gets the marker bit for this packet.
//      *
//      * @return 1 if marker is set, 0 otherwise.
//      */
//     public byte getMarker() {
// 	return markerByte;
//     }
// 
// }


import se.omnitor.protocol.rtp.packets.RTPPacket;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.net.SocketException;
import java.util.Random;
import java.io.IOException;

        ////////////////////////////////////////////////////////
        // Construct the header by appending all the above byte
        // arrays into RTPPacket
        ////////////////////////////////////////////////////////
        byte[] rtpPacket = new byte[0];
        // Append the compound version, Padding, Extension and CSRC Count bits
        rtpPacket = PacketUtils.append(rtpPacket, vpxcc);

        // Append the compound Marker and payload type byte
        rtpPacket = PacketUtils.append(rtpPacket, m_PT);

        // Append the sequence number
        rtpPacket = PacketUtils.append(rtpPacket, seq);

        // Append the 4 timestamp bytes
        rtpPacket = PacketUtils.append(rtpPacket, ts);

        // Append the 4 SSRC bytes
        rtpPacket = PacketUtils.append(rtpPacket, ss);

        // Append the data packet after 12 byte header
        rtpPacket = PacketUtils.append(rtpPacket, packet.getPayloadData());

        sequence_number++;

        // Create a datagram packet from the RTP byte packet, set ttl and send
        // IP: Changed destination from m_mcastPort to m_sendPort for pkt
        DatagramPacket pkt =
                new DatagramPacket(rtpPacket, rtpPacket.length,
// Path: src/se/omnitor/protocol/rtp/packets/RTPPacket.java
// public class RTPPacket {
// 
//     private long csrcCount;
//     private long sequenceNumber;
//     private long timeStamp;
//     private long ssrc;
//     private byte[] data;
//     private byte markerByte;
// 
//     /**
//      * Gets the CSRC count. <br>
//      * <br>
//      * The CSRC count contains the number of CSRC identifiers that
//      * follow the fixed header.
//      *
//      * @return The CSRC count
//      */
//     public long getCsrcCount() {
// 	return csrcCount;
//     }
// 
//     /**
//      * Sets the CSRC count.
//      *
//      * @param csrcCount The CSRC count to set
//      */
//     public void setCsrcCount(long csrcCount) {
// 	this.csrcCount = csrcCount;
//     }
// 
//     /**
//      * Gets the sequence number. <br>
//      * <br>
//      * The sequence number increments by one for each RTP data packet
//      * sent, and may be used by the receiver to detect packet loss and
//      * to restore packet sequence. The initial value of the sequence
//      * number is random (unpredictable) to make known-plaintext attacks
//      * on encryption more difficult, even if the source itself does not
//      * encrypt, because the packets may flow through a translator that
//      * does.
//      *
//      * @return The sequence number
//      */
//     public long getSequenceNumber() {
// 	return sequenceNumber;
//     }
// 
//     /**
//      * Sets the sequence number
//      *
//      * @param seqNo The sequencenumber
//      */
//     public void setSequenceNumber(long seqNo) {
// 	this.sequenceNumber = seqNo;
//     }
// 
//     /**
//      * Gets the time stamp. <br>
//      * <br>
//      * The timestamp reflects the sampling instant of the first octet
//      * in the RTP data packet.
//      *
//      * @return The time stamp
//      */
//     public long getTimeStamp() {
// 	return timeStamp;
//     }
// 
//     /**
//      * Sets the time stamp
//      *
//      * @param timeStamp The time stamp to set
//      */
//     public void setTimeStamp(long timeStamp) {
// 	this.timeStamp = timeStamp;
//     }
// 
//     /**
//      * Gets the SSRC. <br>
//      * <br>
//      * The SSRC field identifies the synchronization source. This
//      * identifier is chosen randomly, with the intent that no two
//      * synchronization sources within the same RTP session will have
//      * the same SSRC identifier.
//      *
//      * @return The SSRC field
//      */
//     public long getSsrc() {
// 	return ssrc;
//     }
// 
//     /**
//      * Sets the SSRC.
//      *
//      * @param ssrc The SSRC to set
//      */
//     public void setSsrc(long ssrc) {
// 	this.ssrc = ssrc;
//     }
// 
//     /**
//      * Gets the payload, that is the actual payload contained in an RTP Packet.
//      *
//      * @return The payload data
//      */
//     public byte[] getPayloadData() {
// 	return data;
//     }
// 
//     /**
//      * Sets the payload data
//      *
//      * @param payloadData The payload data to set
//      */
//     public void setPayloadData(byte[] payloadData) {
// 	this.data = payloadData;
//     }
// 
//     /**
//      * Sets the marker bit for this packet.
//      *
//      * @param marker true = marker bit set
//      */
//     public void setMarker(boolean marker) {
// 	if(marker) {
// 	    markerByte=0x1;
// 	    return;
// 	}
// 	markerByte=0;
//     }
// 
//     /**
//      * Gets the marker bit for this packet.
//      *
//      * @return 1 if marker is set, 0 otherwise.
//      */
//     public byte getMarker() {
// 	return markerByte;
//     }
// 
// }


// Path: src/se/omnitor/protocol/rtp/RTPThreadHandler.java
import se.omnitor.protocol.rtp.packets.RTPPacket;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.net.SocketException;
import java.util.Random;
import java.io.IOException;


        ////////////////////////////////////////////////////////
        // Construct the header by appending all the above byte
        // arrays into RTPPacket
        ////////////////////////////////////////////////////////
        byte[] rtpPacket = new byte[0];
        // Append the compound version, Padding, Extension and CSRC Count bits
        rtpPacket = PacketUtils.append(rtpPacket, vpxcc);

        // Append the compound Marker and payload type byte
        rtpPacket = PacketUtils.append(rtpPacket, m_PT);

        // Append the sequence number
        rtpPacket = PacketUtils.append(rtpPacket, seq);

        // Append the 4 timestamp bytes
        rtpPacket = PacketUtils.append(rtpPacket, ts);

        // Append the 4 SSRC bytes
        rtpPacket = PacketUtils.append(rtpPacket, ss);

        // Append the data packet after 12 byte header
        rtpPacket = PacketUtils.append(rtpPacket, packet.getPayloadData());

        sequence_number++;

        // Create a datagram packet from the RTP byte packet, set ttl and send
        // IP: Changed destination from m_mcastPort to m_sendPort for pkt
        DatagramPacket pkt =
                new DatagramPacket(rtpPacket, rtpPacket.length,
                                   m_InetAddress, m_sendPort);