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:
### SRS 2.0 history
* 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
* 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
* 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
* 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:
### SRS 1.0 history
* 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
* 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
... ...
... ... @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 104
#define VERSION_REVISION 105
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
... ...
... ... @@ -198,7 +198,7 @@ public:
p[-1] |= 0x20; // Both Adaption and Payload
*p++ = 7; // size
*p++ = 0x50; // random access + PCR
p = write_pcr(p, frame->dts - SRS_AUTO_HLS_DELAY);
p = write_pcr(p, frame->dts);
}
// PES header
... ... @@ -330,10 +330,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);
... ...