Commit 15786428 authored by Boris Nagels's avatar Boris Nagels Committed by Michael Niedermayer

avformat/rtpenc: Fix integer overflow in NTP_TO_RTP_FORMAT

RTCP synchronization packet was broken since commit in ffmpeg version > 2.8.3
(commit: e04b039b) Since this commit (2e814d03)
"rtpenc: Simplify code by introducing a macro for rescaling NTP timestamps", NTP_TO_RTP_FORMAT
uses av_rescale_rnd() function to add the data to the packet.

This causes an overflow in the av_rescale_rnd() function and it will return INT64_MIN.
Causing the NTP stamp in the RTCP packet to have an invalid value.

Github: Closes #182

Reverting commit '2e814d03' solves the problem.
(cherry picked from commit 1109ed79)
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent b42ade51
......@@ -292,7 +292,8 @@ static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time, int bye)
avio_w8(s1->pb, RTCP_SR);
avio_wb16(s1->pb, 6); /* length in words - 1 */
avio_wb32(s1->pb, s->ssrc);
avio_wb64(s1->pb, NTP_TO_RTP_FORMAT(ntp_time));
avio_wb32(s1->pb, ntp_time / 1000000);
avio_wb32(s1->pb, ((ntp_time % 1000000) << 32) / 1000000);
avio_wb32(s1->pb, rtp_ts);
avio_wb32(s1->pb, s->packet_count);
avio_wb32(s1->pb, s->octet_count);
......
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