payload_type = -1; switch(codec->codec_id) { case CODEC_ID_PCM_MULAW: payload_type = RTP_PT_ULAW; break; case CODEC_ID_PCM_ALAW: payload_type = RTP_PT_ALAW; break; case CODEC_ID_PCM_S16BE: if (codec->channels == 1) { payload_type = RTP_PT_S16BE_MONO; } else if (codec->channels == 2) { payload_type = RTP_PT_S16BE_STEREO;
for (payload_type = -1, i = 0; AVRtpPayloadTypes[i].pt >= 0; ++i) if (AVRtpPayloadTypes[i].codec_id == codec->codec_id) { if (codec->codec_id == CODEC_ID_PCM_S16BE) if (codec->channels != AVRtpPayloadTypes[i].audio_channels) continue; payload_type = AVRtpPayloadTypes[i].pt;
int rtp_get_payload_type(AVCodecContext *codec){    int payload_type;    /* compute the payload type */    payload_type = -1;    switch(codec->codec_id) {    case CODEC_ID_PCM_MULAW:        payload_type = RTP_PT_ULAW;        break;    case CODEC_ID_PCM_ALAW:        payload_type = RTP_PT_ALAW;        break;    case CODEC_ID_PCM_S16BE:        if (codec->channels == 1) {            payload_type = RTP_PT_S16BE_MONO;        } else if (codec->channels == 2) {            payload_type = RTP_PT_S16BE_STEREO;        }        break;    case CODEC_ID_MP2:    case CODEC_ID_MP3:        payload_type = RTP_PT_MPEGAUDIO;        break;    case CODEC_ID_MJPEG:        payload_type = RTP_PT_JPEG;        break;    case CODEC_ID_MPEG1VIDEO:        payload_type = RTP_PT_MPEGVIDEO;        break;    case CODEC_ID_MPEG2TS:        payload_type = RTP_PT_MPEG2TS;        break;    default:        break;    }    return payload_type;}