1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

fix #268, the hls pcr is negative when startup. 1.0.14

This commit is contained in:
winlin 2014-12-29 08:38:29 +08:00
parent e77e4cfb8b
commit 513c1ec6d5
3 changed files with 12 additions and 6 deletions

View file

@ -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;