mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-06-28 16:09:00 +02:00
fixed live timestamps in non-atc mode
This commit is contained in:
parent
b4ca0bede8
commit
9b4725a01a
|
@ -321,7 +321,7 @@ ngx_rtmp_live_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
|
|||
size_t header_offset, last_offset;
|
||||
ngx_uint_t header_version, meta_version;
|
||||
ngx_int_t diff_timestamp;
|
||||
uint32_t *last;
|
||||
uint32_t *last, timestamp;
|
||||
|
||||
lacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_live_module);
|
||||
if (lacf == NULL) {
|
||||
|
@ -353,10 +353,15 @@ ngx_rtmp_live_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
|
|||
|
||||
cscf = ngx_rtmp_get_module_srv_conf(s, ngx_rtmp_core_module);
|
||||
|
||||
timestamp = h->timestamp;
|
||||
if (lacf->atc == 0) {
|
||||
timestamp += h->timeshift;
|
||||
}
|
||||
|
||||
/* prepare output header */
|
||||
ngx_memzero(&ch, sizeof(ch));
|
||||
ngx_memzero(&lh, sizeof(lh));
|
||||
ch.timestamp = h->timestamp;
|
||||
ch.timestamp = timestamp;
|
||||
ch.msid = NGX_RTMP_LIVE_MSID;
|
||||
ch.type = h->type;
|
||||
lh.msid = ch.msid;
|
||||
|
@ -420,20 +425,20 @@ ngx_rtmp_live_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
|
|||
ss = pctx->session;
|
||||
last = (uint32_t *)((u_char *)pctx + last_offset);
|
||||
|
||||
ch.timestamp = lacf->atc ? h->timestamp :
|
||||
h->timeshift + h->timestamp - (uint32_t)ss->epoch;
|
||||
ch.timestamp = timestamp;
|
||||
if (lacf->atc == 0) {
|
||||
ch.timestamp -= (uint32_t)ss->epoch;
|
||||
}
|
||||
|
||||
/* send absolute frame */
|
||||
if ((pctx->msg_mask & (1 << h->type)) == 0) {
|
||||
|
||||
/* packet from the past for the peer */
|
||||
if (lacf->atc == 0 &&
|
||||
h->timeshift + h->timestamp < (uint32_t)ss->epoch)
|
||||
{
|
||||
if (lacf->atc == 0 && timestamp < (uint32_t)ss->epoch) {
|
||||
ngx_log_debug3(NGX_LOG_DEBUG_RTMP, ss->connection->log, 0,
|
||||
"live: av: %s packet from the past %uD < %uD",
|
||||
h->type == NGX_RTMP_MSG_VIDEO ? "video" : "audio",
|
||||
h->timeshift + h->timestamp, (uint32_t)ss->epoch);
|
||||
timestamp, (uint32_t)ss->epoch);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue