mirror of
https://github.com/arut/nginx-rtmp-module.git
synced 2025-08-14 09:08:15 +08:00
fixed parsing fmt=3 chunk timestamps
This commit is contained in:
@ -172,6 +172,7 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ngx_rtmp_header_t hdr;
|
ngx_rtmp_header_t hdr;
|
||||||
|
uint32_t dtime;
|
||||||
uint32_t len; /* current fragment length */
|
uint32_t len; /* current fragment length */
|
||||||
ngx_chain_t *in;
|
ngx_chain_t *in;
|
||||||
} ngx_rtmp_stream_t;
|
} ngx_rtmp_stream_t;
|
||||||
|
@ -656,9 +656,7 @@ ngx_rtmp_recv(ngx_event_t *rev)
|
|||||||
h->csid = csid;
|
h->csid = csid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get previous header to inherit data from */
|
timestamp = st->dtime;
|
||||||
timestamp = h->timestamp;
|
|
||||||
|
|
||||||
if (fmt <= 2 ) {
|
if (fmt <= 2 ) {
|
||||||
if (b->last - p < 3)
|
if (b->last - p < 3)
|
||||||
continue;
|
continue;
|
||||||
@ -716,17 +714,20 @@ ngx_rtmp_recv(ngx_event_t *rev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fmt == 1 || fmt == 2) {
|
if (st->len == 0) {
|
||||||
h->timestamp += timestamp;
|
if (fmt) {
|
||||||
|
st->dtime = timestamp;
|
||||||
} else {
|
} else {
|
||||||
h->timestamp = timestamp;
|
h->timestamp = timestamp;
|
||||||
|
st->dtime = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_log_debug8(NGX_LOG_DEBUG_RTMP, c->log, 0,
|
ngx_log_debug8(NGX_LOG_DEBUG_RTMP, c->log, 0,
|
||||||
"RTMP mheader fmt=%d %s (%d) "
|
"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,
|
(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 */
|
/* header done */
|
||||||
b->pos = p;
|
b->pos = p;
|
||||||
@ -762,6 +763,7 @@ ngx_rtmp_recv(ngx_event_t *rev)
|
|||||||
old_pos = b->last;
|
old_pos = b->last;
|
||||||
old_size = size - fsize;
|
old_size = size - fsize;
|
||||||
st->len = 0;
|
st->len = 0;
|
||||||
|
h->timestamp += st->dtime;
|
||||||
|
|
||||||
if (ngx_rtmp_receive_message(s, h, head) != NGX_OK) {
|
if (ngx_rtmp_receive_message(s, h, head) != NGX_OK) {
|
||||||
ngx_rtmp_finalize_session(s);
|
ngx_rtmp_finalize_session(s);
|
||||||
|
Reference in New Issue
Block a user