Skip to content

Commit

Permalink
Fix bug, failed to pull(over http-flv) again.
Browse files Browse the repository at this point in the history
  • Loading branch information
im-pingo committed Apr 26, 2020
1 parent f1db912 commit 8ce2454
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
4 changes: 1 addition & 3 deletions modules/nginx-rtmp-module/ngx_live_relay.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,7 @@ ngx_live_relay_close_stream(ngx_rtmp_session_t *s, ngx_rtmp_close_stream_t *v)
}
}
}
}

if (!s->publishing) {
} else {
rctx = ngx_rtmp_get_module_ctx(s, ngx_live_relay_module);
if (rctx) {
// push close will trigger relay push reconnect in relay modules
Expand Down
23 changes: 8 additions & 15 deletions modules/nginx-rtmp-module/ngx_rtmp_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,12 @@ ngx_rtmp_close_session(ngx_rtmp_session_t *s)

if (s->in_old_pool) {
NGX_DESTROY_POOL(s->in_old_pool);
s->in_old_pool = NULL;
}

if (s->in_pool) {
NGX_DESTROY_POOL(s->in_pool);
s->in_pool = NULL;
}

if (s->live_type == NGX_HTTP_FLV_LIVE) {
Expand All @@ -314,7 +316,10 @@ ngx_rtmp_close_session(ngx_rtmp_session_t *s)
}
}

NGX_DESTROY_POOL(s->pool);
if (s->pool) {
NGX_DESTROY_POOL(s->pool);
s->pool = NULL;
}
}


Expand Down Expand Up @@ -391,24 +396,18 @@ ngx_rtmp_finalize_session(ngx_rtmp_session_t *s)
ngx_event_t *e;
ngx_connection_t *c;

ngx_log_error(NGX_LOG_INFO, s->log, 0, "finalize session");

if (s->live_type == NGX_HLS_LIVE) {
ngx_rtmp_finalize_fake_session(s);
return;
}

if (s->destroyed) {
return;
}

s->destroyed = 1;

c = s->connection;
if (c && c->destroyed) {
return;
}

ngx_log_error(NGX_LOG_INFO, s->log, 0, "finalize session");

if (s->live_type != NGX_RTMP_LIVE) {
e = &s->close;
e->data = s;
Expand Down Expand Up @@ -439,12 +438,6 @@ ngx_rtmp_finalize_fake_session(ngx_rtmp_session_t *s)
{
ngx_log_error(NGX_LOG_INFO, s->log, 0, "finalize fake session");

if (s->destroyed) {
return;
}

s->destroyed = 1;

ngx_rtmp_fire_event(s, NGX_RTMP_DISCONNECT, NULL, NULL);

ngx_rtmp_close_session(s);
Expand Down
2 changes: 2 additions & 0 deletions modules/nginx-rtmp-module/ngx_rtmp_shared_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ ngx_rtmp_free_merge_frame(ngx_rtmp_session_t *s)
s->prepare_frame[n] = NULL;
}
}

s->nframe = 0;
}

void
Expand Down

0 comments on commit 8ce2454

Please sign in to comment.