rtpdec: Cosmetic cleanup
Mainly clean up the RTP statistics code, plus a few other obviously misindentend lines. Remove some useless comments, de-doxygenize some comments, add spacing around operators and fix a typo. Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
424b1e7642
commit
48f01398ba
@ -166,17 +166,14 @@ static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, int l
|
||||
|
||||
#define RTP_SEQ_MOD (1<<16)
|
||||
|
||||
/**
|
||||
* called on parse open packet
|
||||
*/
|
||||
static void rtp_init_statistics(RTPStatistics *s, uint16_t base_sequence) // called on parse open packet.
|
||||
static void rtp_init_statistics(RTPStatistics *s, uint16_t base_sequence)
|
||||
{
|
||||
memset(s, 0, sizeof(RTPStatistics));
|
||||
s->max_seq = base_sequence;
|
||||
s->probation = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* called whenever there is a large jump in sequence numbers, or when they get out of probation...
|
||||
*/
|
||||
static void rtp_init_sequence(RTPStatistics *s, uint16_t seq)
|
||||
@ -192,7 +189,7 @@ static void rtp_init_sequence(RTPStatistics *s, uint16_t seq)
|
||||
s->transit = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* returns 1 if we should handle this packet.
|
||||
*/
|
||||
static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq)
|
||||
@ -203,8 +200,7 @@ static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq)
|
||||
const int MIN_SEQUENTIAL = 2;
|
||||
|
||||
/* source not valid until MIN_SEQUENTIAL packets with sequence seq. numbers have been received */
|
||||
if(s->probation)
|
||||
{
|
||||
if (s->probation) {
|
||||
if (seq == s->max_seq + 1) {
|
||||
s->probation--;
|
||||
s->max_seq = seq;
|
||||
@ -220,7 +216,7 @@ static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq)
|
||||
} else if (udelta < MAX_DROPOUT) {
|
||||
// in order, with permissible gap
|
||||
if (seq < s->max_seq) {
|
||||
//sequence number wrapped; count antother 64k cycles
|
||||
// sequence number wrapped; count another 64k cycles
|
||||
s->cycles += RTP_SEQ_MOD;
|
||||
}
|
||||
s->max_seq = seq;
|
||||
@ -290,8 +286,10 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
|
||||
received_interval = stats->received - stats->received_prior;
|
||||
stats->received_prior = stats->received;
|
||||
lost_interval = expected_interval - received_interval;
|
||||
if (expected_interval==0 || lost_interval<=0) fraction= 0;
|
||||
else fraction = (lost_interval<<8)/expected_interval;
|
||||
if (expected_interval == 0 || lost_interval <= 0)
|
||||
fraction = 0;
|
||||
else
|
||||
fraction = (lost_interval << 8) / expected_interval;
|
||||
|
||||
fraction = (fraction << 24) | lost;
|
||||
|
||||
@ -299,8 +297,7 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
|
||||
avio_wb32(pb, extended_max); /* max sequence received */
|
||||
avio_wb32(pb, stats->jitter >> 4); /* jitter */
|
||||
|
||||
if(s->last_rtcp_ntp_time==AV_NOPTS_VALUE)
|
||||
{
|
||||
if (s->last_rtcp_ntp_time == AV_NOPTS_VALUE) {
|
||||
avio_wb32(pb, 0); /* last SR timestamp */
|
||||
avio_wb32(pb, 0); /* delay since last SR */
|
||||
} else {
|
||||
@ -431,8 +428,7 @@ RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext
|
||||
return s;
|
||||
}
|
||||
|
||||
void
|
||||
ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
|
||||
void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
|
||||
RTPDynamicProtocolHandler *handler)
|
||||
{
|
||||
s->dynamic_protocol_context = ctx;
|
||||
|
Loading…
x
Reference in New Issue
Block a user