1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-15 04:42:04 +00:00

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

This commit is contained in:
winlin 2015-01-25 13:30:45 +08:00
parent b0daf1482d
commit 9cbc753e8e
2 changed files with 9 additions and 7 deletions

View file

@ -240,7 +240,7 @@ public:
*p++ = 7; // size *p++ = 7; // size
*p++ = 0x50; // random access + PCR *p++ = 0x50; // random access + PCR
// about the pcr, read https://github.com/winlinvip/simple-rtmp-server/issues/151#issuecomment-71352511 // 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 // PES header
@ -296,11 +296,11 @@ public:
*p++ = header_size; *p++ = header_size;
// pts; // 33bits // pts; // 33bits
p = write_pts(p, flags >> 6, frame->pts); p = write_pts(p, flags >> 6, frame->pts + SRS_AUTO_HLS_DELAY);
// dts; // 33bits // dts; // 33bits
if (frame->dts != frame->pts) { 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) static char* write_pcr(char* p, int64_t pcr)
{ {
// the pcr=dts-delay // the pcr=dts-delay, where dts = frame->dts + delay
// and the pcr maybe negative // and the pcr should never be negative
// @see https://github.com/winlinvip/simple-rtmp-server/issues/268 // @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 >> 25);
*p++ = (char) (v >> 17); *p++ = (char) (v >> 17);

View file

@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version // current release version
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 0 #define VERSION_MINOR 0
#define VERSION_REVISION 24 #define VERSION_REVISION 25
// server info. // server info.
#define RTMP_SIG_SRS_KEY "SRS" #define RTMP_SIG_SRS_KEY "SRS"