From 513c1ec6d5f9832b9d039ee4337e8e8d8417c007 Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 29 Dec 2014 08:38:29 +0800 Subject: [PATCH] fix #268, the hls pcr is negative when startup. 1.0.14 --- README.md | 1 + trunk/src/app/srs_app_hls.cpp | 15 ++++++++++----- trunk/src/core/srs_core.hpp | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index df760d1a3..da61f0431 100755 --- a/README.md +++ b/README.md @@ -383,6 +383,7 @@ Supported operating systems and hardware: * 2013-10-17, Created.
## History +* v1.0, 2014-12-29, hotfix [#268](https://github.com/winlinvip/simple-rtmp-server/issues/268), the hls pcr is negative when startup. 1.0.14 * v1.0, 2014-12-22, hotfix [#264](https://github.com/winlinvip/simple-rtmp-server/issues/264), ignore NALU when sequence header to make HLS happy. 1.0.12 * v1.0, 2014-12-20, hotfix [#264](https://github.com/winlinvip/simple-rtmp-server/issues/264), support disconnect publish connect when hls error. 1.0.11 * v1.0, 2014-12-05, [1.0 release(1.0.10)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0) released. 59391 lines. diff --git a/trunk/src/app/srs_app_hls.cpp b/trunk/src/app/srs_app_hls.cpp index 34d9eb446..a5cf80d0e 100644 --- a/trunk/src/app/srs_app_hls.cpp +++ b/trunk/src/app/srs_app_hls.cpp @@ -368,11 +368,16 @@ private: } static char* write_pcr(char* p, int64_t pcr) { - *p++ = (char) (pcr >> 25); - *p++ = (char) (pcr >> 17); - *p++ = (char) (pcr >> 9); - *p++ = (char) (pcr >> 1); - *p++ = (char) (pcr << 7 | 0x7e); + // the pcr=dts-delay + // and the pcr maybe negative + // @see https://github.com/winlinvip/simple-rtmp-server/issues/268 + int64_t v = srs_max(0, pcr); + + *p++ = (char) (v >> 25); + *p++ = (char) (v >> 17); + *p++ = (char) (v >> 9); + *p++ = (char) (v >> 1); + *p++ = (char) (v << 7 | 0x7e); *p++ = 0; return p; diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 0c29a7282..b6b808d96 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 13 +#define VERSION_REVISION 14 // server info. #define RTMP_SIG_SRS_KEY "SRS" #define RTMP_SIG_SRS_ROLE "origin/edge server"