33 #define MIN_FEEDBACK_INTERVAL 200000
64 rtp_first_dynamic_payload_handler =
handler;
112 for (handler = rtp_first_dynamic_payload_handler;
124 for (handler = rtp_first_dynamic_payload_handler;
141 if (payload_len < 20) {
143 "Invalid length for RTCP SR packet\n");
168 #define RTP_SEQ_MOD (1 << 16)
197 uint16_t udelta = seq - s->
max_seq;
198 const int MAX_DROPOUT = 3000;
199 const int MAX_MISORDER = 100;
200 const int MIN_SEQUENTIAL = 2;
217 }
else if (udelta < MAX_DROPOUT) {
219 if (seq < s->max_seq) {
242 uint32_t arrival_timestamp)
245 uint32_t transit = arrival_timestamp - sent_timestamp;
246 uint32_t prev_transit = s->
transit;
247 int32_t d = transit - prev_transit;
268 uint32_t extended_max;
269 uint32_t expected_interval;
270 uint32_t received_interval;
275 if ((!fd && !avio) || (count < 1))
303 expected = extended_max - stats->
base_seq;
305 lost =
FFMIN(lost, 0xffffff);
310 lost_interval = expected_interval - received_interval;
311 if (expected_interval == 0 || lost_interval <= 0)
314 fraction = (lost_interval << 8) / expected_interval;
316 fraction = (fraction << 24) | lost;
345 for (len = (7 + len) % 4; len % 4; len++)
352 if ((len > 0) && buf) {
354 av_dlog(s->
ic,
"sending %d bytes of RR\n", len);
356 av_dlog(s->
ic,
"result from ffurl_write: %d\n", result);
380 if ((len > 0) && buf)
395 if ((len > 0) && buf)
401 uint16_t *missing_mask)
404 uint16_t next_seq = s->
seq + 1;
407 if (!pkt || pkt->
seq == next_seq)
411 for (i = 1; i <= 16; i++) {
412 uint16_t missing_seq = next_seq + i;
414 int16_t diff = pkt->
seq - missing_seq;
421 if (pkt->
seq == missing_seq)
423 *missing_mask |= 1 << (i - 1);
426 *first_missing = next_seq;
433 int len, need_keyframe, missing_packets;
437 uint16_t first_missing = 0, missing_mask = 0;
446 if (!need_keyframe && !missing_packets)
472 if (missing_packets) {
487 if (len > 0 && buf) {
499 int payload_type,
int queue_size)
587 int payload_type, seq,
flags = 0;
593 csrc = buf[0] & 0x0f;
595 payload_type = buf[1] & 0x7f;
612 "RTP: PT=%02x: bad cseq %04x expected=%04x\n",
613 payload_type, seq, ((s->
seq + 1) & 0xffff));
618 int padding = buf[len - 1];
619 if (len >= 12 + padding)
638 ext = (
AV_RB16(buf + 2) + 1) << 2;
649 s->
st, pkt, ×tamp, buf, len, seq,
654 memcpy(pkt->
data, buf, len);
681 uint16_t seq =
AV_RB16(buf + 2);
686 int16_t diff = seq - (*cur)->
seq;
724 "RTP: missed %d packets\n", s->
queue->
seq - s->
seq - 1);
756 s->
st, pkt, ×tamp, NULL, 0, 0,
786 uint16_t seq =
AV_RB16(buf + 2);
787 int16_t diff = seq - s->
seq;
791 "RTP: dropping old packet received too late\n");
793 }
else if (diff <= 1) {
844 char *attr,
char *
value))
849 int value_size = strlen(p) + 1;
857 while (*p && *p ==
' ')
859 while (*p && *p !=
' ')
861 while (*p && *p ==
' ')
866 value, value_size)) {
867 res =
parse_fmtp(s, stream, data, attr, value);