+ case CODEC_ID_H264:
+ /* check for H.264 MP4 syntax */
+ if (st->codec->extradata_size > 4 && st->codec->extradata[0] == 1) {
+ s->nal_length_size = (st->codec->extradata[4] & 0x03) + 1;
+ }
+ break;
+ case CODEC_ID_VORBIS:
+ case CODEC_ID_THEORA:
+ if (!s->max_frames_per_packet) s->max_frames_per_packet = 15;
+ s->max_frames_per_packet = av_clip(s->max_frames_per_packet, 1, 15);
+ s->max_payload_size -= 6; // ident+frag+tdt/vdt+pkt_num+pkt_length
+ s->num_frames = 0;
+ goto defaultcase;
+ case CODEC_ID_VP8:
+ av_log(s1, AV_LOG_ERROR, "RTP VP8 payload implementation is "
+ "incompatible with the latest spec drafts.\n");
+ break;
+ case CODEC_ID_ADPCM_G722:
+ /* Due to a historical error, the clock rate for G722 in RTP is
+ * 8000, even if the sample rate is 16000. See RFC 3551. */
+ avpriv_set_pts_info(st, 32, 1, 8000);
+ break;
+ case CODEC_ID_AMR_NB:
+ case CODEC_ID_AMR_WB:
+ if (!s->max_frames_per_packet)
+ s->max_frames_per_packet = 12;
+ if (st->codec->codec_id == CODEC_ID_AMR_NB)
+ n = 31;
+ else
+ n = 61;
+ /* max_header_toc_size + the largest AMR payload must fit */
+ if (1 + s->max_frames_per_packet + n > s->max_payload_size) {
+ av_log(s1, AV_LOG_ERROR, "RTP max payload size too small for AMR\n");
+ return -1;
+ }
+ if (st->codec->channels != 1) {
+ av_log(s1, AV_LOG_ERROR, "Only mono is supported\n");
+ return -1;
+ }