From 0210f7ca83f8fd65261c4b9040743edf30a258fc Mon Sep 17 00:00:00 2001 From: Roman Arutyunyan Date: Tue, 4 Feb 2014 14:32:32 +0400 Subject: [PATCH] added timestamp cut in recorder to prevent negative (big unsigned) timestamps --- ngx_rtmp_record_module.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ngx_rtmp_record_module.c b/ngx_rtmp_record_module.c index a817c6e..e54a30b 100644 --- a/ngx_rtmp_record_module.c +++ b/ngx_rtmp_record_module.c @@ -892,6 +892,13 @@ ngx_rtmp_record_write_frame(ngx_rtmp_session_t *s, timestamp = h->timestamp - rctx->epoch; + if ((int32_t) timestamp < 0) { + ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0, + "record: %V cut timestamp=%D", &rracf->id, timestamp); + + timestamp = 0; + } + /* write tag header */ ph = hdr;