mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-11 06:41:08 +02:00
fixed parsing fmt=3 chunk timestamps
This commit is contained in:
parent
513f2f7e83
commit
391bb0b392
|
@ -172,6 +172,7 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
ngx_rtmp_header_t hdr;
|
||||
uint32_t dtime;
|
||||
uint32_t len; /* current fragment length */
|
||||
ngx_chain_t *in;
|
||||
} ngx_rtmp_stream_t;
|
||||
|
|
|
@ -656,9 +656,7 @@ ngx_rtmp_recv(ngx_event_t *rev)
|
|||
h->csid = csid;
|
||||
}
|
||||
|
||||
/* get previous header to inherit data from */
|
||||
timestamp = h->timestamp;
|
||||
|
||||
timestamp = st->dtime;
|
||||
if (fmt <= 2 ) {
|
||||
if (b->last - p < 3)
|
||||
continue;
|
||||
|
@ -716,17 +714,20 @@ ngx_rtmp_recv(ngx_event_t *rev)
|
|||
}
|
||||
}
|
||||
|
||||
if (fmt == 1 || fmt == 2) {
|
||||
h->timestamp += timestamp;
|
||||
} else {
|
||||
h->timestamp = timestamp;
|
||||
if (st->len == 0) {
|
||||
if (fmt) {
|
||||
st->dtime = timestamp;
|
||||
} else {
|
||||
h->timestamp = timestamp;
|
||||
st->dtime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ngx_log_debug8(NGX_LOG_DEBUG_RTMP, c->log, 0,
|
||||
"RTMP mheader fmt=%d %s (%d) "
|
||||
"time=%uD/%uD mlen=%D len=%D msid=%D",
|
||||
"time=%uD+%uD mlen=%D len=%D msid=%D",
|
||||
(int)fmt, ngx_rtmp_message_type(h->type), (int)h->type,
|
||||
timestamp, h->timestamp, h->mlen, st->len, h->msid);
|
||||
h->timestamp, st->dtime, h->mlen, st->len, h->msid);
|
||||
|
||||
/* header done */
|
||||
b->pos = p;
|
||||
|
@ -762,6 +763,7 @@ ngx_rtmp_recv(ngx_event_t *rev)
|
|||
old_pos = b->last;
|
||||
old_size = size - fsize;
|
||||
st->len = 0;
|
||||
h->timestamp += st->dtime;
|
||||
|
||||
if (ngx_rtmp_receive_message(s, h, head) != NGX_OK) {
|
||||
ngx_rtmp_finalize_session(s);
|
||||
|
|
Loading…
Reference in a new issue