winlin

for #268, refine the pcr start at 0, dts/pts plus delay. 2.0.105

@@ -521,6 +521,7 @@ Supported operating systems and hardware: @@ -521,6 +521,7 @@ Supported operating systems and hardware:
521 521
522 ### SRS 2.0 history 522 ### SRS 2.0 history
523 523
  524 +* v2.0, 2015-01-25, hotfix [#268](https://github.com/winlinvip/simple-rtmp-server/issues/268), refine the pcr start at 0, dts/pts plus delay. 2.0.105
524 * v2.0, 2015-01-25, hotfix [#151](https://github.com/winlinvip/simple-rtmp-server/issues/151), refine pcr=dts-800ms and use dts/pts directly. 2.0.104 525 * v2.0, 2015-01-25, hotfix [#151](https://github.com/winlinvip/simple-rtmp-server/issues/151), refine pcr=dts-800ms and use dts/pts directly. 2.0.104
525 * v2.0, 2015-01-23, hotfix [#151](https://github.com/winlinvip/simple-rtmp-server/issues/151), use absolutely overflow to make jwplayer happy. 2.0.103 526 * v2.0, 2015-01-23, hotfix [#151](https://github.com/winlinvip/simple-rtmp-server/issues/151), use absolutely overflow to make jwplayer happy. 2.0.103
526 * v2.0, 2015-01-22, for [#293](https://github.com/winlinvip/simple-rtmp-server/issues/293), support http live ts stream. 2.0.101. 527 * v2.0, 2015-01-22, for [#293](https://github.com/winlinvip/simple-rtmp-server/issues/293), support http live ts stream. 2.0.101.
@@ -585,6 +586,7 @@ Supported operating systems and hardware: @@ -585,6 +586,7 @@ Supported operating systems and hardware:
585 586
586 ### SRS 1.0 history 587 ### SRS 1.0 history
587 588
  589 +* v1.0, 2015-01-25, hotfix [#268](https://github.com/winlinvip/simple-rtmp-server/issues/268), refine the pcr start at 0, dts/pts plus delay. 1.0.25
588 * 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 590 * 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
589 * 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 591 * 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
590 * 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 592 * 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
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR 2 32 #define VERSION_MAJOR 2
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 104 34 +#define VERSION_REVISION 105
35 35
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"
@@ -198,7 +198,7 @@ public: @@ -198,7 +198,7 @@ public:
198 p[-1] |= 0x20; // Both Adaption and Payload 198 p[-1] |= 0x20; // Both Adaption and Payload
199 *p++ = 7; // size 199 *p++ = 7; // size
200 *p++ = 0x50; // random access + PCR 200 *p++ = 0x50; // random access + PCR
201 - p = write_pcr(p, frame->dts - SRS_AUTO_HLS_DELAY); 201 + p = write_pcr(p, frame->dts);
202 } 202 }
203 203
204 // PES header 204 // PES header
@@ -330,10 +330,12 @@ private: @@ -330,10 +330,12 @@ private:
330 } 330 }
331 static char* write_pcr(char* p, int64_t pcr) 331 static char* write_pcr(char* p, int64_t pcr)
332 { 332 {
333 - // the pcr=dts-delay  
334 - // and the pcr maybe negative 333 + // the pcr=dts-delay, where dts = frame->dts + delay
  334 + // and the pcr should never be negative
335 // @see https://github.com/winlinvip/simple-rtmp-server/issues/268 335 // @see https://github.com/winlinvip/simple-rtmp-server/issues/268
336 - int64_t v = srs_max(0, pcr); 336 + srs_assert(pcr >= 0);
  337 +
  338 + int64_t v = pcr;
337 339
338 *p++ = (char) (v >> 25); 340 *p++ = (char) (v >> 25);
339 *p++ = (char) (v >> 17); 341 *p++ = (char) (v >> 17);