Skip to content

Commit fb6311f

Browse files
committed
[dev] refactor the calling order of modules (developing).
1 parent 56e8715 commit fb6311f

File tree

4 files changed

+41
-69
lines changed

4 files changed

+41
-69
lines changed

config

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ RTMP_DEPS=" \
4545
$ngx_addon_dir/ngx_rtmp_netcall_module.h \
4646
$ngx_addon_dir/ngx_rtmp_play_module.h \
4747
$ngx_addon_dir/ngx_rtmp_record_module.h \
48-
$ngx_addon_dir/ngx_rtmp_notify_module.h \
4948
$ngx_addon_dir/ngx_rtmp_gop_cache_module.h \
5049
$ngx_addon_dir/ngx_rtmp_relay_module.h \
5150
$ngx_addon_dir/ngx_rtmp_exec_module.h \

ngx_http_flv_live_module.c

+4-17
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <ngx_http.h>
99
#include "ngx_http_flv_live_module.h"
1010
#include "ngx_rtmp_relay_module.h"
11-
#include "ngx_rtmp_notify_module.h"
1211
#include "ngx_rtmp_exec_module.h"
1312
#include "ngx_rtmp_bandwidth.h"
1413

@@ -1201,21 +1200,15 @@ ngx_int_t
12011200
ngx_http_flv_live_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
12021201
{
12031202
ngx_rtmp_live_app_conf_t *lacf;
1204-
ngx_rtmp_notify_app_conf_t *nacf;
12051203
ngx_http_request_t *r;
12061204

1207-
lacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_live_module);
1208-
if (lacf == NULL || !lacf->live) {
1205+
r = s->data;
1206+
if (r == NULL) {
12091207
goto next;
12101208
}
12111209

1212-
nacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_notify_module);
1213-
if (!s->relay && nacf && nacf->url[NGX_RTMP_NOTIFY_PLAY]) {
1214-
s->wait_notify_play = 1;
1215-
}
1216-
1217-
r = s->data;
1218-
if (r == NULL) {
1210+
lacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_live_module);
1211+
if (lacf == NULL || !lacf->live) {
12191212
goto next;
12201213
}
12211214

@@ -2096,7 +2089,6 @@ ngx_http_flv_live_connect_init(ngx_rtmp_session_t *s, ngx_str_t *app,
20962089
{
20972090
ngx_rtmp_connect_t v;
20982091
ngx_http_request_t *r;
2099-
ngx_rtmp_notify_srv_conf_t *nscf;
21002092

21012093
r = s->data;
21022094

@@ -2128,11 +2120,6 @@ ngx_http_flv_live_connect_init(ngx_rtmp_session_t *s, ngx_str_t *app,
21282120
return NGX_ERROR;
21292121
}
21302122

2131-
nscf = ngx_rtmp_get_module_srv_conf(s, ngx_rtmp_notify_module);
2132-
if (nscf && nscf->url[NGX_RTMP_NOTIFY_CONNECT]) {
2133-
s->wait_notify_connect = 1;
2134-
}
2135-
21362123
s->stream.len = stream->len;
21372124
s->stream.data = ngx_pstrdup(s->connection->pool, stream);
21382125

ngx_rtmp_notify_module.c

+37-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
/*
33
* Copyright (C) Roman Arutyunyan
4+
* Copyright (C) Winshining
45
*/
56

67

@@ -12,7 +13,6 @@
1213
#include "ngx_rtmp_netcall_module.h"
1314
#include "ngx_rtmp_record_module.h"
1415
#include "ngx_rtmp_relay_module.h"
15-
#include "ngx_rtmp_notify_module.h"
1616

1717

1818
static ngx_rtmp_connect_pt next_connect;
@@ -48,6 +48,42 @@ ngx_str_t ngx_rtmp_notify_urlencoded =
4848
#define NGX_RTMP_NOTIFY_PLAYING 0x02
4949

5050

51+
enum {
52+
NGX_RTMP_NOTIFY_CONNECT,
53+
NGX_RTMP_NOTIFY_DISCONNECT,
54+
NGX_RTMP_NOTIFY_SRV_MAX
55+
};
56+
57+
58+
enum {
59+
NGX_RTMP_NOTIFY_PLAY,
60+
NGX_RTMP_NOTIFY_PUBLISH,
61+
NGX_RTMP_NOTIFY_PLAY_DONE,
62+
NGX_RTMP_NOTIFY_PUBLISH_DONE,
63+
NGX_RTMP_NOTIFY_DONE,
64+
NGX_RTMP_NOTIFY_RECORD_DONE,
65+
NGX_RTMP_NOTIFY_UPDATE,
66+
NGX_RTMP_NOTIFY_APP_MAX
67+
};
68+
69+
70+
typedef struct {
71+
ngx_url_t *url[NGX_RTMP_NOTIFY_APP_MAX];
72+
ngx_flag_t active;
73+
ngx_uint_t method;
74+
ngx_msec_t update_timeout;
75+
ngx_flag_t update_strict;
76+
ngx_flag_t relay_redirect;
77+
ngx_flag_t no_resolve;
78+
} ngx_rtmp_notify_app_conf_t;
79+
80+
81+
typedef struct {
82+
ngx_url_t *url[NGX_RTMP_NOTIFY_SRV_MAX];
83+
ngx_uint_t method;
84+
} ngx_rtmp_notify_srv_conf_t;
85+
86+
5187
typedef struct {
5288
ngx_uint_t flags;
5389
u_char name[NGX_RTMP_MAX_NAME];

ngx_rtmp_notify_module.h

-50
This file was deleted.

0 commit comments

Comments
 (0)