47 #define RTCP_SR_SIZE 28
160 if (frame_size == 0) {
182 switch(st->codec->codec_id) {
185 s->buf_ptr =
s->buf + 4;
199 if (st->codec->extradata_size > 4 && st->codec->extradata[0] == 1) {
200 s->nal_length_size = (st->codec->extradata[4] & 0x03) + 1;
205 if (!
s->max_frames_per_packet)
s->max_frames_per_packet = 15;
206 s->max_frames_per_packet = av_clip(
s->max_frames_per_packet, 1, 15);
207 s->max_payload_size -= 6;
216 if (st->codec->channels > 2) {
226 if (st->codec->block_align != 38 && st->codec->block_align != 50) {
230 if (!
s->max_frames_per_packet)
231 s->max_frames_per_packet = 1;
232 s->max_frames_per_packet =
FFMIN(
s->max_frames_per_packet,
233 s->max_payload_size / st->codec->block_align);
237 if (!
s->max_frames_per_packet)
238 s->max_frames_per_packet = 12;
244 if (1 +
s->max_frames_per_packet +
n >
s->max_payload_size) {
248 if (st->codec->channels != 1) {
280 s1->streams[0]->time_base) +
s->base_timestamp;
301 for (len = (7 + len) % 4; len % 4; len++)
321 av_dlog(s1,
"rtp_send_data size=%d\n", len);
333 s->
seq = (s->
seq + 1) & 0xffff;
341 const uint8_t *buf1,
int size,
int sample_size_bits)
344 int len, max_packet_size,
n;
346 int aligned_samples_size = sample_size_bits/
av_gcd(sample_size_bits, 8);
348 max_packet_size = (s->
max_payload_size / aligned_samples_size) * aligned_samples_size;
350 if ((sample_size_bits % 8) == 0 && ((8 *
size) % sample_size_bits) != 0)
355 len =
FFMIN(max_packet_size, size);
379 if ((len + size) > max_packet_size) {
390 if (size > max_packet_size) {
394 len = max_packet_size - 4;
400 s->
buf[2] = count >> 8;
402 memcpy(s->
buf + 4, buf1, len);
416 memcpy(s->
buf_ptr, buf1, size);
425 int len, max_packet_size;
430 len = max_packet_size;
449 while (size >= TS_PACKET_SIZE) {
481 memcpy(s->
buf_ptr, buf, n * frame_size);
565 int mb_info_size = 0;
596 "Packet size %d too large for max RTP payload size %d\n",
631 .priv_class = &rtp_muxer_class,