refactored seek & pause in vod

This commit is contained in:
Roman Arutyunyan 2012-10-05 15:36:05 +04:00
parent fb824371e7
commit 2ef9075f2b
6 changed files with 195 additions and 158 deletions

View file

@ -1003,71 +1003,17 @@ ngx_rtmp_cmd_pause_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_int_t
ngx_rtmp_cmd_pause(ngx_rtmp_session_t *s, ngx_rtmp_pause_t *v)
{
ngx_rtmp_header_t h;
static double trans;
static ngx_rtmp_amf_elt_t out_inf[] = {
{ NGX_RTMP_AMF_STRING,
ngx_string("code"),
"NetStream.Pause.Notify", 0 },
{ NGX_RTMP_AMF_STRING,
ngx_string("level"),
"status", 0 },
{ NGX_RTMP_AMF_STRING,
ngx_string("description"),
"Paused.", 0 },
};
static ngx_rtmp_amf_elt_t out_elts[] = {
{ NGX_RTMP_AMF_STRING,
ngx_null_string,
"onStatus", 0 },
{ NGX_RTMP_AMF_NUMBER,
ngx_null_string,
&trans, 0 },
{ NGX_RTMP_AMF_NULL,
ngx_null_string,
NULL, 0 },
{ NGX_RTMP_AMF_OBJECT,
ngx_null_string,
out_inf, sizeof(out_inf) },
};
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
"pause: state='%i' position=%i",
v->pause, (ngx_int_t) v->position);
/* send onStatus reply */
ngx_memzero(&h, sizeof(h));
h.type = NGX_RTMP_MSG_AMF_CMD;
h.csid = NGX_RTMP_CMD_CSID_AMF;
h.msid = NGX_RTMP_CMD_MSID;
"pause: state='%i' position=%i",
v->pause, (ngx_int_t) v->position);
if (v->pause) {
out_inf[0].data = "NetStream.Pause.Notify";
out_inf[2].data = "Paused.";
return ngx_rtmp_send_user_stream_eof(s, NGX_RTMP_CMD_MSID) != NGX_OK
|| ngx_rtmp_send_amf(s, &h, out_elts,
sizeof(out_elts) / sizeof(out_elts[0])) != NGX_OK
? NGX_ERROR
: NGX_OK;
return ngx_rtmp_send_status(s, "NetStream.Pause.Notify", "status",
"Paused");
} else {
return ngx_rtmp_send_status(s, "NetStream.Unpause.Notify", "status",
"Unpaused");
}
out_inf[0].data = "NetStream.Unpause.Notify";
out_inf[2].data = "Unpaused.";
return ngx_rtmp_send_user_stream_begin(s, NGX_RTMP_CMD_MSID) != NGX_OK
|| ngx_rtmp_send_amf(s, &h, out_elts,
sizeof(out_elts) / sizeof(out_elts[0])) != NGX_OK
? NGX_ERROR
: NGX_OK;
}
@ -1124,57 +1070,13 @@ ngx_rtmp_cmd_seek_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_int_t
ngx_rtmp_cmd_seek(ngx_rtmp_session_t *s, ngx_rtmp_seek_t *v)
{
ngx_rtmp_header_t h;
static double trans;
static ngx_rtmp_amf_elt_t out_inf[] = {
{ NGX_RTMP_AMF_STRING,
ngx_string("code"),
"NetStream.Play.Reset", 0 },
{ NGX_RTMP_AMF_STRING,
ngx_string("level"),
"status", 0 },
{ NGX_RTMP_AMF_STRING,
ngx_string("description"),
"Paused.", 0 },
};
static ngx_rtmp_amf_elt_t out_elts[] = {
{ NGX_RTMP_AMF_STRING,
ngx_null_string,
"onStatus", 0 },
{ NGX_RTMP_AMF_NUMBER,
ngx_null_string,
&trans, 0 },
{ NGX_RTMP_AMF_NULL,
ngx_null_string,
NULL, 0 },
{ NGX_RTMP_AMF_OBJECT,
ngx_null_string,
out_inf, sizeof(out_inf) },
};
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
"seek: offset=%i", (ngx_int_t) v->offset);
/* send onStatus reply */
ngx_memzero(&h, sizeof(h));
h.type = NGX_RTMP_MSG_AMF_CMD;
h.csid = NGX_RTMP_CMD_CSID_AMF;
h.msid = NGX_RTMP_CMD_MSID;
"seek: offset=%i", (ngx_int_t) v->offset);
return (ngx_rtmp_send_user_stream_eof(s, NGX_RTMP_CMD_MSID) != NGX_OK
|| ngx_rtmp_send_user_stream_begin(s, NGX_RTMP_CMD_MSID) != NGX_OK
|| ngx_rtmp_send_amf(s, &h, out_elts,
sizeof(out_elts) / sizeof(out_elts[0])) != NGX_OK)
|| ngx_rtmp_send_status(s, "NetStream.Seek.Notify", "status",
"Seeking")
? NGX_ERROR
: NGX_OK;
}

