The RTP payload type is an arbitrary number that identifies which media codec was used to generate the payload data. Knowing the correct number to use requires some context. Usually the two endpoints that are exchanging RTP packets will have a way to negotiate the mapping between numbers and codecs before starting the RTP stream. One common way to set this mapping is to use SDP. SDP messages can define a codec mapping through media lines and rtpmap attributes.
Media lines in SDP tell the type of media, what port the media should be sent to, what transfer protocol to use, and format parameters for the transfer protocol. A common transfer protocol is “RTP/AVC” which specifies that the codec data will be wrapped in RTP packets. When the “RTP/AVC” protocol is used, the format parameters are RTP payload type numbers. Each payload type number in the media line might be associated with an rtpmap attribute line. The rtpmap attribute line uses a registered string to tell which codec is associated with the number.