[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/hls/ngx_rtmp_hls_module.c
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include <ngx_rtmp.h>
#include <ngx_rtmp_cmd_module.h>
#include <ngx_rtmp_codec_module.h>
@@ -334,12 +336,12 @@
ngx_rtmp_hls_write_playlist(ngx_rtmp_session_t *s)
{
static u_char buffer[1024];
- int fd;
+ ngx_fd_t fd;
u_char *p;
ngx_rtmp_hls_ctx_t *ctx;
ssize_t n;
ngx_rtmp_hls_app_conf_t *hacf;
- ngx_int_t nretry;
+ ngx_int_t nretry, rc;
ngx_rtmp_hls_frag_t *f;
ngx_uint_t i, max_frag;
static ngx_str_t empty = ngx_null_string;
@@ -365,7 +367,8 @@
}
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
- "hls: open failed: '%V'", &ctx->playlist_bak);
+ "hls: " ngx_open_file_n " failed: '%V'",
+ &ctx->playlist_bak);
return NGX_ERROR;
}
@@ -375,7 +378,7 @@
for (i = 0; i < ctx->nfrags; i++) {
f = ngx_rtmp_hls_get_frag(s, i);
if (f->duration > max_frag) {
- max_frag = f->duration + .5;
+ max_frag = (ngx_uint_t) (f->duration + .5);
}
}
@@ -386,10 +389,11 @@
"#EXT-X-TARGETDURATION:%ui\n",
ctx->frag, max_frag);
- n = write(fd, buffer, p - buffer);
+ n = ngx_write_fd(fd, buffer, p - buffer);
if (n < 0) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
- "hls: write failed: '%V'", &ctx->playlist_bak);
+ "hls: " ngx_write_fd_n " failed: '%V'",
+ &ctx->playlist_bak);
ngx_close_file(fd);
return NGX_ERROR;
}
@@ -411,10 +415,11 @@
"discont=%i",
ctx->frag, i + 1, ctx->nfrags, f->duration, f->discont);
- n = write(fd, buffer, p - buffer);
+ n = ngx_write_fd(fd, buffer, p - buffer);
if (n < 0) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
- "hls: write failed '%V'", &ctx->playlist_bak);
+ "hls: " ngx_write_fd_n " failed '%V'",
+ &ctx->playlist_bak);
ngx_close_file(fd);
return NGX_ERROR;
}
@@ -422,7 +427,15 @@
ngx_close_file(fd);
- if (ngx_rename_file(ctx->playlist_bak.data, ctx->playlist.data)) {
+#if (NGX_WIN32)
+ rc = MoveFileEx((LPCTSTR) ctx->playlist_bak.data,
+ (LPCTSTR) ctx->playlist.data,
+ MOVEFILE_REPLACE_EXISTING);
+#else
+ rc = ngx_rename_file(ctx->playlist_bak.data, ctx->playlist.data);
+#endif
+
+ if (rc != NGX_OK) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
"hls: rename failed: '%V'->'%V'",
&ctx->playlist_bak, &ctx->playlist);
@@ -627,7 +640,7 @@
return ts;
case NGX_RTMP_HLS_NAMING_SYSTEM:
- return ngx_current_msec;
+ return (uint64_t) ngx_cached_time->sec * 1000 + ngx_cached_time->msec;
default: /* NGX_RTMP_HLS_NAMING_SEQUENTIAL */
return ctx->frag + ctx->nfrags;
@@ -807,7 +820,8 @@
if (ngx_memcmp(p, NGX_RTMP_MSEQ, NGX_RTMP_MSEQ_LEN) == 0) {
- ctx->frag = strtod((const char *) &p[NGX_RTMP_MSEQ_LEN], NULL);
+ ctx->frag = (uint64_t) strtod((const char *)
+ &p[NGX_RTMP_MSEQ_LEN], NULL);
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"hls: restore sequence frag=%uL", ctx->frag);
@@ -1323,10 +1337,11 @@
p[0] = 0xff;
p[1] = 0xf1;
- p[2] = ((objtype - 1) << 6) | (srindex << 2) | ((chconf & 0x04) >> 2);
- p[3] = ((chconf & 0x03) << 6) | ((size >> 11) & 0x03);
- p[4] = (size >> 3);
- p[5] = (size << 5) | 0x1f;
+ p[2] = (u_char) (((objtype - 1) << 6) | (srindex << 2) |
+ ((chconf & 0x04) >> 2));
+ p[3] = (u_char) (((chconf & 0x03) << 6) | ((size >> 11) & 0x03));
+ p[4] = (u_char) (size >> 3);
+ p[5] = (u_char) ((size << 5) | 0x1f);
p[6] = 0xfc;
if (p != b->start) {
@@ -1523,6 +1538,7 @@
switch (nal_type) {
case 1:
case 5:
+ case 6:
if (ngx_rtmp_hls_append_aud(s, &out) != NGX_OK) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
"hls: error appending AUD NAL");
@@ -1810,17 +1826,17 @@
}
conf->hls = NGX_CONF_UNSET;
- conf->fraglen = NGX_CONF_UNSET;
- conf->max_fraglen = NGX_CONF_UNSET;
- conf->muxdelay = NGX_CONF_UNSET;
- conf->sync = NGX_CONF_UNSET;
- conf->playlen = NGX_CONF_UNSET;
+ conf->fraglen = NGX_CONF_UNSET_MSEC;
+ conf->max_fraglen = NGX_CONF_UNSET_MSEC;
+ conf->muxdelay = NGX_CONF_UNSET_MSEC;
+ conf->sync = NGX_CONF_UNSET_MSEC;
+ conf->playlen = NGX_CONF_UNSET_MSEC;
conf->continuous = NGX_CONF_UNSET;
conf->nested = NGX_CONF_UNSET;
conf->naming = NGX_CONF_UNSET_UINT;
conf->slicing = NGX_CONF_UNSET_UINT;
- conf->max_audio_delay = NGX_CONF_UNSET;
- conf->audio_buffer_size = NGX_CONF_UNSET;
+ conf->max_audio_delay = NGX_CONF_UNSET_MSEC;
+ conf->audio_buffer_size = NGX_CONF_UNSET_SIZE;
conf->cleanup = NGX_CONF_UNSET;
return conf;
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/hls/ngx_rtmp_mpegts.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp_mpegts.h"
@@ -87,11 +89,11 @@
static u_char *
ngx_rtmp_mpegts_write_pcr(u_char *p, uint64_t pcr)
{
- *p++ = pcr >> 25;
- *p++ = pcr >> 17;
- *p++ = pcr >> 9;
- *p++ = pcr >> 1;
- *p++ = pcr << 7 | 0x7e;
+ *p++ = (u_char) (pcr >> 25);
+ *p++ = (u_char) (pcr >> 17);
+ *p++ = (u_char) (pcr >> 9);
+ *p++ = (u_char) (pcr >> 1);
+ *p++ = (u_char) (pcr << 7 | 0x7e);
*p++ = 0;
return p;
@@ -104,15 +106,15 @@
ngx_uint_t val;
val = fb << 4 | (((pts >> 30) & 0x07) << 1) | 1;
- *p++ = val;
-
+ *p++ = (u_char) val;
+
val = (((pts >> 15) & 0x7fff) << 1) | 1;
- *p++ = val >> 8;
- *p++ = val;
+ *p++ = (u_char) (val >> 8);
+ *p++ = (u_char) val;
val = (((pts) & 0x7fff) << 1) | 1;
- *p++ = val >> 8;
- *p++ = val;
+ *p++ = (u_char) (val >> 8);
+ *p++ = (u_char) val;
return p;
}
@@ -140,13 +142,13 @@
f->cc++;
*p++ = 0x47;
- *p++ = (f->pid >> 8);
+ *p++ = (u_char) (f->pid >> 8);
if (first) {
p[-1] |= 0x40;
}
- *p++ = f->pid;
+ *p++ = (u_char) f->pid;
*p++ = 0x10 | (f->cc & 0x0f); /* payload */
if (first) {
@@ -165,7 +167,7 @@
*p++ = 0x00;
*p++ = 0x00;
*p++ = 0x01;
- *p++ = f->sid;
+ *p++ = (u_char) f->sid;
header_size = 5;
flags = 0x80; /* PTS */
@@ -180,11 +182,11 @@
pes_size = 0;
}
- *p++ = (pes_size >> 8);
- *p++ = pes_size;
+ *p++ = (u_char) (pes_size >> 8);
+ *p++ = (u_char) pes_size;
*p++ = 0x80; /* H222 */
- *p++ = flags;
- *p++ = header_size;
+ *p++ = (u_char) flags;
+ *p++ = (u_char) header_size;
p = ngx_rtmp_mpegts_write_pts(p, flags >> 6, f->pts +
NGX_RTMP_HLS_DELAY);
@@ -214,7 +216,7 @@
base = &packet[5] + packet[4];
p = ngx_movemem(base + stuff_size, base, p - base);
ngx_memset(base, 0xff, stuff_size);
- packet[4] += stuff_size;
+ packet[4] += (u_char) stuff_size;
} else {
@@ -224,7 +226,7 @@
p = ngx_movemem(&packet[4] + stuff_size, &packet[4],
p - &packet[4]);
- packet[4] = stuff_size - 1;
+ packet[4] = (u_char) (stuff_size - 1);
if (stuff_size >= 2) {
packet[5] = 0;
ngx_memset(&packet[6], 0xff, stuff_size - 2);
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/hls/ngx_rtmp_mpegts.h
^
|
@@ -7,6 +7,7 @@
#define _NGX_RTMP_MPEGTS_H_INCLUDED_
+#include <ngx_config.h>
#include <ngx_core.h>
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp.h
^
|
@@ -16,6 +16,12 @@
#include "ngx_rtmp_bandwidth.h"
+#if (NGX_WIN32)
+typedef __int8 int8_t;
+typedef unsigned __int8 uint8_t;
+#endif
+
+
typedef struct {
void **main_conf;
void **srv_conf;
@@ -167,6 +173,14 @@
} ngx_rtmp_stream_t;
+/* disable zero-sized array warning by msvc */
+
+#if (NGX_WIN32)
+#pragma warning(push)
+#pragma warning(disable:4200)
+#endif
+
+
typedef struct {
uint32_t signature; /* "RTMP" */ /* <-- FIXME wtf */
@@ -245,6 +259,11 @@
} ngx_rtmp_session_t;
+#if (NGX_WIN32)
+#pragma warning(pop)
+#endif
+
+
/* handler result code:
* NGX_ERROR - error
* NGX_OK - success, may continue
@@ -391,24 +410,25 @@
(((u_char*)ngx_rtmp_rmemcpy(dst, src, n)) + (n))
-static inline uint16_t
+static ngx_inline uint16_t
ngx_rtmp_r16(uint16_t n)
{
return (n << 8) | (n >> 8);
}
-static inline uint32_t
+static ngx_inline uint32_t
ngx_rtmp_r32(uint32_t n)
{
return (n << 24) | ((n << 8) & 0xff0000) | ((n >> 8) & 0xff00) | (n >> 24);
}
-static inline uint64_t
+static ngx_inline uint64_t
ngx_rtmp_r64(uint64_t n)
{
- return (uint64_t) ngx_rtmp_r32(n) << 32 | ngx_rtmp_r32(n >> 32);
+ return (uint64_t) ngx_rtmp_r32((uint32_t) n) << 32 |
+ ngx_rtmp_r32((uint32_t) (n >> 32));
}
@@ -557,14 +577,14 @@
#define NGX_RTMP_VIDEO_DISPOSABLE_FRAME 3
-static inline ngx_int_t
+static ngx_inline ngx_int_t
ngx_rtmp_get_video_frame_type(ngx_chain_t *in)
{
return (in->buf->pos[0] & 0xf0) >> 4;
}
-static inline ngx_int_t
+static ngx_inline ngx_int_t
ngx_rtmp_is_codec_header(ngx_chain_t *in)
{
return in->buf->pos + 1 < in->buf->last && in->buf->pos[1] == 0;
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_amf.c
^
|
@@ -2,11 +2,15 @@
* Copyright (c) 2012 Roman Arutyunyan
*/
+
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp_amf.h"
#include "ngx_rtmp.h"
#include <string.h>
-static inline void*
+
+static ngx_inline void*
ngx_rtmp_amf_reverse_copy(void *dst, void* src, size_t len)
{
size_t k;
@@ -181,10 +185,16 @@
maxlen = namelen;
}
- for(;;) {
+ for( ;; ) {
+#if !(NGX_WIN32)
char name[maxlen];
-
+#else
+ char name[1024];
+ if (maxlen > sizeof(name)) {
+ return NGX_ERROR;
+ }
+#endif
/* read key */
if (ngx_rtmp_amf_get(ctx, buf, 2) != NGX_OK)
return NGX_ERROR;
@@ -318,7 +328,8 @@
}
type = type8;
data = (elts &&
- ngx_rtmp_amf_is_compatible_type(elts->type & 0xff, type))
+ ngx_rtmp_amf_is_compatible_type(
+ (uint8_t) (elts->type & 0xff), (uint8_t) type))
? elts->data
: NULL;
@@ -453,7 +464,7 @@
for(n = 0; n < nelts; ++n) {
- len = elts[n].name.len;
+ len = (uint16_t) elts[n].name.len;
if (ngx_rtmp_amf_put(ctx,
ngx_rtmp_amf_reverse_copy(buf,
@@ -521,7 +532,7 @@
type = elts[n].type;
data = elts[n].data;
- len = elts[n].len;
+ len = (uint16_t) elts[n].len;
if (type & NGX_RTMP_AMF_TYPELESS) {
type &= ~NGX_RTMP_AMF_TYPELESS;
@@ -549,7 +560,7 @@
case NGX_RTMP_AMF_STRING:
if (len == 0 && data) {
- len = ngx_strlen((u_char*)data);
+ len = (uint16_t) ngx_strlen((u_char*) data);
}
if (ngx_rtmp_amf_put(ctx,
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_auto_push_module.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp_cmd_module.h"
#include "ngx_rtmp_relay_module.h"
@@ -15,10 +17,12 @@
static void ngx_rtmp_auto_push_exit_process(ngx_cycle_t *cycle);
static void * ngx_rtmp_auto_push_create_conf(ngx_cycle_t *cf);
static char * ngx_rtmp_auto_push_init_conf(ngx_cycle_t *cycle, void *conf);
+#if (NGX_HAVE_UNIX_DOMAIN)
static ngx_int_t ngx_rtmp_auto_push_publish(ngx_rtmp_session_t *s,
- ngx_rtmp_publish_t *v);
+ ngx_rtmp_publish_t *v);
static ngx_int_t ngx_rtmp_auto_push_delete_stream(ngx_rtmp_session_t *s,
- ngx_rtmp_delete_stream_t *v);
+ ngx_rtmp_delete_stream_t *v);
+#endif
typedef struct ngx_rtmp_auto_push_ctx_s ngx_rtmp_auto_push_ctx_t;
@@ -269,7 +273,7 @@
}
apcf->auto_push = NGX_CONF_UNSET;
- apcf->push_reconnect = NGX_CONF_UNSET;
+ apcf->push_reconnect = NGX_CONF_UNSET_MSEC;
return apcf;
}
@@ -291,6 +295,7 @@
}
+#if (NGX_HAVE_UNIX_DOMAIN)
static void
ngx_rtmp_auto_push_reconnect(ngx_event_t *ev)
{
@@ -303,7 +308,7 @@
ngx_rtmp_relay_target_t at;
u_char path[sizeof("unix:") + NGX_MAX_PATH];
u_char flash_ver[sizeof("APSH ,") +
- NGX_OFF_T_LEN * 2];
+ NGX_INT_T_LEN * 2];
u_char play_path[NGX_RTMP_MAX_NAME];
ngx_str_t name;
u_char *p;
@@ -541,3 +546,4 @@
next:
return next_delete_stream(s, v);
}
+#endif /* NGX_HAVE_UNIX_DOMAIN */
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_bandwidth.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp_bandwidth.h"
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_bandwidth.h
^
|
@@ -7,6 +7,7 @@
#define _NGX_RTMP_BANDWIDTH_H_INCLUDED_
+#include <ngx_config.h>
#include <ngx_core.h>
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_cmd_module.c
^
|
@@ -2,6 +2,9 @@
* Copyright (c) 2012 Roman Arutyunyan
*/
+
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp_cmd_module.h"
#include "ngx_rtmp_streams.h"
@@ -285,8 +288,8 @@
s->app.len = (p - s->app.data);
}
- s->acodecs = v->acodecs;
- s->vcodecs = v->vcodecs;
+ s->acodecs = (uint32_t) v->acodecs;
+ s->vcodecs = (uint32_t) v->vcodecs;
/* find application & set app_conf */
cacfp = cscf->applications.elts;
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_codec_module.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp_codec_module.h"
#include "ngx_rtmp_live_module.h"
#include "ngx_rtmp_cmd_module.h"
@@ -530,16 +532,16 @@
return NGX_OK;
}
- ctx->width = v.width;
- ctx->height = v.height;
- ctx->duration = v.duration;
- ctx->frame_rate = v.frame_rate;
- ctx->video_data_rate = v.video_data_rate;
- ctx->video_codec_id = v.video_codec_id_n;
- ctx->audio_data_rate = v.audio_data_rate;
+ ctx->width = (ngx_uint_t) v.width;
+ ctx->height = (ngx_uint_t) v.height;
+ ctx->duration = (ngx_uint_t) v.duration;
+ ctx->frame_rate = (ngx_uint_t) v.frame_rate;
+ ctx->video_data_rate = (ngx_uint_t) v.video_data_rate;
+ ctx->video_codec_id = (ngx_uint_t) v.video_codec_id_n;
+ ctx->audio_data_rate = (ngx_uint_t) v.audio_data_rate;
ctx->audio_codec_id = (v.audio_codec_id_n == -1
? 0 : v.audio_codec_id_n == 0
- ? NGX_RTMP_AUDIO_UNCOMPRESSED : v.audio_codec_id_n);
+ ? NGX_RTMP_AUDIO_UNCOMPRESSED : (ngx_uint_t) v.audio_codec_id_n);
ngx_memcpy(ctx->profile, v.profile, sizeof(v.profile));
ngx_memcpy(ctx->level, v.level, sizeof(v.level));
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_codec_module.h
^
|
@@ -7,6 +7,8 @@
#define _NGX_RTMP_CODEC_H_INCLUDED_
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp.h"
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_control_module.c
^
|
@@ -3,9 +3,9 @@
*/
-#include <nginx.h>
+#include <ngx_config.h>
+#include <ngx_core.h>
#include <ngx_http.h>
-
#include "ngx_rtmp.h"
#include "ngx_rtmp_live_module.h"
#include "ngx_rtmp_record_module.h"
@@ -392,7 +392,7 @@
/* output ndropped */
- len = NGX_OFF_T_LEN;
+ len = NGX_INT_T_LEN;
p = ngx_palloc(r->connection->pool, len);
if (p == NULL) {
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_core_module.c
^
|
@@ -233,10 +233,10 @@
conf->so_keepalive = NGX_CONF_UNSET;
conf->max_streams = NGX_CONF_UNSET;
conf->chunk_size = NGX_CONF_UNSET;
- conf->ack_window = NGX_CONF_UNSET;
- conf->max_message = NGX_CONF_UNSET;
- conf->out_queue = NGX_CONF_UNSET;
- conf->out_cork = NGX_CONF_UNSET;
+ conf->ack_window = NGX_CONF_UNSET_UINT;
+ conf->max_message = NGX_CONF_UNSET_SIZE;
+ conf->out_queue = NGX_CONF_UNSET_SIZE;
+ conf->out_cork = NGX_CONF_UNSET_SIZE;
conf->play_time_fix = NGX_CONF_UNSET;
conf->publish_time_fix = NGX_CONF_UNSET;
conf->busy = NGX_CONF_UNSET;
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_enotify_module.c
^
|
@@ -6,7 +6,6 @@
#include <ngx_config.h>
#include <ngx_core.h>
#include "ngx_rtmp.h"
-
#include "ngx_rtmp_eval.h"
#include "ngx_rtmp_cmd_module.h"
#include "ngx_rtmp_record_module.h"
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_eval.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp_eval.h"
@@ -103,7 +105,7 @@
ngx_rtmp_eval(ngx_rtmp_session_t *s, ngx_str_t *in, ngx_rtmp_eval_t **e,
ngx_str_t *out)
{
- u_char c, *p;;
+ u_char c, *p;
ngx_str_t name;
ngx_buf_t b;
ngx_uint_t n;
@@ -122,6 +124,7 @@
}
b.end = b.pos + NGX_RTMP_EVAL_BUFLEN;
+ name.data = NULL;
for (n = 0; n < in->len; ++n) {
p = &in->data[n];
@@ -191,6 +194,7 @@
ngx_int_t
ngx_rtmp_eval_streams(ngx_str_t *in)
{
+#if !(NGX_WIN32)
ngx_int_t mode, create, v, close_src;
ngx_fd_t dst, src;
u_char *path;
@@ -271,6 +275,9 @@
if (close_src) {
ngx_close_file(src);
}
-
return NGX_OK;
+
+#else
+ return NGX_DONE;
+#endif
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_eval.h
^
|
@@ -6,6 +6,9 @@
#ifndef _NGX_RTMP_EVAL_H_INCLUDED_
#define _NGX_RTMP_EVAL_H_INCLUDED_
+
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp.h"
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_exec_module.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp_cmd_module.h"
#include "ngx_rtmp_eval.h"
#include <stdlib.h>
@@ -12,8 +14,10 @@
#endif
+#if !(NGX_WIN32)
static ngx_rtmp_publish_pt next_publish;
static ngx_rtmp_close_stream_pt next_close_stream;
+#endif
static ngx_int_t ngx_rtmp_exec_init_process(ngx_cycle_t *cycle);
@@ -27,7 +31,8 @@
void *conf);
static char * ngx_rtmp_exec_exec_static(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
-static void ngx_rtmp_exec_respawn(ngx_event_t *ev);
+static char *ngx_rtmp_exec_kill_signal(ngx_conf_t *cf, ngx_command_t *cmd,
+ void *conf);
#define NGX_RTMP_EXEC_RESPAWN 0x01
@@ -72,14 +77,16 @@
typedef struct {
u_char name[NGX_RTMP_MAX_NAME];
+ u_char args[NGX_RTMP_MAX_ARGS];
ngx_array_t execs;
} ngx_rtmp_exec_ctx_t;
-static char *ngx_rtmp_exec_kill_signal(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf);
+#if !(NGX_WIN32)
+static void ngx_rtmp_exec_respawn(ngx_event_t *ev);
static ngx_int_t ngx_rtmp_exec_kill(ngx_rtmp_exec_t *e, ngx_int_t kill_signal);
static ngx_int_t ngx_rtmp_exec_run(ngx_rtmp_exec_t *e);
+#endif
static ngx_command_t ngx_rtmp_exec_commands[] = {
@@ -174,6 +181,10 @@
ngx_rtmp_exec_eval_astr,
offsetof(ngx_rtmp_exec_ctx_t, name) },
+ { ngx_string("args"),
+ ngx_rtmp_exec_eval_astr,
+ offsetof(ngx_rtmp_exec_ctx_t, args) },
+
ngx_rtmp_null_eval
};
@@ -220,9 +231,11 @@
emcf->respawn_timeout = 5000;
}
+#if !(NGX_WIN32)
if (emcf->kill_signal == NGX_CONF_UNSET) {
emcf->kill_signal = SIGKILL;
}
+#endif
if (ngx_array_init(&emcf->execs, cf->pool, emcf->confs.nelts,
sizeof(ngx_rtmp_exec_t)) != NGX_OK)
@@ -299,6 +312,7 @@
static ngx_int_t
ngx_rtmp_exec_init_process(ngx_cycle_t *cycle)
{
+#if !(NGX_WIN32)
ngx_rtmp_core_main_conf_t *cmcf = ngx_rtmp_core_main_conf;
ngx_rtmp_core_srv_conf_t **cscf;
ngx_rtmp_conf_ctx_t *cctx;
@@ -337,11 +351,13 @@
e->respawn_evt.handler = ngx_rtmp_exec_respawn;
ngx_post_event((&e->respawn_evt), &ngx_rtmp_init_queue);
}
+#endif
return NGX_OK;
}
+#if !(NGX_WIN32)
static void
ngx_rtmp_exec_respawn(ngx_event_t *ev)
{
@@ -428,7 +444,6 @@
static ngx_int_t
ngx_rtmp_exec_run(ngx_rtmp_exec_t *e)
{
-#if !(NGX_WIN32)
ngx_pid_t pid;
int fd, maxfd;
int pipefd[2];
@@ -563,7 +578,6 @@
&ec->cmd, (ngx_int_t) pid);
break;
}
-#endif /* NGX_WIN32 */
return NGX_OK;
}
@@ -653,6 +667,7 @@
}
ngx_memcpy(ctx->name, v->name, NGX_RTMP_MAX_NAME);
+ ngx_memcpy(ctx->args, v->args, NGX_RTMP_MAX_ARGS);
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"exec: run %uz command(s)", ctx->execs.nelts);
@@ -665,6 +680,7 @@
next:
return next_publish(s, v);
}
+#endif /* NGX_WIN32 */
static char *
@@ -769,6 +785,7 @@
/* POSIX.1-1990 signals */
+#if !(NGX_WIN32)
NGX_RMTP_EXEC_SIGNAL(HUP);
NGX_RMTP_EXEC_SIGNAL(INT);
NGX_RMTP_EXEC_SIGNAL(QUIT);
@@ -788,6 +805,7 @@
NGX_RMTP_EXEC_SIGNAL(TSTP);
NGX_RMTP_EXEC_SIGNAL(TTIN);
NGX_RMTP_EXEC_SIGNAL(TTOU);
+#endif
#undef NGX_RMTP_EXEC_SIGNAL
@@ -798,11 +816,15 @@
static ngx_int_t
ngx_rtmp_exec_postconfiguration(ngx_conf_t *cf)
{
+#if !(NGX_WIN32)
+
next_publish = ngx_rtmp_publish;
ngx_rtmp_publish = ngx_rtmp_exec_publish;
next_close_stream = ngx_rtmp_close_stream;
ngx_rtmp_close_stream = ngx_rtmp_exec_close_stream;
+#endif /* NGX_WIN32 */
+
return NGX_OK;
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_flv_module.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp_play_module.h"
#include "ngx_rtmp_codec_module.h"
#include "ngx_rtmp_streams.h"
@@ -289,7 +291,7 @@
goto rewind;
}
- ret = ngx_rtmp_flv_index_value(ngx_rtmp_flv_buffer);
+ ret = (ngx_uint_t) ngx_rtmp_flv_index_value(ngx_rtmp_flv_buffer);
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"flv: lookup index timestamp=%i offset=%ui",
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_handler.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp.h"
#include "ngx_rtmp_amf.h"
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_handshake.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp.h"
#include <openssl/hmac.h>
@@ -182,7 +184,7 @@
ngx_rtmp_fill_random_buffer(ngx_buf_t *b)
{
for (; b->last != b->end; ++b->last) {
- *b->last = rand();
+ *b->last = (u_char) rand();
}
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_init.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp.h"
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_limit_module.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp.h"
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_live_module.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp_live_module.h"
#include "ngx_rtmp_cmd_module.h"
#include "ngx_rtmp_codec_module.h"
@@ -150,9 +152,9 @@
lacf->live = NGX_CONF_UNSET;
lacf->meta = NGX_CONF_UNSET;
lacf->nbuckets = NGX_CONF_UNSET;
- lacf->buflen = NGX_CONF_UNSET;
- lacf->sync = NGX_CONF_UNSET;
- lacf->idle_timeout = NGX_CONF_UNSET;
+ lacf->buflen = NGX_CONF_UNSET_MSEC;
+ lacf->sync = NGX_CONF_UNSET_MSEC;
+ lacf->idle_timeout = NGX_CONF_UNSET_MSEC;
lacf->interleave = NGX_CONF_UNSET;
lacf->wait_key = NGX_CONF_UNSET;
lacf->wait_video = NGX_CONF_UNSET;
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_live_module.h
^
|
@@ -7,6 +7,8 @@
#define _NGX_RTMP_LIVE_H_INCLUDED_
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp.h"
#include "ngx_rtmp_cmd_module.h"
#include "ngx_rtmp_bandwidth.h"
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_log_module.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp_cmd_module.h"
@@ -156,16 +158,16 @@
static size_t
-ngx_rtmp_log_var_number_getlen(ngx_rtmp_session_t *s, ngx_rtmp_log_op_t *op)
+ngx_rtmp_log_var_connection_getlen(ngx_rtmp_session_t *s, ngx_rtmp_log_op_t *op)
{
- return NGX_OFF_T_LEN;
+ return NGX_INT_T_LEN;
}
static u_char *
ngx_rtmp_log_var_connection_getdata(ngx_rtmp_session_t *s, u_char *buf,
ngx_rtmp_log_op_t *op)
{
- return ngx_sprintf(buf, "%O", (off_t) s->connection->number);
+ return ngx_sprintf(buf, "%ui", (ngx_uint_t) s->connection->number);
}
@@ -190,7 +192,7 @@
ngx_rtmp_log_var_session_string_getlen(ngx_rtmp_session_t *s,
ngx_rtmp_log_op_t *op)
{
- return ((ngx_str_t *) ((uint8_t *) s + op->offset))->len;
+ return ((ngx_str_t *) ((u_char *) s + op->offset))->len;
}
@@ -200,7 +202,7 @@
{
ngx_str_t *str;
- str = (ngx_str_t *) ((uint8_t *) s + op->offset);
+ str = (ngx_str_t *) ((u_char *) s + op->offset);
return ngx_cpymem(buf, str->data, str->len);
}
@@ -301,7 +303,7 @@
ngx_rtmp_log_op_t *op)
{
return ngx_cpymem(buf, ngx_cached_http_log_time.data,
- ngx_cached_http_log_time.len);
+ ngx_cached_http_log_time.len);
}
@@ -326,7 +328,7 @@
ngx_rtmp_log_var_session_readable_time_getlen(ngx_rtmp_session_t *s,
ngx_rtmp_log_op_t *op)
{
- return NGX_OFF_T_LEN + sizeof("d 23h 59m 59s") - 1;
+ return NGX_INT_T_LEN + sizeof("d 23h 59m 59s") - 1;
}
@@ -364,7 +366,7 @@
static ngx_rtmp_log_var_t ngx_rtmp_log_vars[] = {
{ ngx_string("connection"),
- ngx_rtmp_log_var_number_getlen,
+ ngx_rtmp_log_var_connection_getlen,
ngx_rtmp_log_var_connection_getdata,
0 },
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_mp4_module.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp_play_module.h"
#include "ngx_rtmp_codec_module.h"
#include "ngx_rtmp_streams.h"
@@ -24,6 +26,14 @@
#pragma pack(push,4)
+/* disable zero-sized array warning by msvc */
+
+#if (NGX_WIN32)
+#pragma warning(push)
+#pragma warning(disable:4200)
+#endif
+
+
typedef struct {
uint32_t first_chunk;
uint32_t samples_per_chunk;
@@ -100,6 +110,12 @@
uint64_t entries[0];
} ngx_rtmp_mp4_offsets64_t;
+
+#if (NGX_WIN32)
+#pragma warning(pop)
+#endif
+
+
#pragma pack(pop)
@@ -161,6 +177,7 @@
typedef struct {
void *mmaped;
size_t mmaped_size;
+ ngx_fd_t extra;
unsigned meta_sent:1;
@@ -185,14 +202,14 @@
((uint32_t)d << 24 | (uint32_t)c << 16 | (uint32_t)b << 8 | (uint32_t)a)
-static inline uint32_t
-ngx_rtmp_mp4_to_rtmp_timestamp(ngx_rtmp_mp4_track_t *t, uint32_t ts)
+static ngx_inline uint32_t
+ngx_rtmp_mp4_to_rtmp_timestamp(ngx_rtmp_mp4_track_t *t, uint64_t ts)
{
- return (uint64_t) ts * 1000 / t->time_scale;
+ return (uint32_t) (ts * 1000 / t->time_scale);
}
-static inline uint32_t
+static ngx_inline uint32_t
ngx_rtmp_mp4_from_rtmp_timestamp(ngx_rtmp_mp4_track_t *t, uint32_t ts)
{
return (uint64_t) ts * t->time_scale / 1000;
@@ -206,6 +223,80 @@
static u_char ngx_rtmp_mp4_buffer[1024*1024];
+#if (NGX_WIN32)
+static void *
+ngx_rtmp_mp4_mmap(ngx_fd_t fd, size_t size, off_t offset, ngx_fd_t *extra)
+{
+ void *data;
+
+ *extra = CreateFileMapping(fd, NULL, PAGE_READONLY,
+ (DWORD) ((uint64_t) size >> 32),
+ (DWORD) (size & 0xffffffff),
+ NULL);
+ if (*extra == NULL) {
+ return NULL;
+ }
+
+ data = MapViewOfFile(*extra, FILE_MAP_READ,
+ (DWORD) ((uint64_t) offset >> 32),
+ (DWORD) (offset & 0xffffffff),
+ size);
+
+ if (data == NULL) {
+ CloseHandle(*extra);
+ }
+
+ /*
+ * non-NULL result means map view handle is open
+ * and should be closed later
+ */
+
+ return data;
+}
+
+
+static ngx_int_t
+ngx_rtmp_mp4_munmap(void *data, size_t size, ngx_fd_t *extra)
+{
+ ngx_int_t rc;
+
+ rc = NGX_OK;
+
+ if (UnmapViewOfFile(data) == 0) {
+ rc = NGX_ERROR;
+ }
+
+ if (CloseHandle(*extra) == 0) {
+ rc = NGX_ERROR;
+ }
+
+ return rc;
+}
+
+#else
+
+static void *
+ngx_rtmp_mp4_mmap(ngx_fd_t fd, size_t size, off_t offset, ngx_fd_t *extra)
+{
+ void *data;
+
+ data = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, offset);
+
+ /* valid address is never NULL since there's no MAP_FIXED */
+
+ return data == MAP_FAILED ? NULL : data;
+}
+
+
+static ngx_int_t
+ngx_rtmp_mp4_munmap(void *data, size_t size, ngx_fd_t *extra)
+{
+ return munmap(data, size);
+}
+
+#endif
+
+
static ngx_int_t ngx_rtmp_mp4_parse(ngx_rtmp_session_t *s, u_char *pos,
u_char *last);
static ngx_int_t ngx_rtmp_mp4_parse_trak(ngx_rtmp_session_t *s, u_char *pos,
@@ -537,7 +628,7 @@
return NGX_ERROR;
}
- ctx->track->fhdr = ctx->track->codec;
+ ctx->track->fhdr = (u_char) ctx->track->codec;
return NGX_OK;
}
@@ -1328,7 +1419,7 @@
return NGX_ERROR;
}
- cr->offset = ngx_rtmp_r32(t->offsets->entries[chunk]);
+ cr->offset = (off_t) ngx_rtmp_r32(t->offsets->entries[chunk]);
cr->size = 0;
ngx_log_debug4(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
@@ -1350,7 +1441,7 @@
return NGX_ERROR;
}
- cr->offset = ngx_rtmp_r32(t->offsets64->entries[chunk]);
+ cr->offset = (off_t) ngx_rtmp_r64(t->offsets64->entries[chunk]);
cr->size = 0;
ngx_log_debug4(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
@@ -2041,7 +2132,7 @@
ngx_memzero(&h, sizeof(h));
h.msid = NGX_RTMP_MSID;
- h.type = t->type;
+ h.type = (uint8_t) t->type;
h.csid = t->csid;
lh = h;
@@ -2200,6 +2291,7 @@
ssize_t n;
size_t offset, page_offset, size, shift;
uint64_t extended_size;
+ ngx_file_info_t fi;
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_mp4_module);
@@ -2231,7 +2323,7 @@
return NGX_ERROR;
}
- size = ngx_rtmp_r32(hdr[0]);
+ size = (size_t) ngx_rtmp_r32(hdr[0]);
shift = sizeof(hdr);
if (size == 1) {
@@ -2245,8 +2337,16 @@
return NGX_ERROR;
}
- size = ngx_rtmp_r64(extended_size);
+ size = (size_t) ngx_rtmp_r64(extended_size);
shift += sizeof(extended_size);
+
+ } else if (size == 0) {
+ if (ngx_fd_info(f->fd, &fi) == NGX_FILE_ERROR) {
+ ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
+ "mp4: " ngx_fd_info_n " failed");
+ return NGX_ERROR;
+ }
+ size = ngx_file_size(&fi) - offset;
}
if (hdr[1] == ngx_rtmp_mp4_make_tag('m','o','o','v')) {
@@ -2271,11 +2371,9 @@
page_offset = offset & (ngx_pagesize - 1);
ctx->mmaped_size = page_offset + size;
- ctx->mmaped = mmap(NULL, ctx->mmaped_size, PROT_READ, MAP_SHARED,
- f->fd, offset - page_offset);
-
- if (ctx->mmaped == MAP_FAILED) {
- ctx->mmaped = NULL;
+ ctx->mmaped = ngx_rtmp_mp4_mmap(f->fd, ctx->mmaped_size,
+ offset - page_offset, &ctx->extra);
+ if (ctx->mmaped == NULL) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
"mp4: mmap failed at offset=%ui, size=%uz",
offset, size);
@@ -2298,7 +2396,9 @@
return NGX_OK;
}
- if (munmap(ctx->mmaped, ctx->mmaped_size)) {
+ if (ngx_rtmp_mp4_munmap(ctx->mmaped, ctx->mmaped_size, &ctx->extra)
+ != NGX_OK)
+ {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
"mp4: munmap failed");
return NGX_ERROR;
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_netcall_module.c
^
|
@@ -547,7 +547,7 @@
}
b = ngx_create_temp_buf(pool, sizeof(rq_tmpl) + host->len +
- content_type->len + NGX_OFF_T_LEN);
+ content_type->len + NGX_SIZE_T_LEN);
if (b == NULL) {
return NULL;
}
@@ -685,12 +685,9 @@
return NULL;
}
- b = ngx_create_temp_buf(pool,
- sizeof("set ") - 1 + key->len +
- (sizeof(" ") - 1 + NGX_OFF_T_LEN) * 3 +
- (sizeof("\r\n") - 1) * 2
- + value->len
- );
+ b = ngx_create_temp_buf(pool, sizeof("set ") - 1 + key->len +
+ (1 + NGX_INT_T_LEN) * 3 +
+ (sizeof("\r\n") - 1) * 2 + value->len);
if (b == NULL) {
return NULL;
@@ -699,9 +696,8 @@
cl->next = NULL;
cl->buf = b;
- b->last = ngx_sprintf(b->pos,
- "set %V %ui %ui %ui\r\n%V\r\n",
- key, flags, sec, (ngx_uint_t)value->len, value);
+ b->last = ngx_sprintf(b->pos, "set %V %ui %ui %ui\r\n%V\r\n",
+ key, flags, sec, (ngx_uint_t) value->len, value);
return cl;
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_notify_module.c
^
|
@@ -6,7 +6,6 @@
#include <ngx_config.h>
#include <ngx_core.h>
#include "ngx_rtmp.h"
-
#include "ngx_rtmp_cmd_module.h"
#include "ngx_rtmp_netcall_module.h"
#include "ngx_rtmp_record_module.h"
@@ -237,8 +236,8 @@
nacf->url[n] = NGX_CONF_UNSET_PTR;
}
- nacf->method = NGX_CONF_UNSET;
- nacf->update_timeout = NGX_CONF_UNSET;
+ nacf->method = NGX_CONF_UNSET_UINT;
+ nacf->update_timeout = NGX_CONF_UNSET_MSEC;
nacf->update_strict = NGX_CONF_UNSET;
nacf->relay_redirect = NGX_CONF_UNSET;
@@ -290,7 +289,7 @@
nscf->url[n] = NGX_CONF_UNSET_PTR;
}
- nscf->method = NGX_CONF_UNSET;
+ nscf->method = NGX_CONF_UNSET_UINT;
return nscf;
}
@@ -584,7 +583,7 @@
sizeof("&call=play") +
sizeof("&name=") + name_len * 3 +
sizeof("&start=&duration=&reset=") +
- NGX_OFF_T_LEN * 3 + 1 + args_len);
+ NGX_INT32_LEN * 3 + 1 + args_len);
if (b == NULL) {
return NULL;
}
@@ -829,11 +828,10 @@
/*
* not enough data;
- * it can happen in case of empty or broken reply;
- * let the caller decide if that's an error or not
+ * it can happen in case of empty or broken reply
*/
- return NGX_DONE;
+ return NGX_ERROR;
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_play_module.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp_play_module.h"
#include "ngx_rtmp_cmd_module.h"
#include "ngx_rtmp_netcall_module.h"
@@ -576,7 +578,7 @@
}
if (!ctx->opened) {
- ctx->post_seek = v->offset;
+ ctx->post_seek = (ngx_uint_t) v->offset;
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"play: post seek=%ui", ctx->post_seek);
goto next;
@@ -586,7 +588,7 @@
return NGX_ERROR;
}
- ngx_rtmp_play_do_seek(s, v->offset);
+ ngx_rtmp_play_do_seek(s, (ngx_uint_t) v->offset);
if (ngx_rtmp_send_status(s, "NetStream.Seek.Notify", "status", "Seeking")
!= NGX_OK)
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_play_module.h
^
|
@@ -7,6 +7,8 @@
#define _NGX_RTMP_PLAY_H_INCLUDED_
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp.h"
#include "ngx_rtmp_cmd_module.h"
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_receive.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp.h"
#include "ngx_rtmp_amf.h"
#include "ngx_rtmp_cmd_module.h"
@@ -189,7 +191,6 @@
return ngx_rtmp_recorded(s, &v);
}
- break;
case NGX_RTMP_USER_PING_REQUEST:
return ngx_rtmp_send_ping_response(s, val);
@@ -208,8 +209,6 @@
return NGX_OK;
}
-
- return NGX_OK;
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_record_module.c
^
|
@@ -188,14 +188,14 @@
return NULL;
}
- racf->max_size = NGX_CONF_UNSET;
- racf->max_frames = NGX_CONF_UNSET;
- racf->interval = NGX_CONF_UNSET;
- racf->unique = NGX_CONF_UNSET;
- racf->append = NGX_CONF_UNSET;
- racf->lock_file = NGX_CONF_UNSET;
- racf->notify = NGX_CONF_UNSET;
- racf->url = NGX_CONF_UNSET_PTR;
+ racf->max_size = NGX_CONF_UNSET_SIZE;
+ racf->max_frames = NGX_CONF_UNSET_SIZE;
+ racf->interval = NGX_CONF_UNSET_MSEC;
+ racf->unique = NGX_CONF_UNSET;
+ racf->append = NGX_CONF_UNSET;
+ racf->lock_file = NGX_CONF_UNSET;
+ racf->notify = NGX_CONF_UNSET;
+ racf->url = NGX_CONF_UNSET_PTR;
if (ngx_array_init(&racf->rec, cf->pool, 1, sizeof(void *)) != NGX_OK) {
return NULL;
@@ -371,7 +371,7 @@
ngx_rtmp_record_ctx_t *ctx;
ngx_rtmp_record_app_conf_t *rracf;
u_char *p, *l;
- ngx_tm_t tm;
+ struct tm tm;
static u_char buf[NGX_TIME_T_LEN + 1];
static u_char pbuf[NGX_MAX_PATH + 1];
@@ -443,6 +443,7 @@
uint32_t tag_size, mlen, timestamp;
rracf = rctx->conf;
+ tag_size = 0;
if (rctx->file.fd != NGX_INVALID_FILE) {
return NGX_AGAIN;
@@ -482,6 +483,7 @@
return NGX_OK;
}
+#if !(NGX_WIN32)
if (rracf->lock_file) {
err = ngx_lock_fd(rctx->file.fd);
if (err) {
@@ -489,6 +491,7 @@
"record: %V lock failed", &rracf->id);
}
}
+#endif
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"record: %V opened '%V'", &rracf->id, &path);
@@ -503,7 +506,19 @@
file_size = 0;
timestamp = 0;
+#if (NGX_WIN32)
+ {
+ LONG lo, hi;
+
+ lo = 0;
+ hi = 0;
+ lo = SetFilePointer(rctx->file.fd, lo, &hi, FILE_END);
+ file_size = (lo == INVALID_SET_FILE_POINTER ?
+ (off_t) -1 : (off_t) hi << 32 | (off_t) lo);
+ }
+#else
file_size = lseek(rctx->file.fd, 0, SEEK_END);
+#endif
if (file_size == (off_t) -1) {
ngx_log_error(NGX_LOG_CRIT, s->connection->log, ngx_errno,
"record: %V seek failed", &rracf->id);
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_record_module.h
^
|
@@ -7,6 +7,8 @@
#define _NGX_RTMP_RECORD_H_INCLUDED_
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp.h"
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_relay_module.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp_relay_module.h"
#include "ngx_rtmp_cmd_module.h"
@@ -184,10 +186,10 @@
racf->nbuckets = 1024;
racf->log = &cf->cycle->new_log;
- racf->buflen = NGX_CONF_UNSET;
+ racf->buflen = NGX_CONF_UNSET_MSEC;
racf->session_relay = NGX_CONF_UNSET;
- racf->push_reconnect = NGX_CONF_UNSET;
- racf->pull_reconnect = NGX_CONF_UNSET;
+ racf->push_reconnect = NGX_CONF_UNSET_MSEC;
+ racf->pull_reconnect = NGX_CONF_UNSET_MSEC;
return racf;
}
@@ -1595,6 +1597,7 @@
static ngx_int_t
ngx_rtmp_relay_init_process(ngx_cycle_t *cycle)
{
+#if !(NGX_WIN32)
ngx_rtmp_core_main_conf_t *cmcf = ngx_rtmp_core_main_conf;
ngx_rtmp_core_srv_conf_t **pcscf, *cscf;
ngx_rtmp_core_app_conf_t **pcacf, *cacf;
@@ -1639,7 +1642,7 @@
}
}
}
-
+#endif
return NGX_OK;
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_relay_module.h
^
|
@@ -7,6 +7,8 @@
#define _NGX_RTMP_RELAY_H_INCLUDED_
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp.h"
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_send.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp.h"
#include "ngx_rtmp_amf.h"
#include "ngx_rtmp_streams.h"
@@ -72,11 +74,13 @@
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"chunk_size=%uD", chunk_size);
- NGX_RTMP_USER_START(s, NGX_RTMP_MSG_CHUNK_SIZE);
+ {
+ NGX_RTMP_USER_START(s, NGX_RTMP_MSG_CHUNK_SIZE);
- NGX_RTMP_USER_OUT4(chunk_size);
+ NGX_RTMP_USER_OUT4(chunk_size);
- NGX_RTMP_USER_END(s);
+ NGX_RTMP_USER_END(s);
+ }
}
@@ -94,11 +98,13 @@
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"create: abort csid=%uD", csid);
- NGX_RTMP_USER_START(s, NGX_RTMP_MSG_CHUNK_SIZE);
+ {
+ NGX_RTMP_USER_START(s, NGX_RTMP_MSG_CHUNK_SIZE);
- NGX_RTMP_USER_OUT4(csid);
+ NGX_RTMP_USER_OUT4(csid);
- NGX_RTMP_USER_END(s);
+ NGX_RTMP_USER_END(s);
+ }
}
@@ -116,11 +122,13 @@
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"create: ack seq=%uD", seq);
- NGX_RTMP_USER_START(s, NGX_RTMP_MSG_ACK);
+ {
+ NGX_RTMP_USER_START(s, NGX_RTMP_MSG_ACK);
- NGX_RTMP_USER_OUT4(seq);
+ NGX_RTMP_USER_OUT4(seq);
- NGX_RTMP_USER_END(s);
+ NGX_RTMP_USER_END(s);
+ }
}
@@ -138,11 +146,13 @@
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"create: ack_size=%uD", ack_size);
- NGX_RTMP_USER_START(s, NGX_RTMP_MSG_ACK_SIZE);
+ {
+ NGX_RTMP_USER_START(s, NGX_RTMP_MSG_ACK_SIZE);
- NGX_RTMP_USER_OUT4(ack_size);
+ NGX_RTMP_USER_OUT4(ack_size);
- NGX_RTMP_USER_END(s);
+ NGX_RTMP_USER_END(s);
+ }
}
@@ -162,12 +172,14 @@
"create: bandwidth ack_size=%uD limit=%d",
ack_size, (int)limit_type);
- NGX_RTMP_USER_START(s, NGX_RTMP_MSG_BANDWIDTH);
+ {
+ NGX_RTMP_USER_START(s, NGX_RTMP_MSG_BANDWIDTH);
- NGX_RTMP_USER_OUT4(ack_size);
- NGX_RTMP_USER_OUT1(limit_type);
+ NGX_RTMP_USER_OUT4(ack_size);
+ NGX_RTMP_USER_OUT1(limit_type);
- NGX_RTMP_USER_END(s);
+ NGX_RTMP_USER_END(s);
+ }
}
@@ -188,11 +200,13 @@
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"create: stream_begin msid=%uD", msid);
- NGX_RTMP_UCTL_START(s, NGX_RTMP_MSG_USER, NGX_RTMP_USER_STREAM_BEGIN);
+ {
+ NGX_RTMP_UCTL_START(s, NGX_RTMP_MSG_USER, NGX_RTMP_USER_STREAM_BEGIN);
- NGX_RTMP_USER_OUT4(msid);
+ NGX_RTMP_USER_OUT4(msid);
- NGX_RTMP_USER_END(s);
+ NGX_RTMP_USER_END(s);
+ }
}
@@ -210,11 +224,13 @@
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"create: stream_end msid=%uD", msid);
- NGX_RTMP_UCTL_START(s, NGX_RTMP_MSG_USER, NGX_RTMP_USER_STREAM_EOF);
+ {
+ NGX_RTMP_UCTL_START(s, NGX_RTMP_MSG_USER, NGX_RTMP_USER_STREAM_EOF);
- NGX_RTMP_USER_OUT4(msid);
+ NGX_RTMP_USER_OUT4(msid);
- NGX_RTMP_USER_END(s);
+ NGX_RTMP_USER_END(s);
+ }
}
@@ -232,11 +248,13 @@
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"create: stream_dry msid=%uD", msid);
- NGX_RTMP_UCTL_START(s, NGX_RTMP_MSG_USER, NGX_RTMP_USER_STREAM_DRY);
+ {
+ NGX_RTMP_UCTL_START(s, NGX_RTMP_MSG_USER, NGX_RTMP_USER_STREAM_DRY);
- NGX_RTMP_USER_OUT4(msid);
+ NGX_RTMP_USER_OUT4(msid);
- NGX_RTMP_USER_END(s);
+ NGX_RTMP_USER_END(s);
+ }
}
@@ -256,12 +274,14 @@
"create: set_buflen msid=%uD buflen=%uD",
msid, buflen_msec);
- NGX_RTMP_UCTL_START(s, NGX_RTMP_MSG_USER, NGX_RTMP_USER_SET_BUFLEN);
+ {
+ NGX_RTMP_UCTL_START(s, NGX_RTMP_MSG_USER, NGX_RTMP_USER_SET_BUFLEN);
- NGX_RTMP_USER_OUT4(msid);
- NGX_RTMP_USER_OUT4(buflen_msec);
+ NGX_RTMP_USER_OUT4(msid);
+ NGX_RTMP_USER_OUT4(buflen_msec);
- NGX_RTMP_USER_END(s);
+ NGX_RTMP_USER_END(s);
+ }
}
@@ -280,11 +300,13 @@
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"create: recorded msid=%uD", msid);
- NGX_RTMP_UCTL_START(s, NGX_RTMP_MSG_USER, NGX_RTMP_USER_RECORDED);
+ {
+ NGX_RTMP_UCTL_START(s, NGX_RTMP_MSG_USER, NGX_RTMP_USER_RECORDED);
- NGX_RTMP_USER_OUT4(msid);
+ NGX_RTMP_USER_OUT4(msid);
- NGX_RTMP_USER_END(s);
+ NGX_RTMP_USER_END(s);
+ }
}
@@ -302,11 +324,13 @@
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"create: ping_request timestamp=%uD", timestamp);
- NGX_RTMP_UCTL_START(s, NGX_RTMP_MSG_USER, NGX_RTMP_USER_PING_REQUEST);
+ {
+ NGX_RTMP_UCTL_START(s, NGX_RTMP_MSG_USER, NGX_RTMP_USER_PING_REQUEST);
- NGX_RTMP_USER_OUT4(timestamp);
+ NGX_RTMP_USER_OUT4(timestamp);
- NGX_RTMP_USER_END(s);
+ NGX_RTMP_USER_END(s);
+ }
}
@@ -324,11 +348,13 @@
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"create: ping_response timestamp=%uD", timestamp);
- NGX_RTMP_UCTL_START(s, NGX_RTMP_MSG_USER, NGX_RTMP_USER_PING_RESPONSE);
+ {
+ NGX_RTMP_UCTL_START(s, NGX_RTMP_MSG_USER, NGX_RTMP_USER_PING_RESPONSE);
- NGX_RTMP_USER_OUT4(timestamp);
+ NGX_RTMP_USER_OUT4(timestamp);
- NGX_RTMP_USER_END(s);
+ NGX_RTMP_USER_END(s);
+ }
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_shared.c
^
|
@@ -3,6 +3,8 @@
*/
+#include <ngx_config.h>
+#include <ngx_core.h>
#include "ngx_rtmp.h"
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.1.tar.bz2/ngx_rtmp_stat_module.c
^
|
@@ -3,9 +3,9 @@
*/
-#include <nginx.h>
+#include <ngx_config.h>
+#include <ngx_core.h>
#include <ngx_http.h>
-
#include "ngx_rtmp.h"
#include "ngx_rtmp_live_module.h"
#include "ngx_rtmp_play_module.h"
@@ -155,6 +155,13 @@
return new_data;
}
+#if (NGX_WIN32)
+/*
+ * Fix broken MSVC memcpy optimization for 4-byte data
+ * when this function is inlined
+ */
+__declspec(noinline)
+#endif
static void
ngx_rtmp_stat_output(ngx_http_request_t *r, ngx_chain_t ***lll,
@@ -239,29 +246,29 @@
ngx_rtmp_stat_bw(ngx_http_request_t *r, ngx_chain_t ***lll,
ngx_rtmp_bandwidth_t *bw_in, ngx_rtmp_bandwidth_t *bw_out)
{
- u_char buf[NGX_OFF_T_LEN + 1];
+ u_char buf[NGX_INT64_LEN + 1];
ngx_rtmp_update_bandwidth(bw_in, 0);
ngx_rtmp_update_bandwidth(bw_out, 0);
NGX_RTMP_STAT_L("<in>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
- "%uz", bw_in->bytes) - buf);
+ "%uL", bw_in->bytes) - buf);
NGX_RTMP_STAT_L("</in>\r\n");
NGX_RTMP_STAT_L("<out>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
- "%uz", bw_out->bytes) - buf);
+ "%uL", bw_out->bytes) - buf);
NGX_RTMP_STAT_L("</out>\r\n");
NGX_RTMP_STAT_L("<bwin>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
- "%uz", bw_in->bandwidth * 8) - buf);
+ "%uL", bw_in->bandwidth * 8) - buf);
NGX_RTMP_STAT_L("</bwin>\r\n");
NGX_RTMP_STAT_L("<bwout>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
- "%uz", bw_out->bandwidth * 8) - buf);
+ "%uL", bw_out->bandwidth * 8) - buf);
NGX_RTMP_STAT_L("</bwout>\r\n");
}
@@ -269,7 +276,7 @@
#ifdef NGX_RTMP_POOL_DEBUG
static void
ngx_rtmp_stat_get_pool_size(ngx_pool_t *pool, ngx_uint_t *nlarge,
- size_t *size)
+ ngx_uint_t *size)
{
ngx_pool_large_t *l;
ngx_pool_t *p, *n;
@@ -293,19 +300,16 @@
ngx_rtmp_stat_dump_pool(ngx_http_request_t *r, ngx_chain_t ***lll,
ngx_pool_t *pool)
{
- ngx_uint_t nlarge;
- size_t size;
- u_char buf[NGX_OFF_T_LEN + 1];
+ ngx_uint_t nlarge, size;
+ u_char buf[NGX_INT_T_LEN];
size = 0;
nlarge = 0;
ngx_rtmp_stat_get_pool_size(pool, &nlarge, &size);
NGX_RTMP_STAT_L("<pool><nlarge>");
- NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
- "%ui", nlarge) - buf);
+ NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%ui", nlarge) - buf);
NGX_RTMP_STAT_L("</nlarge><size>");
- NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
- "%uz", size) - buf);
+ NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%ui", size) - buf);
NGX_RTMP_STAT_L("</size></pool>\r\n");
}
#endif
@@ -316,14 +320,14 @@
ngx_rtmp_stat_client(ngx_http_request_t *r, ngx_chain_t ***lll,
ngx_rtmp_session_t *s)
{
- u_char buf[NGX_OFF_T_LEN + 1];
+ u_char buf[NGX_INT_T_LEN];
#ifdef NGX_RTMP_POOL_DEBUG
ngx_rtmp_stat_dump_pool(r, lll, s->connection->pool);
#endif
NGX_RTMP_STAT_L("<id>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%ui",
- (ngx_uint_t) s->connection->number) - buf);
+ (ngx_uint_t) s->connection->number) - buf);
NGX_RTMP_STAT_L("</id>");
NGX_RTMP_STAT_L("<address>");
@@ -331,8 +335,8 @@
NGX_RTMP_STAT_L("</address>");
NGX_RTMP_STAT_L("<time>");
- NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%M",
- ngx_current_msec - s->epoch) - buf);
+ NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%i",
+ (ngx_int_t) (ngx_current_msec - s->epoch)) - buf);
NGX_RTMP_STAT_L("</time>");
if (s->flashver.len) {
@@ -364,8 +368,9 @@
ngx_rtmp_live_ctx_t *ctx;
ngx_rtmp_session_t *s;
ngx_int_t n;
- size_t nclients, total_nclients;
- u_char buf[NGX_OFF_T_LEN + 1];
+ ngx_uint_t nclients, total_nclients;
+ u_char buf[NGX_INT_T_LEN];
+ u_char bbuf[NGX_INT32_LEN * 2 + 1];
ngx_rtmp_stat_loc_conf_t *slcf;
u_char *cname;
@@ -387,8 +392,9 @@
NGX_RTMP_STAT_L("</name>\r\n");
NGX_RTMP_STAT_L("<time>");
- NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
- "%M", ngx_current_msec - stream->epoch) - buf);
+ NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%i",
+ (ngx_int_t) (ngx_current_msec - stream->epoch))
+ - buf);
NGX_RTMP_STAT_L("</time>");
ngx_rtmp_stat_bw(r, lll, &stream->bw_in, &stream->bw_out);
@@ -403,17 +409,16 @@
ngx_rtmp_stat_client(r, lll, s);
NGX_RTMP_STAT_L("<dropped>");
- NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
- "%uD/%uD", ctx->cs[1].dropped,
- ctx->cs[0].dropped) - buf);
+ NGX_RTMP_STAT(bbuf, ngx_snprintf(bbuf, sizeof(bbuf),
+ "%uD/%uD", ctx->cs[1].dropped,
+ ctx->cs[0].dropped) - bbuf);
NGX_RTMP_STAT_L("</dropped>");
NGX_RTMP_STAT_L("<avsync>");
if (!lacf->interleave) {
- NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
- "%L", (int64_t) ctx->cs[1].timestamp -
- (int64_t) ctx->cs[0].timestamp)
- - buf);
+ NGX_RTMP_STAT(bbuf, ngx_snprintf(bbuf, sizeof(bbuf),
+ "%D", ctx->cs[1].timestamp -
+ ctx->cs[0].timestamp) - bbuf);
}
NGX_RTMP_STAT_L("</avsync>");
@@ -436,13 +441,13 @@
if (codec) {
NGX_RTMP_STAT_L("<meta><width>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
- "%ui", codec->width) - buf);
+ "%ui", codec->width) - buf);
NGX_RTMP_STAT_L("</width><height>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
- "%ui", codec->height) - buf);
+ "%ui", codec->height) - buf);
NGX_RTMP_STAT_L("</height><framerate>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
- "%ui", codec->frame_rate) - buf);
+ "%ui", codec->frame_rate) - buf);
NGX_RTMP_STAT_L("</framerate>");
cname = ngx_rtmp_get_video_codec_name(codec->video_codec_id);
if (*cname) {
@@ -471,7 +476,7 @@
NGX_RTMP_STAT_L("<nclients>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
- "%uz", nclients) - buf);
+ "%ui", nclients) - buf);
NGX_RTMP_STAT_L("</nclients>\r\n");
if (stream->publishing) {
@@ -488,7 +493,7 @@
NGX_RTMP_STAT_L("<nclients>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
- "%uz", total_nclients) - buf);
+ "%ui", total_nclients) - buf);
NGX_RTMP_STAT_L("</nclients>\r\n");
NGX_RTMP_STAT_L("</live>\r\n");
@@ -501,9 +506,8 @@
{
ngx_rtmp_play_ctx_t *ctx, *sctx;
ngx_rtmp_session_t *s;
- ngx_uint_t n;
- size_t nclients, total_nclients;
- u_char buf[NGX_OFF_T_LEN + 1];
+ ngx_uint_t n, nclients, total_nclients;
+ u_char buf[NGX_INT_T_LEN];
ngx_rtmp_stat_loc_conf_t *slcf;
if (pacf->entries.nelts == 0) {
@@ -530,7 +534,7 @@
break;
}
- ++nclients;
+ nclients++;
s = ctx->session;
if (slcf->stat & NGX_RTMP_STAT_CLIENTS) {
@@ -545,8 +549,8 @@
NGX_RTMP_STAT_L("<active/>");
NGX_RTMP_STAT_L("<nclients>");
- NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
- "%uz", nclients) - buf);
+ NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
+ "%ui", nclients) - buf);
NGX_RTMP_STAT_L("</nclients>\r\n");
NGX_RTMP_STAT_L("</stream>\r\n");
@@ -555,7 +559,7 @@
NGX_RTMP_STAT_L("<nclients>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
- "%uz", total_nclients) - buf);
+ "%ui", total_nclients) - buf);
NGX_RTMP_STAT_L("</nclients>\r\n");
NGX_RTMP_STAT_L("</play>\r\n");
@@ -620,8 +624,8 @@
ngx_chain_t *cl, *l, **ll, ***lll;
size_t n;
off_t len;
- static u_char tbuf[NGX_TIME_T_LEN + 1];
- static u_char nbuf[NGX_OFF_T_LEN + 1];
+ static u_char tbuf[NGX_TIME_T_LEN];
+ static u_char nbuf[NGX_INT_T_LEN];
slcf = ngx_http_get_module_loc_conf(r, ngx_rtmp_stat_module);
if (slcf->stat == 0) {
@@ -662,7 +666,7 @@
NGX_RTMP_STAT_L("<uptime>");
NGX_RTMP_STAT(tbuf, ngx_snprintf(tbuf, sizeof(tbuf),
- "%T", ngx_cached_time->sec - start_time) - tbuf);
+ "%T", ngx_cached_time->sec - start_time) - tbuf);
NGX_RTMP_STAT_L("</uptime>\r\n");
NGX_RTMP_STAT_L("<naccepted>");
|