[vlc-devel] [PATCH] Fix a potential overflow of rtp timestamp

Denis Charmet typx at dinauz.org
Mon Jun 27 17:56:01 CEST 2011


rtp_init_ts return a 48 bits timestamp which can overflow when multiplied by clock_rate (90000) in rtp_compute_ts.
This can cause the rtptime field of RTP-Info line (in RTSP PLAY answer) to be different of the rtp timestamp which quite screw OpenCore rtsp client so the android's MediaPlayer.
---
 modules/stream_out/rtp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index 3e41159..2180f86 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -1541,9 +1541,9 @@ static int64_t rtp_init_ts( const vod_media_t *p_media,
     /* As per RFC 2326, session identifiers are at least 8 bytes long */
     strncpy((char *)&i_ts_init, psz_vod_session, sizeof(uint64_t));
     i_ts_init ^= (uintptr_t)p_media;
-    /* Limit the timestamp to 48 bytes, this is enough and allows us
+    /* Limit the timestamp to 46 bits, this is enough and allows us
      * to stay away from overflows */
-    i_ts_init &= 0xFFFFFFFFFFFF;
+    i_ts_init &= 0x3FFFFFFFFFFF;
     return i_ts_init;
 }
 
-- 
1.5.6.5




More information about the vlc-devel mailing list