From 9cbc753e8e4c6a8d6703f58f62072364f8d83ad5 Mon Sep 17 00:00:00 2001 From: winlin Date: Sun, 25 Jan 2015 13:30:45 +0800 Subject: [PATCH] for #151, #268, refine the pcr start at 0, dts/pts plus delay. 1.0.25 --- trunk/src/app/srs_app_hls.cpp | 14 ++++++++------ trunk/src/core/srs_core.hpp | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/trunk/src/app/srs_app_hls.cpp b/trunk/src/app/srs_app_hls.cpp index 8fcaaf3f8..be90a1219 100644 --- a/trunk/src/app/srs_app_hls.cpp +++ b/trunk/src/app/srs_app_hls.cpp @@ -240,7 +240,7 @@ public: *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); + p = write_pcr(p, frame->dts); } // PES header @@ -296,11 +296,11 @@ public: *p++ = header_size; // pts; // 33bits - p = write_pts(p, flags >> 6, frame->pts); + p = write_pts(p, flags >> 6, frame->pts + SRS_AUTO_HLS_DELAY); // dts; // 33bits if (frame->dts != frame->pts) { - p = write_pts(p, 1, frame->dts); + p = write_pts(p, 1, frame->dts + SRS_AUTO_HLS_DELAY); } } @@ -371,10 +371,12 @@ private: } static char* write_pcr(char* p, int64_t pcr) { - // the pcr=dts-delay - // and the pcr maybe negative + // the pcr=dts-delay, where dts = frame->dts + delay + // and the pcr should never be negative // @see https://github.com/winlinvip/simple-rtmp-server/issues/268 - int64_t v = srs_max(0, pcr); + srs_assert(pcr >= 0); + + int64_t v = pcr; *p++ = (char) (v >> 25); *p++ = (char) (v >> 17); diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 93f63c120..9c74cea4a 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // current release version #define VERSION_MAJOR 1 #define VERSION_MINOR 0 -#define VERSION_REVISION 24 +#define VERSION_REVISION 25 // server info. #define RTMP_SIG_SRS_KEY "SRS"