arut / nginx-live-module Goto Github PK
View Code? Open in Web Editor NEWHTTP live module
License: BSD 2-Clause "Simplified" License
HTTP live module
License: BSD 2-Clause "Simplified" License
Hi,
i have a problem with module, only work with 2 connections, can you help me with NGINX conf?
Thx
Hi. Please take a look.
Since the type of p is ngx_socket_t* (not u_char *).
diff --git a/src/ngx_http_live_module.c b/src/ngx_http_live_module.c
index cfa3905..7e6756b 100644
--- a/src/ngx_http_live_module.c
+++ b/src/ngx_http_live_module.c
@@ -1110,7 +1110,7 @@ ngx_http_live_init_module(ngx_cycle_t *cycle)
size_t buffer_size;
socklen_t olen;
ngx_uint_t n, nfd;
- ngx_socket_t *p, fds[2];
+ ngx_socket_t *sockets, fds[2];
ngx_core_conf_t *ccf;
ngx_pool_cleanup_t *cln;
ngx_http_live_main_conf_t *lmcf;
@@ -1125,13 +1125,13 @@ ngx_http_live_init_module(ngx_cycle_t *cycle)
nfd = ccf->worker_processes;
- p = ngx_palloc(cycle->pool, nfd * 2 * sizeof(ngx_socket_t));
- if (p == NULL) {
+ sockets = ngx_palloc(cycle->pool, nfd * 2 * sizeof(ngx_socket_t));
+ if (sockets == NULL) {
return NGX_ERROR;
}
- lmcf->read_fd = p;
- lmcf->write_fd = p + nfd * sizeof(ngx_socket_t);
+ lmcf->read_fd = sockets;
+ lmcf->write_fd = sockets + nfd;
cln = ngx_pool_cleanup_add(cycle->pool, 0);
if (cln == NULL) {
Hi.
Take a look, please.
diff --git a/src/ngx_http_live_module.c b/src/ngx_http_live_module.c
index e30812d..d7407c6 100644
--- a/src/ngx_http_live_module.c
+++ b/src/ngx_http_live_module.c
@@ -1291,6 +1291,10 @@ ngx_http_live_init_process(ngx_cycle_t *cycle)
lmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_live_module);
+ if (ngx_process != NGX_PROCESS_WORKER) {
+ return NGX_OK;
+ }
+
if (lmcf == NULL || lmcf->nfd == 0) {
return NGX_OK;
}
Because the other non-worker processes like cache process is meaningless to involve socketpairs.
And their value of ngx_worker is 0, thus they will occupy the same fd for reading.
for (n = 0; n < lmcf->nfd; n++) {
if (n == ngx_worker) {
fd = lmcf->read_fd[n];
continue;
}
...
I have been testing the Live module for re-transmitting MPEG-TS for a project. I followed your short example and it works but only on the first connection. Each re-connect requires that I restart the Nginx service.
I am wondering if I have something misconfigured or missing a step.
Any pointers on where to start troubleshooting would be helpful.
Thank you in advance!
Welcher Server ist für Windows 10 zu empfehlen?
gerne open source
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.