Search code examples
javaandroidnetwork-programmingsipdroid

Cannot find RTP payload for encoded audio


I am trying to encrypt Sipdroid, and to do that I have to encrypt the the RTP packet after it gets the encoded audio payload. I am using this function in RTP packet class:

public byte[] getPayload() {
    int header_len = getHeaderLength();
    int len = packet_len - header_len;

    byte[] payload = new byte[len];

    for (int i = 0; i < len; i++)
        payload[i] = packet[header_len + i];

    return payload;
}

The problem is that I cannot find where the rtp packet class is getting the payload as the RTP runs over UDP. I have gone through the UDP socket class but it is not there.

I think one way could be to get the datagram payload from the rtp packet and encrypt it.

Where is the RTP packet class getting its payload?


Solution

  • Try using

    RTPPacket packet;
    byte payload[] = packet.getpayload;
    

    it will return you the RTPpayload in the payload variable