Merge remote-tracking branch 'qatar/master'
* qatar/master: lavc: add CODEC_CAP_DR1 to all video decoders missing them rtpdec: Cosmetic cleanup Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
67420b3de5
@ -1328,4 +1328,5 @@ AVCodec ff_bink_decoder = {
|
|||||||
.close = decode_end,
|
.close = decode_end,
|
||||||
.decode = decode_frame,
|
.decode = decode_frame,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Bink video"),
|
.long_name = NULL_IF_CONFIG_SMALL("Bink video"),
|
||||||
|
.capabilities = CODEC_CAP_DR1,
|
||||||
};
|
};
|
||||||
|
@ -293,4 +293,5 @@ AVCodec ff_dpx_decoder = {
|
|||||||
.decode = decode_frame,
|
.decode = decode_frame,
|
||||||
.capabilities = CODEC_CAP_DR1,
|
.capabilities = CODEC_CAP_DR1,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("DPX image"),
|
.long_name = NULL_IF_CONFIG_SMALL("DPX image"),
|
||||||
|
.capabilities = CODEC_CAP_DR1,
|
||||||
};
|
};
|
||||||
|
@ -1143,4 +1143,5 @@ AVCodec ff_indeo3_decoder = {
|
|||||||
.decode = decode_frame,
|
.decode = decode_frame,
|
||||||
.capabilities = CODEC_CAP_DR1,
|
.capabilities = CODEC_CAP_DR1,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 3"),
|
.long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 3"),
|
||||||
|
.capabilities = CODEC_CAP_DR1,
|
||||||
};
|
};
|
||||||
|
@ -646,4 +646,5 @@ AVCodec ff_indeo4_decoder = {
|
|||||||
.close = ff_ivi_decode_close,
|
.close = ff_ivi_decode_close,
|
||||||
.decode = ff_ivi_decode_frame,
|
.decode = ff_ivi_decode_frame,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Intel Indeo Video Interactive 4"),
|
.long_name = NULL_IF_CONFIG_SMALL("Intel Indeo Video Interactive 4"),
|
||||||
|
.capabilities = CODEC_CAP_DR1,
|
||||||
};
|
};
|
||||||
|
@ -674,4 +674,5 @@ AVCodec ff_indeo5_decoder = {
|
|||||||
.close = ff_ivi_decode_close,
|
.close = ff_ivi_decode_close,
|
||||||
.decode = ff_ivi_decode_frame,
|
.decode = ff_ivi_decode_frame,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Intel Indeo Video Interactive 5"),
|
.long_name = NULL_IF_CONFIG_SMALL("Intel Indeo Video Interactive 5"),
|
||||||
|
.capabilities = CODEC_CAP_DR1,
|
||||||
};
|
};
|
||||||
|
@ -191,4 +191,5 @@ AVCodec ff_kgv1_decoder = {
|
|||||||
.decode = decode_frame,
|
.decode = decode_frame,
|
||||||
.flush = decode_flush,
|
.flush = decode_flush,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Kega Game Video"),
|
.long_name = NULL_IF_CONFIG_SMALL("Kega Game Video"),
|
||||||
|
.capabilities = CODEC_CAP_DR1,
|
||||||
};
|
};
|
||||||
|
@ -269,4 +269,5 @@ AVCodec ff_sgi_decoder = {
|
|||||||
.decode = decode_frame,
|
.decode = decode_frame,
|
||||||
.capabilities = CODEC_CAP_DR1,
|
.capabilities = CODEC_CAP_DR1,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("SGI image"),
|
.long_name = NULL_IF_CONFIG_SMALL("SGI image"),
|
||||||
|
.capabilities = CODEC_CAP_DR1,
|
||||||
};
|
};
|
||||||
|
@ -280,4 +280,5 @@ AVCodec ff_vb_decoder = {
|
|||||||
.close = decode_end,
|
.close = decode_end,
|
||||||
.decode = decode_frame,
|
.decode = decode_frame,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Beam Software VB"),
|
.long_name = NULL_IF_CONFIG_SMALL("Beam Software VB"),
|
||||||
|
.capabilities = CODEC_CAP_DR1,
|
||||||
};
|
};
|
||||||
|
@ -272,4 +272,5 @@ AVCodec ff_yop_decoder = {
|
|||||||
.close = yop_decode_close,
|
.close = yop_decode_close,
|
||||||
.decode = yop_decode_frame,
|
.decode = yop_decode_frame,
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Psygnosis YOP Video"),
|
.long_name = NULL_IF_CONFIG_SMALL("Psygnosis YOP Video"),
|
||||||
|
.capabilities = CODEC_CAP_DR1,
|
||||||
};
|
};
|
||||||
|
@ -166,71 +166,67 @@ static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, int l
|
|||||||
|
|
||||||
#define RTP_SEQ_MOD (1<<16)
|
#define RTP_SEQ_MOD (1<<16)
|
||||||
|
|
||||||
/**
|
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) // called on parse open packet.
|
|
||||||
{
|
{
|
||||||
memset(s, 0, sizeof(RTPStatistics));
|
memset(s, 0, sizeof(RTPStatistics));
|
||||||
s->max_seq= base_sequence;
|
s->max_seq = base_sequence;
|
||||||
s->probation= 1;
|
s->probation = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* called whenever there is a large jump in sequence numbers, or when they get out of probation...
|
* 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)
|
static void rtp_init_sequence(RTPStatistics *s, uint16_t seq)
|
||||||
{
|
{
|
||||||
s->max_seq= seq;
|
s->max_seq = seq;
|
||||||
s->cycles= 0;
|
s->cycles = 0;
|
||||||
s->base_seq= seq -1;
|
s->base_seq = seq - 1;
|
||||||
s->bad_seq= RTP_SEQ_MOD + 1;
|
s->bad_seq = RTP_SEQ_MOD + 1;
|
||||||
s->received= 0;
|
s->received = 0;
|
||||||
s->expected_prior= 0;
|
s->expected_prior = 0;
|
||||||
s->received_prior= 0;
|
s->received_prior = 0;
|
||||||
s->jitter= 0;
|
s->jitter = 0;
|
||||||
s->transit= 0;
|
s->transit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* returns 1 if we should handle this packet.
|
* returns 1 if we should handle this packet.
|
||||||
*/
|
*/
|
||||||
static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq)
|
static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq)
|
||||||
{
|
{
|
||||||
uint16_t udelta= seq - s->max_seq;
|
uint16_t udelta = seq - s->max_seq;
|
||||||
const int MAX_DROPOUT= 3000;
|
const int MAX_DROPOUT = 3000;
|
||||||
const int MAX_MISORDER = 100;
|
const int MAX_MISORDER = 100;
|
||||||
const int MIN_SEQUENTIAL = 2;
|
const int MIN_SEQUENTIAL = 2;
|
||||||
|
|
||||||
/* source not valid until MIN_SEQUENTIAL packets with sequence seq. numbers have been received */
|
/* 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) {
|
||||||
if(seq==s->max_seq + 1) {
|
|
||||||
s->probation--;
|
s->probation--;
|
||||||
s->max_seq= seq;
|
s->max_seq = seq;
|
||||||
if(s->probation==0) {
|
if (s->probation == 0) {
|
||||||
rtp_init_sequence(s, seq);
|
rtp_init_sequence(s, seq);
|
||||||
s->received++;
|
s->received++;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
s->probation= MIN_SEQUENTIAL - 1;
|
s->probation = MIN_SEQUENTIAL - 1;
|
||||||
s->max_seq = seq;
|
s->max_seq = seq;
|
||||||
}
|
}
|
||||||
} else if (udelta < MAX_DROPOUT) {
|
} else if (udelta < MAX_DROPOUT) {
|
||||||
// in order, with permissible gap
|
// in order, with permissible gap
|
||||||
if(seq < s->max_seq) {
|
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->cycles += RTP_SEQ_MOD;
|
||||||
}
|
}
|
||||||
s->max_seq= seq;
|
s->max_seq = seq;
|
||||||
} else if (udelta <= RTP_SEQ_MOD - MAX_MISORDER) {
|
} else if (udelta <= RTP_SEQ_MOD - MAX_MISORDER) {
|
||||||
// sequence made a large jump...
|
// sequence made a large jump...
|
||||||
if(seq==s->bad_seq) {
|
if (seq == s->bad_seq) {
|
||||||
// two sequential packets-- assume that the other side restarted without telling us; just resync.
|
// two sequential packets-- assume that the other side restarted without telling us; just resync.
|
||||||
rtp_init_sequence(s, seq);
|
rtp_init_sequence(s, seq);
|
||||||
} else {
|
} else {
|
||||||
s->bad_seq= (seq + 1) & (RTP_SEQ_MOD-1);
|
s->bad_seq = (seq + 1) & (RTP_SEQ_MOD - 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -246,7 +242,7 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
|
|||||||
uint8_t *buf;
|
uint8_t *buf;
|
||||||
int len;
|
int len;
|
||||||
int rtcp_bytes;
|
int rtcp_bytes;
|
||||||
RTPStatistics *stats= &s->statistics;
|
RTPStatistics *stats = &s->statistics;
|
||||||
uint32_t lost;
|
uint32_t lost;
|
||||||
uint32_t extended_max;
|
uint32_t extended_max;
|
||||||
uint32_t expected_interval;
|
uint32_t expected_interval;
|
||||||
@ -254,7 +250,7 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
|
|||||||
uint32_t lost_interval;
|
uint32_t lost_interval;
|
||||||
uint32_t expected;
|
uint32_t expected;
|
||||||
uint32_t fraction;
|
uint32_t fraction;
|
||||||
uint64_t ntp_time= s->last_rtcp_ntp_time; // TODO: Get local ntp time?
|
uint64_t ntp_time = s->last_rtcp_ntp_time; // TODO: Get local ntp time?
|
||||||
|
|
||||||
if (!s->rtp_ctx || (count < 1))
|
if (!s->rtp_ctx || (count < 1))
|
||||||
return -1;
|
return -1;
|
||||||
@ -281,31 +277,32 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
|
|||||||
avio_wb32(pb, s->ssrc); // server SSRC
|
avio_wb32(pb, s->ssrc); // server SSRC
|
||||||
// some placeholders we should really fill...
|
// some placeholders we should really fill...
|
||||||
// RFC 1889/p64
|
// RFC 1889/p64
|
||||||
extended_max= stats->cycles + stats->max_seq;
|
extended_max = stats->cycles + stats->max_seq;
|
||||||
expected= extended_max - stats->base_seq + 1;
|
expected = extended_max - stats->base_seq + 1;
|
||||||
lost= expected - stats->received;
|
lost = expected - stats->received;
|
||||||
lost= FFMIN(lost, 0xffffff); // clamp it since it's only 24 bits...
|
lost = FFMIN(lost, 0xffffff); // clamp it since it's only 24 bits...
|
||||||
expected_interval= expected - stats->expected_prior;
|
expected_interval = expected - stats->expected_prior;
|
||||||
stats->expected_prior= expected;
|
stats->expected_prior = expected;
|
||||||
received_interval= stats->received - stats->received_prior;
|
received_interval = stats->received - stats->received_prior;
|
||||||
stats->received_prior= stats->received;
|
stats->received_prior = stats->received;
|
||||||
lost_interval= expected_interval - received_interval;
|
lost_interval = expected_interval - received_interval;
|
||||||
if (expected_interval==0 || lost_interval<=0) fraction= 0;
|
if (expected_interval == 0 || lost_interval <= 0)
|
||||||
else fraction = (lost_interval<<8)/expected_interval;
|
fraction = 0;
|
||||||
|
else
|
||||||
|
fraction = (lost_interval << 8) / expected_interval;
|
||||||
|
|
||||||
fraction= (fraction<<24) | lost;
|
fraction = (fraction << 24) | lost;
|
||||||
|
|
||||||
avio_wb32(pb, fraction); /* 8 bits of fraction, 24 bits of total packets lost */
|
avio_wb32(pb, fraction); /* 8 bits of fraction, 24 bits of total packets lost */
|
||||||
avio_wb32(pb, extended_max); /* max sequence received */
|
avio_wb32(pb, extended_max); /* max sequence received */
|
||||||
avio_wb32(pb, stats->jitter>>4); /* jitter */
|
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); /* last SR timestamp */
|
||||||
avio_wb32(pb, 0); /* delay since last SR */
|
avio_wb32(pb, 0); /* delay since last SR */
|
||||||
} else {
|
} else {
|
||||||
uint32_t middle_32_bits= s->last_rtcp_ntp_time>>16; // this is valid, right? do we need to handle 64 bit values special?
|
uint32_t middle_32_bits = s->last_rtcp_ntp_time >> 16; // this is valid, right? do we need to handle 64 bit values special?
|
||||||
uint32_t delay_since_last= ntp_time - s->last_rtcp_ntp_time;
|
uint32_t delay_since_last = ntp_time - s->last_rtcp_ntp_time;
|
||||||
|
|
||||||
avio_wb32(pb, middle_32_bits); /* last SR timestamp */
|
avio_wb32(pb, middle_32_bits); /* last SR timestamp */
|
||||||
avio_wb32(pb, delay_since_last); /* delay since last SR */
|
avio_wb32(pb, delay_since_last); /* delay since last SR */
|
||||||
@ -431,9 +428,8 @@ RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
|
||||||
ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
|
RTPDynamicProtocolHandler *handler)
|
||||||
RTPDynamicProtocolHandler *handler)
|
|
||||||
{
|
{
|
||||||
s->dynamic_protocol_context = ctx;
|
s->dynamic_protocol_context = ctx;
|
||||||
s->parse_packet = handler->parse_packet;
|
s->parse_packet = handler->parse_packet;
|
||||||
@ -674,7 +670,7 @@ static int rtp_parse_queued_packet(RTPDemuxContext *s, AVPacket *pkt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt,
|
static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt,
|
||||||
uint8_t **bufptr, int len)
|
uint8_t **bufptr, int len)
|
||||||
{
|
{
|
||||||
uint8_t* buf = bufptr ? *bufptr : NULL;
|
uint8_t* buf = bufptr ? *bufptr : NULL;
|
||||||
int ret, flags = 0;
|
int ret, flags = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user