Skip to content

Commit 3f3a162

Browse files
committed
[misc] update README files and fix some bugs when run on Windows.
1 parent e151539 commit 3f3a162

8 files changed

+28
-25
lines changed

README.CN.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@
130130

131131
# nginx.conf实例
132132

133-
worker_processes 4;
134-
worker_cpu_affinity 0001 0010 0100 1000;
133+
worker_processes 4; #运行在Windows上时,设置为1,因为Windows不支持Unix domain socket
134+
worker_cpu_affinity 0001 0010 0100 1000; #运行在Windows上时,省略此配置项
135135

136136
error_log logs/error.log error;
137137

@@ -181,9 +181,9 @@
181181
}
182182
}
183183

184-
rtmp_auto_push on;
184+
rtmp_auto_push on; #Windows不支持
185185
rtmp_auto_push_reconnect 1s;
186-
rtmp_socket_dir /tmp;
186+
rtmp_socket_dir /tmp; #Windows不支持
187187

188188
rtmp {
189189
out_queue 4096;

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ Since some players don't support HTTP chunked transmission, it's better **NOT**
130130

131131
# Example nginx.conf
132132

133-
worker_processes 4;
134-
worker_cpu_affinity 0001 0010 0100 1000;
133+
worker_processes 4; #should be 1 for Windows, for it doesn't support Unix domain socket
134+
worker_cpu_affinity 0001 0010 0100 1000; #should be eliminated for Windows
135135

136136
error_log logs/error.log error;
137137

@@ -182,9 +182,9 @@ Since some players don't support HTTP chunked transmission, it's better **NOT**
182182
}
183183
}
184184

185-
rtmp_auto_push on;
185+
rtmp_auto_push on; #not supported by Windows
186186
rtmp_auto_push_reconnect 1s;
187-
rtmp_socket_dir /tmp;
187+
rtmp_socket_dir /tmp; #not supported by Windows
188188

189189
rtmp {
190190
out_queue 4096;

ngx_http_flv_live_module.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Copyright (C) Winshining
44
*/
55

6+
#include <ngx_config.h>
7+
#include <ngx_core.h>
8+
#include <ngx_http.h>
69
#include "ngx_http_flv_live_module.h"
710
#include "ngx_rtmp_relay_module.h"
811

@@ -358,7 +361,7 @@ ngx_http_flv_live_send_tail(ngx_rtmp_session_t *s)
358361
buf_resp_hdr.pos = response_tail.data;
359362
buf_resp_hdr.last = response_tail.data + response_tail.len;
360363
buf_resp_hdr.start = buf_resp_hdr.pos;
361-
buf_resp_hdr.end = buf_resp_hdr.end;
364+
buf_resp_hdr.end = buf_resp_hdr.last;
362365

363366
cl_resp_hdr.buf = &buf_resp_hdr;
364367
cl_resp_hdr.next = NULL;
@@ -1303,8 +1306,14 @@ ngx_http_flv_live_append_shared_bufs(ngx_rtmp_core_srv_conf_t *cscf,
13031306
{
13041307
ngx_chain_t *tag, *chunk_head, *chunk_tail, chunk,
13051308
*iter, *last_in, **tail, prev_tag_size;
1306-
u_char *pos, *p, chunk_item[ngx_strlen("1000003"CRLF) + 1];
1307-
uint32_t data_size, tag_size, size;
1309+
u_char *pos, *p,
1310+
#if !(NGX_WIN32)
1311+
chunk_item[ngx_strlen("0000000000000000" CRLF) + 1];
1312+
#else
1313+
chunk_item[19];
1314+
#endif
1315+
uint32_t data_size, size;
1316+
off_t tag_size;
13081317
ngx_buf_t prev_tag_size_buf, chunk_buf;
13091318

13101319
for (data_size = 0, iter = in, last_in = iter; iter; iter = iter->next) {
@@ -1372,7 +1381,7 @@ ngx_http_flv_live_append_shared_bufs(ngx_rtmp_core_srv_conf_t *cscf,
13721381
/* add chunk header and tail */
13731382
if (chunked) {
13741383
/* 4 is the size of previous tag size itself */
1375-
*ngx_sprintf(chunk_item, "%xO"CRLF, tag_size + 4) = 0;
1384+
*ngx_sprintf(chunk_item, "%xO" CRLF, tag_size + 4) = 0;
13761385

13771386
chunk_buf.start = chunk_item;
13781387
chunk_buf.pos = chunk_buf.start;

ngx_http_flv_live_module.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
#define _NGX_HTTP_FLV_LIVE_H_INCLUDED_
88

99

10-
#include <ngx_config.h>
11-
#include <ngx_core.h>
12-
#include <ngx_http.h>
1310
#include "ngx_rtmp_cmd_module.h"
1411
#include "ngx_rtmp_live_module.h"
1512
#include "ngx_rtmp_codec_module.h"

ngx_rtmp_codec_module.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,12 @@ ngx_rtmp_codec_video_is_combined_nals(ngx_chain_t *in, ngx_rtmp_session_t *s)
242242
}
243243

244244

245-
static inline ngx_int_t
245+
static ngx_inline ngx_int_t
246246
ngx_rtmp_get_codec_header_type(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
247247
ngx_chain_t *in)
248248
{
249249
if (ngx_rtmp_is_codec_header(in)) {
250-
ngx_log_debug(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
250+
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
251251
"codec: a sequence header in chain");
252252

253253
return NGX_RTMP_CODEC_SINGLE_SEQ_HEADER;
@@ -256,7 +256,7 @@ ngx_rtmp_get_codec_header_type(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
256256
if (h->type == NGX_RTMP_MSG_VIDEO &&
257257
ngx_rtmp_codec_video_is_combined_nals(in, s) == NGX_OK)
258258
{
259-
ngx_log_debug(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
259+
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
260260
"codec: an AVC NALU or an AAC raw packet in chain");
261261

262262
return NGX_RTMP_CODEC_COMBO_SEQ_HEADER;

ngx_rtmp_gop_cache_module.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66

77

8+
#include <ngx_config.h>
9+
#include <ngx_core.h>
10+
#include <ngx_http.h>
811
#include "ngx_http_flv_live_module.h"
912
#include "ngx_rtmp_gop_cache_module.h"
1013

ngx_rtmp_gop_cache_module.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@
88
#define _NGX_RTMP_GOP_CACHE_H_INCLUDE_
99

1010

11-
#include <ngx_config.h>
12-
#include <ngx_core.h>
13-
#include "ngx_rtmp_cmd_module.h"
14-
#include "ngx_rtmp_live_module.h"
15-
#include "ngx_rtmp_codec_module.h"
16-
17-
1811
#define NGX_GOP_CACHE_POOL_CREATE_SIZE 4096
1912

2013

ngx_rtmp_live_module.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <ngx_config.h>
99
#include <ngx_core.h>
10+
#include <ngx_http.h>
1011
#include "ngx_rtmp_live_module.h"
1112
#include "ngx_rtmp_cmd_module.h"
1213
#include "ngx_rtmp_codec_module.h"

0 commit comments

Comments
 (0)