winlin

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

... ... @@ -240,7 +240,7 @@ public:
*p++ = 7; // size
*p++ = 0x50; // random access + PCR
// about the pcr, read https://github.com/winlinvip/simple-rtmp-server/issues/151#issuecomment-71352511
p = write_pcr(p, frame->dts - SRS_AUTO_HLS_DELAY);
p = write_pcr(p, frame->dts);
}
// PES header
... ... @@ -296,11 +296,11 @@ public:
*p++ = header_size;
// pts; // 33bits
p = write_pts(p, flags >> 6, frame->pts);
p = write_pts(p, flags >> 6, frame->pts + SRS_AUTO_HLS_DELAY);
// dts; // 33bits
if (frame->dts != frame->pts) {
p = write_pts(p, 1, frame->dts);
p = write_pts(p, 1, frame->dts + SRS_AUTO_HLS_DELAY);
}
}
... ... @@ -371,10 +371,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);
... ...
... ... @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 1
#define VERSION_MINOR 0
#define VERSION_REVISION 24
#define VERSION_REVISION 25
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
... ...