winlin

for #151, refine pcr=dts-800ms and use dts/pts directly. 1.0.24

@@ -385,6 +385,7 @@ Supported operating systems and hardware: @@ -385,6 +385,7 @@ Supported operating systems and hardware:
385 385
386 ## History 386 ## History
387 387
  388 +* 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
388 * 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 389 * 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
389 * 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 390 * 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
390 * <strong>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.</strong> 391 * <strong>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.</strong>
@@ -78,7 +78,9 @@ using namespace std; @@ -78,7 +78,9 @@ using namespace std;
78 78
79 // @see: NGX_RTMP_HLS_DELAY, 79 // @see: NGX_RTMP_HLS_DELAY,
80 // 63000: 700ms, ts_tbn=90000 80 // 63000: 700ms, ts_tbn=90000
81 -#define SRS_AUTO_HLS_DELAY 63000 81 +// 72000: 800ms, ts_tbn=90000
  82 +// @see https://github.com/winlinvip/simple-rtmp-server/issues/151#issuecomment-71352511
  83 +#define SRS_AUTO_HLS_DELAY 72000
82 84
83 // the mpegts header specifed the video/audio pid. 85 // the mpegts header specifed the video/audio pid.
84 #define TS_VIDEO_PID 256 86 #define TS_VIDEO_PID 256
@@ -237,6 +239,7 @@ public: @@ -237,6 +239,7 @@ public:
237 p[-1] |= 0x20; // Both Adaption and Payload 239 p[-1] |= 0x20; // Both Adaption and Payload
238 *p++ = 7; // size 240 *p++ = 7; // size
239 *p++ = 0x50; // random access + PCR 241 *p++ = 0x50; // random access + PCR
  242 + // about the pcr, read https://github.com/winlinvip/simple-rtmp-server/issues/151#issuecomment-71352511
240 p = write_pcr(p, frame->dts - SRS_AUTO_HLS_DELAY); 243 p = write_pcr(p, frame->dts - SRS_AUTO_HLS_DELAY);
241 } 244 }
242 245
@@ -293,11 +296,11 @@ public: @@ -293,11 +296,11 @@ public:
293 *p++ = header_size; 296 *p++ = header_size;
294 297
295 // pts; // 33bits 298 // pts; // 33bits
296 - p = write_pts(p, flags >> 6, frame->pts + SRS_AUTO_HLS_DELAY); 299 + p = write_pts(p, flags >> 6, frame->pts);
297 300
298 // dts; // 33bits 301 // dts; // 33bits
299 if (frame->dts != frame->pts) { 302 if (frame->dts != frame->pts) {
300 - p = write_pts(p, 1, frame->dts + SRS_AUTO_HLS_DELAY); 303 + p = write_pts(p, 1, frame->dts);
301 } 304 }
302 } 305 }
303 306