From 1ec28a66f2c853a7e4aeb21495c0b4d9478f17db Mon Sep 17 00:00:00 2001 From: Gilles Chanteperdrix Date: Fri, 20 Feb 2015 07:14:53 +0100 Subject: rtpdec: fix issue with conversion from unsigned to signed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When receiving an RTCP packet, the difference between the last RTCP timestamp and the base timestamp may be negative. As these timestamps are of the uint32_t type, the result becomes a large integer. Cast the difference to int32_t to avoid this issue. The result of this issue is very large start times for RTSP streams, and difficulty to restart correctly after a pause. Signed-off-by: Gilles Chanteperdrix Signed-off-by: Martin Storsjö --- libavformat/rtpdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavformat/rtpdec.c') diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c index 97f142815a..522d951d35 100644 --- a/libavformat/rtpdec.c +++ b/libavformat/rtpdec.c @@ -143,7 +143,7 @@ static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, s->first_rtcp_ntp_time = s->last_rtcp_ntp_time; if (!s->base_timestamp) s->base_timestamp = s->last_rtcp_timestamp; - s->rtcp_ts_offset = s->last_rtcp_timestamp - s->base_timestamp; + s->rtcp_ts_offset = (int32_t)(s->last_rtcp_timestamp - s->base_timestamp); } break; -- cgit v1.2.3