From 1835957a2b09b4dc7f393649f7e7b295c90e5b64 Mon Sep 17 00:00:00 2001 From: winlin Date: Sun, 25 Jan 2015 13:04:12 +0800 Subject: [PATCH] for #151, refine pcr=dts-800ms and use dts/pts directly. 1.0.24 --- README.md | 1 + trunk/src/app/srs_app_hls.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dc64a5014..b38ca768b 100755 --- a/README.md +++ b/README.md @@ -385,6 +385,7 @@ Supported operating systems and hardware: ## History +* v1.0, 2015-01-25, hotfix [#151](https://github.com/winlinvip/simple-rtmp-server/issues/151), refine pcr=dts-800ms and use dts/pts directly. 1.0.24 * v1.0, 2015-01-23, hotfix [#151](https://github.com/winlinvip/simple-rtmp-server/issues/151), use absolutely overflow to make jwplayer happy. 1.0.23 * v1.0, 2015-01-17, hotfix [#290](https://github.com/winlinvip/simple-rtmp-server/issues/290), use iformat only for rtmp input. 1.0.22 * v1.0, 2015-01-15, [1.0r1 release(1.0.21)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0r1) released. 59472 lines. diff --git a/trunk/src/app/srs_app_hls.cpp b/trunk/src/app/srs_app_hls.cpp index 7fe9a1c15..8fcaaf3f8 100644 --- a/trunk/src/app/srs_app_hls.cpp +++ b/trunk/src/app/srs_app_hls.cpp @@ -78,7 +78,9 @@ using namespace std; // @see: NGX_RTMP_HLS_DELAY, // 63000: 700ms, ts_tbn=90000 -#define SRS_AUTO_HLS_DELAY 63000 +// 72000: 800ms, ts_tbn=90000 +// @see https://github.com/winlinvip/simple-rtmp-server/issues/151#issuecomment-71352511 +#define SRS_AUTO_HLS_DELAY 72000 // the mpegts header specifed the video/audio pid. #define TS_VIDEO_PID 256 @@ -237,6 +239,7 @@ public: p[-1] |= 0x20; // Both Adaption and Payload *p++ = 7; // size *p++ = 0x50; // random access + PCR + // about the pcr, read https://github.com/winlinvip/simple-rtmp-server/issues/151#issuecomment-71352511 p = write_pcr(p, frame->dts - SRS_AUTO_HLS_DELAY); } @@ -293,11 +296,11 @@ public: *p++ = header_size; // pts; // 33bits - p = write_pts(p, flags >> 6, frame->pts + SRS_AUTO_HLS_DELAY); + p = write_pts(p, flags >> 6, frame->pts); // dts; // 33bits if (frame->dts != frame->pts) { - p = write_pts(p, 1, frame->dts + SRS_AUTO_HLS_DELAY); + p = write_pts(p, 1, frame->dts); } }