mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #268, refine the pcr start at 0, dts/pts plus delay. 2.0.105
This commit is contained in:
commit
aaade0f04f
3 changed files with 9 additions and 5 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue