+ case AV_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 AV_CODEC_ID_VORBIS:
+ case AV_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 AV_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 AV_CODEC_ID_OPUS:
+ if (st->codec->channels > 2) {
+ av_log(s1, AV_LOG_ERROR, "Multistream opus not supported in RTP\n");
+ goto fail;
+ }
+ /* The opus RTP RFC says that all opus streams should use 48000 Hz
+ * as clock rate, since all opus sample rates can be expressed in
+ * this clock rate, and sample rate changes on the fly are supported. */
+ avpriv_set_pts_info(st, 32, 1, 48000);
+ break;
+ case AV_CODEC_ID_ILBC:
+ if (st->codec->block_align != 38 && st->codec->block_align != 50) {
+ av_log(s1, AV_LOG_ERROR, "Incorrect iLBC block size specified\n");
+ goto fail;
+ }
+ if (!s->max_frames_per_packet)
+ s->max_frames_per_packet = 1;
+ s->max_frames_per_packet = FFMIN(s->max_frames_per_packet,
+ s->max_payload_size / st->codec->block_align);
+ goto defaultcase;
+ case AV_CODEC_ID_AMR_NB:
+ case AV_CODEC_ID_AMR_WB:
+ if (!s->max_frames_per_packet)
+ s->max_frames_per_packet = 12;
+ if (st->codec->codec_id == AV_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");
+ goto fail;
+ }
+ if (st->codec->channels != 1) {
+ av_log(s1, AV_LOG_ERROR, "Only mono is supported\n");
+ goto fail;
+ }
+ case AV_CODEC_ID_AAC:
+ s->num_frames = 0;