View file

@ -13,10 +13,12 @@ static void ngx_rtmp_flv_read_meta(ngx_rtmp_session_t *s, ngx_file_t *f);
static ngx_int_t ngx_rtmp_flv_timestamp_to_offset(ngx_rtmp_session_t *s,
ngx_file_t *f, ngx_int_t timestamp);
static ngx_int_t ngx_rtmp_flv_init(ngx_rtmp_session_t *s, ngx_file_t *f);
static ngx_int_t ngx_rtmp_flv_start(ngx_rtmp_session_t *s, ngx_file_t *f,
static ngx_int_t ngx_rtmp_flv_start(ngx_rtmp_session_t *s, ngx_file_t *f);
static ngx_int_t ngx_rtmp_flv_seek(ngx_rtmp_session_t *s, ngx_file_t *f,
ngx_uint_t offset);
static ngx_int_t ngx_rtmp_flv_stop(ngx_rtmp_session_t *s, ngx_file_t *f);
static ngx_int_t ngx_rtmp_flv_send(ngx_rtmp_session_t *s, ngx_file_t *f);
static ngx_int_t ngx_rtmp_flv_send(ngx_rtmp_session_t *s, ngx_file_t *f,
ngx_uint_t *ts);
typedef struct {
@ -389,7 +391,7 @@ ngx_rtmp_flv_read_meta(ngx_rtmp_session_t *s, ngx_file_t *f)
static ngx_int_t
ngx_rtmp_flv_send(ngx_rtmp_session_t *s, ngx_file_t *f)
ngx_rtmp_flv_send(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t *ts)
{
ngx_rtmp_flv_ctx_t *ctx;
uint32_t last_timestamp;
@ -567,7 +569,28 @@ ngx_rtmp_flv_init(ngx_rtmp_session_t *s, ngx_file_t *f)
static ngx_int_t
ngx_rtmp_flv_start(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t timestamp)
ngx_rtmp_flv_start(ngx_rtmp_session_t *s, ngx_file_t *f)
{
ngx_rtmp_flv_ctx_t *ctx;
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_flv_module);
if (ctx == NULL) {
return NGX_OK;
}
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"flv: start");
ctx->offset = -1;
ctx->msg_mask = 0;
return NGX_OK;
}
static ngx_int_t
ngx_rtmp_flv_seek(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t timestamp)
{
ngx_rtmp_flv_ctx_t *ctx;
@ -578,11 +601,9 @@ ngx_rtmp_flv_start(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t timestamp)
}
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"flv: start timestamp=%ui", timestamp);
"flv: seek timestamp=%ui", timestamp);
ctx->start_timestamp = timestamp;
ctx->offset = -1;
ctx->msg_mask = 0;
return NGX_OK;
}
@ -635,6 +656,7 @@ ngx_rtmp_flv_postconfiguration(ngx_conf_t *cf)
fmt->init = ngx_rtmp_flv_init;
fmt->start = ngx_rtmp_flv_start;
fmt->seek = ngx_rtmp_flv_seek;
fmt->stop = ngx_rtmp_flv_stop;
fmt->send = ngx_rtmp_flv_send;

View file

@ -9,12 +9,15 @@
static ngx_int_t ngx_rtmp_mp4_postconfiguration(ngx_conf_t *cf);
static ngx_int_t ngx_rtmp_mp4_init(ngx_rtmp_session_t *s, ngx_file_t *f);
static ngx_int_t ngx_rtmp_mp4_done(ngx_rtmp_session_t *s, ngx_file_t *f);
static ngx_int_t ngx_rtmp_mp4_start(ngx_rtmp_session_t *s, ngx_file_t *f,
ngx_uint_t offset);
static ngx_int_t ngx_rtmp_mp4_stop(ngx_rtmp_session_t *s, ngx_file_t *f);
static ngx_int_t ngx_rtmp_mp4_send(ngx_rtmp_session_t *s, ngx_file_t *f);
static ngx_int_t ngx_rtmp_mp4_init(ngx_rtmp_session_t *s, ngx_file_t *f);
static ngx_int_t ngx_rtmp_mp4_done(ngx_rtmp_session_t *s, ngx_file_t *f);
static ngx_int_t ngx_rtmp_mp4_start(ngx_rtmp_session_t *s, ngx_file_t *f);
static ngx_int_t ngx_rtmp_mp4_seek(ngx_rtmp_session_t *s, ngx_file_t *f,
ngx_uint_t offset);
static ngx_int_t ngx_rtmp_mp4_stop(ngx_rtmp_session_t *s, ngx_file_t *f);
static ngx_int_t ngx_rtmp_mp4_send(ngx_rtmp_session_t *s, ngx_file_t *f,
ngx_uint_t *ts);
static ngx_int_t ngx_rtmp_mp4_reset(ngx_rtmp_session_t *s);
#pragma pack(push,4)
@ -1921,7 +1924,7 @@ ngx_rtmp_mp4_seek_track(ngx_rtmp_session_t *s, ngx_rtmp_mp4_track_t *t,
static ngx_int_t
ngx_rtmp_mp4_send(ngx_rtmp_session_t *s, ngx_file_t *f)
ngx_rtmp_mp4_send(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t *ts)
{
ngx_rtmp_mp4_ctx_t *ctx;
ngx_buf_t in_buf;
@ -1962,6 +1965,7 @@ ngx_rtmp_mp4_send(ngx_rtmp_session_t *s, ngx_file_t *f)
sched = 0;
active = 0;
last_timestamp = 0;
end_timestamp = ctx->start_timestamp +
(ngx_current_msec - ctx->epoch) + buflen;
@ -2123,7 +2127,17 @@ next:
return sched;
}
return active ? NGX_OK : NGX_DONE;
if (active) {
return NGX_OK;
}
if (ts) {
*ts = last_timestamp;
}
/*ngx_rtmp_mp4_reset(s);*/
return NGX_DONE;
}
@ -2227,7 +2241,7 @@ ngx_rtmp_mp4_done(ngx_rtmp_session_t *s, ngx_file_t *f)
static ngx_int_t
ngx_rtmp_mp4_start(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t timestamp)
ngx_rtmp_mp4_seek(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t timestamp)
{
ngx_rtmp_mp4_ctx_t *ctx;
ngx_uint_t n;
@ -2239,7 +2253,7 @@ ngx_rtmp_mp4_start(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t timestamp)
}
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: start timestamp=%ui", timestamp);
"mp4: seek timestamp=%ui", timestamp);
for (n = 0; n < ctx->ntracks; ++n) {
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
@ -2248,9 +2262,52 @@ ngx_rtmp_mp4_start(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t timestamp)
ngx_rtmp_mp4_seek_track(s, &ctx->tracks[n], timestamp);
}
ctx->epoch = ngx_current_msec;
ctx->start_timestamp = timestamp;
return ngx_rtmp_mp4_reset(s);
}
static ngx_int_t
ngx_rtmp_mp4_start(ngx_rtmp_session_t *s, ngx_file_t *f)
{
ngx_rtmp_mp4_ctx_t *ctx;
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_mp4_module);
if (ctx == NULL) {
return NGX_OK;
}
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: start timestamp=%uD", ctx->start_timestamp);
ctx->epoch = ngx_current_msec;
return NGX_OK;/*ngx_rtmp_mp4_reset(s);*/
}
static ngx_int_t
ngx_rtmp_mp4_reset(ngx_rtmp_session_t *s)
{
ngx_rtmp_mp4_ctx_t *ctx;
ngx_rtmp_mp4_cursor_t *cr;
ngx_rtmp_mp4_track_t *t;
ngx_uint_t n;
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_mp4_module);
if (ctx == NULL) {
return NGX_OK;
}
t = &ctx->tracks[0];
for (n = 0; n < ctx->ntracks; ++n, ++t) {
cr = &t->cursor;
cr->not_first = 0;
}
return NGX_OK;
}
@ -2258,10 +2315,20 @@ ngx_rtmp_mp4_start(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t timestamp)
static ngx_int_t
ngx_rtmp_mp4_stop(ngx_rtmp_session_t *s, ngx_file_t *f)
{
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: stop");
ngx_rtmp_mp4_ctx_t *ctx;
return NGX_OK;
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_mp4_module);
if (ctx == NULL) {
return NGX_OK;
}
ctx->start_timestamp += (ngx_current_msec - ctx->epoch);
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: stop timestamp=%uD", ctx->start_timestamp);
return NGX_OK;/*ngx_rtmp_mp4_reset(s);*/
}
@ -2294,6 +2361,7 @@ ngx_rtmp_mp4_postconfiguration(ngx_conf_t *cf)
fmt->init = ngx_rtmp_mp4_init;
fmt->done = ngx_rtmp_mp4_done;
fmt->seek = ngx_rtmp_mp4_seek;
fmt->start = ngx_rtmp_mp4_start;
fmt->stop = ngx_rtmp_mp4_stop;
fmt->send = ngx_rtmp_mp4_send;

View file

@ -19,10 +19,18 @@ static ngx_int_t ngx_rtmp_play_postconfiguration(ngx_conf_t *cf);
static void * ngx_rtmp_play_create_app_conf(ngx_conf_t *cf);
static char * ngx_rtmp_play_merge_app_conf(ngx_conf_t *cf,
void *parent, void *child);
static ngx_int_t ngx_rtmp_play_init(ngx_rtmp_session_t *s);
static ngx_int_t ngx_rtmp_play_done(ngx_rtmp_session_t *s);
static ngx_int_t ngx_rtmp_play_start(ngx_rtmp_session_t *s, double timestamp);
static ngx_int_t ngx_rtmp_play_stop(ngx_rtmp_session_t *s);
static ngx_int_t ngx_rtmp_play_do_init(ngx_rtmp_session_t *s);
static ngx_int_t ngx_rtmp_play_do_done(ngx_rtmp_session_t *s);
static ngx_int_t ngx_rtmp_play_do_start(ngx_rtmp_session_t *s);
static ngx_int_t ngx_rtmp_play_do_stop(ngx_rtmp_session_t *s);
static ngx_int_t ngx_rtmp_play_do_seek(ngx_rtmp_session_t *s,
ngx_uint_t timestamp);
static ngx_int_t ngx_rtmp_play_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v);
static ngx_int_t ngx_rtmp_play_seek(ngx_rtmp_session_t *s, ngx_rtmp_seek_t *v);
static ngx_int_t ngx_rtmp_play_pause(ngx_rtmp_session_t *s,
ngx_rtmp_pause_t *v);
static void ngx_rtmp_play_send(ngx_event_t *e);
@ -122,6 +130,7 @@ ngx_rtmp_play_send(ngx_event_t *e)
ngx_rtmp_session_t *s = e->data;
ngx_rtmp_play_ctx_t *ctx;
ngx_int_t rc;
ngx_uint_t ts;
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_play_module);
@ -129,7 +138,9 @@ ngx_rtmp_play_send(ngx_event_t *e)
return;
}
rc = ctx->fmt->send(s, &ctx->file);
ts = 0;
rc = ctx->fmt->send(s, &ctx->file, &ts);
if (rc > 0) {
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
@ -161,13 +172,14 @@ ngx_rtmp_play_send(ngx_event_t *e)
ngx_rtmp_send_user_stream_eof(s, NGX_RTMP_MSID);
ngx_rtmp_send_play_status(s, "NetStream.Play.Complete", "status", 0, 0);
ngx_rtmp_send_play_status(s, "NetStream.Play.Complete", "status", ts, 0);
ngx_rtmp_send_status(s, "NetStream.Play.Stop", "status", "Stopped");
}
static ngx_int_t
ngx_rtmp_play_init(ngx_rtmp_session_t *s)
ngx_rtmp_play_do_init(ngx_rtmp_session_t *s)
{
ngx_rtmp_play_ctx_t *ctx;
@ -188,7 +200,7 @@ ngx_rtmp_play_init(ngx_rtmp_session_t *s)
static ngx_int_t
ngx_rtmp_play_done(ngx_rtmp_session_t *s)
ngx_rtmp_play_do_done(ngx_rtmp_session_t *s)
{
ngx_rtmp_play_ctx_t *ctx;
@ -209,10 +221,9 @@ ngx_rtmp_play_done(ngx_rtmp_session_t *s)
static ngx_int_t
ngx_rtmp_play_start(ngx_rtmp_session_t *s, double timestamp)
ngx_rtmp_play_do_start(ngx_rtmp_session_t *s)
{
ngx_rtmp_play_ctx_t *ctx;
ngx_uint_t ts;
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_play_module);
@ -220,27 +231,53 @@ ngx_rtmp_play_start(ngx_rtmp_session_t *s, double timestamp)
return NGX_ERROR;
}
ngx_rtmp_play_stop(s);
ts = (timestamp > 0 ? (ngx_uint_t) timestamp : 0);
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"play: start timestamp=%ui", ts);
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"play: start");
if (ctx->fmt && ctx->fmt->start &&
ctx->fmt->start(s, &ctx->file, ts) != NGX_OK)
ctx->fmt->start(s, &ctx->file) != NGX_OK)
{
return NGX_ERROR;
}
ngx_post_event((&ctx->send_evt), &ngx_posted_events);
ctx->playing = 1;
return NGX_OK;
}
static ngx_int_t
ngx_rtmp_play_stop(ngx_rtmp_session_t *s)
ngx_rtmp_play_do_seek(ngx_rtmp_session_t *s, ngx_uint_t timestamp)
{
ngx_rtmp_play_ctx_t *ctx;
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_play_module);
if (ctx == NULL) {
return NGX_ERROR;
}
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"play: seek timestamp=%ui", timestamp);
if (ctx->fmt && ctx->fmt->seek &&
ctx->fmt->seek(s, &ctx->file, timestamp) != NGX_OK)
{
return NGX_ERROR;
}
if (ctx->playing) {
ngx_post_event((&ctx->send_evt), &ngx_posted_events);
}
return NGX_OK;
}
static ngx_int_t
ngx_rtmp_play_do_stop(ngx_rtmp_session_t *s)
{
ngx_rtmp_play_ctx_t *ctx;
@ -267,6 +304,8 @@ ngx_rtmp_play_stop(ngx_rtmp_session_t *s)
return NGX_ERROR;
}
ctx->playing = 0;
return NGX_OK;
}
@ -285,9 +324,9 @@ ngx_rtmp_play_close_stream(ngx_rtmp_session_t *s, ngx_rtmp_close_stream_t *v)
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"play: close_stream");
ngx_rtmp_play_stop(s);
ngx_rtmp_play_do_stop(s);
ngx_rtmp_play_done(s);
ngx_rtmp_play_do_done(s);
if (ctx->file.fd != NGX_INVALID_FILE) {
ngx_close_file(ctx->file.fd);
@ -309,10 +348,7 @@ ngx_rtmp_play_seek(ngx_rtmp_session_t *s, ngx_rtmp_seek_t *v)
goto next;
}
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"play: seek offset=%f", v->offset);
ngx_rtmp_play_start(s, v->offset);
ngx_rtmp_play_do_seek(s, v->offset);
next:
return next_seek(s, v);
@ -335,9 +371,9 @@ ngx_rtmp_play_pause(ngx_rtmp_session_t *s, ngx_rtmp_pause_t *v)
(ngx_int_t) v->pause, v->position);
if (v->pause) {
ngx_rtmp_play_stop(s);
ngx_rtmp_play_do_stop(s);
} else {
ngx_rtmp_play_start(s, v->position);
ngx_rtmp_play_do_start(s); /*TODO: v->position? */
}
next:
@ -476,11 +512,15 @@ ngx_rtmp_play_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
ngx_rtmp_send_user_recorded(s, 1);
if (ngx_rtmp_play_init(s) != NGX_OK) {
if (ngx_rtmp_play_do_init(s) != NGX_OK) {
return NGX_ERROR;
}
if (ngx_rtmp_play_start(s, v->start) != NGX_OK) {
if (ngx_rtmp_play_do_seek(s, v->start < 0 ? 0 : v->start) != NGX_OK) {
return NGX_ERROR;
}
if (ngx_rtmp_play_do_start(s) != NGX_OK) {
return NGX_ERROR;
}

View file

@ -15,11 +15,13 @@ typedef ngx_int_t (*ngx_rtmp_play_init_pt) (ngx_rtmp_session_t *s,
typedef ngx_int_t (*ngx_rtmp_play_done_pt) (ngx_rtmp_session_t *s,
ngx_file_t *f);
typedef ngx_int_t (*ngx_rtmp_play_start_pt) (ngx_rtmp_session_t *s,
ngx_file_t *f);
typedef ngx_int_t (*ngx_rtmp_play_seek_pt) (ngx_rtmp_session_t *s,
ngx_file_t *f, ngx_uint_t offs);
typedef ngx_int_t (*ngx_rtmp_play_stop_pt) (ngx_rtmp_session_t *s,
ngx_file_t *f);
typedef ngx_int_t (*ngx_rtmp_play_send_pt) (ngx_rtmp_session_t *s,
ngx_file_t *f);
ngx_file_t *f, ngx_uint_t *ts);
typedef struct {
@ -30,6 +32,7 @@ typedef struct {
ngx_rtmp_play_init_pt init;
ngx_rtmp_play_done_pt done;
ngx_rtmp_play_start_pt start;
ngx_rtmp_play_seek_pt seek;
ngx_rtmp_play_stop_pt stop;
ngx_rtmp_play_send_pt send;
} ngx_rtmp_play_fmt_t;
@ -39,6 +42,7 @@ typedef struct {
ngx_file_t file;
ngx_rtmp_play_fmt_t *fmt;
ngx_event_t send_evt;
unsigned playing:1;
} ngx_rtmp_play_ctx_t;

View file

@ -399,6 +399,7 @@ ngx_rtmp_send_play_status(ngx_rtmp_session_t *s, char *code, char* level,
h.type = NGX_RTMP_MSG_AMF_META;
h.csid = NGX_RTMP_CSID_AMF;
h.msid = NGX_RTMP_MSID;
h.timestamp = duration;
return ngx_rtmp_send_amf(s, &h, out_elts,
sizeof(out_elts) / sizeof(out_elts[0]));