Commit 3bcf443f authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  rtpdec: Send a valid "delay since SR" value in the RTCP RR packets
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 6cd1dbe6 22c436c8
...@@ -135,6 +135,7 @@ static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, ...@@ -135,6 +135,7 @@ static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf,
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
s->last_rtcp_reception_time = av_gettime();
s->last_rtcp_ntp_time = AV_RB64(buf + 8); s->last_rtcp_ntp_time = AV_RB64(buf + 8);
s->last_rtcp_timestamp = AV_RB32(buf + 16); s->last_rtcp_timestamp = AV_RB32(buf + 16);
if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE) { if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE) {
...@@ -261,7 +262,6 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, URLContext *fd, ...@@ -261,7 +262,6 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, URLContext *fd,
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?
if ((!fd && !avio) || (count < 1)) if ((!fd && !avio) || (count < 1))
return -1; return -1;
...@@ -315,7 +315,8 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, URLContext *fd, ...@@ -315,7 +315,8 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, URLContext *fd,
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 = av_rescale(av_gettime() - s->last_rtcp_reception_time,
65536, AV_TIME_BASE);
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 */
......
...@@ -175,6 +175,7 @@ struct RTPDemuxContext { ...@@ -175,6 +175,7 @@ struct RTPDemuxContext {
/* rtcp sender statistics receive */ /* rtcp sender statistics receive */
int64_t last_rtcp_ntp_time; int64_t last_rtcp_ntp_time;
int64_t last_rtcp_reception_time;
int64_t first_rtcp_ntp_time; int64_t first_rtcp_ntp_time;
uint32_t last_rtcp_timestamp; uint32_t last_rtcp_timestamp;
int64_t rtcp_ts_offset; int64_t rtcp_ts_offset;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment