removed trailing spaces

This commit is contained in:
Roman Arutyunyan 2013-11-30 11:21:53 +04:00
parent 96e60a4ac0
commit b9fcf7d880
43 changed files with 791 additions and 792 deletions

View File

@ -2,13 +2,13 @@ Copyright (c) 2012-2013, Roman Arutyunyan
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED

View File

@ -51,7 +51,7 @@
* Proved to work with Wirecast,FMS,Wowza,
JWPlayer,FlowPlayer,StrobeMediaPlayback,
ffmpeg,avconv,rtmpdump,flvstreamer
ffmpeg,avconv,rtmpdump,flvstreamer
and many more
* Statistics in XML/XSL in machine- & human-
@ -165,7 +165,7 @@ rtmp_auto_push directive.
live on;
# Every stream published here
# is automatically pushed to
# is automatically pushed to
# these two machines
push rtmp1.example.com;
push rtmp2.example.com:1934;
@ -178,7 +178,7 @@ rtmp_auto_push directive.
# and play locally
pull rtmp://rtmp3.example.com pageUrl=www.example.com/index.html;
}
application mystaticpull {
live on;
@ -201,8 +201,8 @@ rtmp_auto_push directive.
live on;
# The following notifications receive all
# the session variables as well as
# The following notifications receive all
# the session variables as well as
# particular call arguments in HTTP POST
# request
@ -218,7 +218,7 @@ rtmp_auto_push directive.
on_done http://localhost:8080/done;
# All above mentioned notifications receive
# standard connect() arguments as well as
# standard connect() arguments as well as
# play/publish ones. If any arguments are sent
# with GET-style syntax to play & publish
# these are also included.
@ -247,8 +247,8 @@ rtmp_auto_push directive.
# profile (see ffmpeg example).
# This example creates RTMP stream from movie ready for HLS:
#
# ffmpeg -loglevel verbose -re -i movie.avi -vcodec libx264
# -vprofile baseline -acodec libmp3lame -ar 44100 -ac 1
# ffmpeg -loglevel verbose -re -i movie.avi -vcodec libx264
# -vprofile baseline -acodec libmp3lame -ar 44100 -ac 1
# -f flv rtmp://localhost:1935/hls/movie
#
# If you need to transcode live stream use 'exec' feature.

2
config
View File

@ -1,6 +1,6 @@
ngx_addon_name="ngx_rtmp_module"
CORE_MODULES="$CORE_MODULES
CORE_MODULES="$CORE_MODULES
ngx_rtmp_module \
ngx_rtmp_core_module \
ngx_rtmp_cmd_module \

View File

@ -16,7 +16,7 @@ static ngx_rtmp_stream_eof_pt next_stream_eof;
static ngx_int_t ngx_rtmp_dash_postconfiguration(ngx_conf_t *cf);
static void * ngx_rtmp_dash_create_app_conf(ngx_conf_t *cf);
static char * ngx_rtmp_dash_merge_app_conf(ngx_conf_t *cf,
static char * ngx_rtmp_dash_merge_app_conf(ngx_conf_t *cf,
void *parent, void *child);
static ngx_int_t ngx_rtmp_dash_write_init_segments(ngx_rtmp_session_t *s);
@ -230,7 +230,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
static u_char buffer[NGX_RTMP_DASH_BUFSIZE];
static u_char start_time[sizeof("1970-09-28T12:00:00+06:00")];
static u_char end_time[sizeof("1970-09-28T12:00:00+06:00")];
dacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_dash_module);
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_dash_module);
codec_ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_codec_module);
@ -243,7 +243,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
ngx_rtmp_dash_write_init_segments(s);
}
fd = ngx_open_file(ctx->playlist_bak.data, NGX_FILE_WRONLY,
fd = ngx_open_file(ctx->playlist_bak.data, NGX_FILE_WRONLY,
NGX_FILE_TRUNCATE, NGX_FILE_DEFAULT_ACCESS);
if (fd == NGX_INVALID_FILE) {
@ -343,7 +343,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
ngx_libc_localtime(ctx->start_time.sec +
ngx_rtmp_dash_get_frag(s, 0)->timestamp / 1000, &tm);
*ngx_sprintf(start_time, "%4d-%02d-%02dT%02d:%02d:%02d%c%02d:%02d",
tm.tm_year + 1900, tm.tm_mon + 1,
tm.tm_mday, tm.tm_hour,
@ -354,9 +354,9 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
ngx_libc_localtime(ctx->start_time.sec +
(ngx_rtmp_dash_get_frag(s, ctx->nfrags - 1)->timestamp +
ngx_rtmp_dash_get_frag(s, ctx->nfrags - 1)->duration) /
ngx_rtmp_dash_get_frag(s, ctx->nfrags - 1)->duration) /
1000, &tm);
*ngx_sprintf(end_time, "%4d-%02d-%02dT%02d:%02d:%02d%c%02d:%02d",
tm.tm_year + 1900, tm.tm_mon + 1,
tm.tm_mday, tm.tm_hour,
@ -383,14 +383,14 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
if (ctx->has_video) {
p = ngx_slprintf(buffer, last, NGX_RTMP_DASH_MANIFEST_VIDEO,
codec_ctx->width,
codec_ctx->width,
codec_ctx->height,
codec_ctx->frame_rate,
&ctx->name,
codec_ctx->avc_profile,
codec_ctx->avc_compat,
codec_ctx->avc_level,
codec_ctx->width,
codec_ctx->width,
codec_ctx->height,
codec_ctx->frame_rate,
(ngx_uint_t) (codec_ctx->video_data_rate * 1000),
@ -402,10 +402,10 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
p = ngx_slprintf(p, last, NGX_RTMP_DASH_MANIFEST_TIME,
f->timestamp, f->duration);
}
p = ngx_slprintf(p, last, NGX_RTMP_DASH_MANIFEST_VIDEO_FOOTER);
n = ngx_write_fd(fd, buffer, p - buffer);
n = ngx_write_fd(fd, buffer, p - buffer);
}
if (ctx->has_audio) {
@ -425,13 +425,13 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
}
p = ngx_slprintf(p, last, NGX_RTMP_DASH_MANIFEST_AUDIO_FOOTER);
n = ngx_write_fd(fd, buffer, p - buffer);
}
p = ngx_slprintf(buffer, last, NGX_RTMP_DASH_MANIFEST_FOOTER);
n = ngx_write_fd(fd, buffer, p - buffer);
if (n < 0) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
"dash: write failed: '%V'", &ctx->playlist_bak);
@ -445,7 +445,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
== NGX_FILE_ERROR)
{
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
"dash: rename failed: '%V'->'%V'",
"dash: rename failed: '%V'->'%V'",
&ctx->playlist_bak, &ctx->playlist);
return NGX_ERROR;
}
@ -493,7 +493,7 @@ ngx_rtmp_dash_write_init_segments(ngx_rtmp_session_t *s)
NGX_RTMP_MP4_VIDEO_TRACK);
ngx_rtmp_mp4_write_moov(s, &b, NGX_RTMP_MP4_VIDEO_TRACK);
rc = ngx_write_fd(fd, b.start, (size_t) (b.last - b.start));
rc = ngx_write_fd(fd, b.start, (size_t) (b.last - b.start));
if (rc == NGX_ERROR) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
"dash: writing video init failed");
@ -528,7 +528,7 @@ ngx_rtmp_dash_write_init_segments(ngx_rtmp_session_t *s)
ngx_close_file(fd);
return NGX_OK;
return NGX_OK;
}
@ -640,7 +640,7 @@ done:
}
static ngx_int_t
static ngx_int_t
ngx_rtmp_dash_close_fragments(ngx_rtmp_session_t *s)
{
ngx_rtmp_dash_ctx_t *ctx;
@ -698,7 +698,7 @@ ngx_rtmp_dash_open_fragment(ngx_rtmp_session_t *s, ngx_rtmp_dash_track_t *t,
t->sample_count = 0;
t->earliest_pres_time = 0;
t->latest_pres_time = 0;
t->mdat_size = 0;
t->mdat_size = 0;
t->opened = 1;
if (type == 'v') {
@ -895,7 +895,7 @@ ngx_rtmp_dash_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
ctx->name.len = ngx_strlen(v->name);
ctx->name.data = ngx_palloc(s->connection->pool, ctx->name.len + 1);
if (ctx->name.data == NULL) {
return NGX_ERROR;
}
@ -916,8 +916,8 @@ ngx_rtmp_dash_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
p = ngx_cpymem(p, ctx->name.data, ctx->name.len);
/*
* ctx->stream holds initial part of stream file path
/*
* ctx->stream holds initial part of stream file path
* however the space for the whole stream path
* is allocated
*/
@ -942,9 +942,9 @@ ngx_rtmp_dash_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
/* playlist bak (new playlist) path */
ctx->playlist_bak.data = ngx_palloc(s->connection->pool,
ctx->playlist_bak.data = ngx_palloc(s->connection->pool,
ctx->playlist.len + sizeof(".bak"));
p = ngx_cpymem(ctx->playlist_bak.data, ctx->playlist.data,
p = ngx_cpymem(ctx->playlist_bak.data, ctx->playlist.data,
ctx->playlist.len);
p = ngx_cpymem(p, ".bak", sizeof(".bak") - 1);
@ -992,7 +992,7 @@ next:
static void
ngx_rtmp_dash_update_fragments(ngx_rtmp_session_t *s, ngx_int_t boundary,
ngx_rtmp_dash_update_fragments(ngx_rtmp_session_t *s, ngx_int_t boundary,
uint32_t timestamp)
{
ngx_int_t hit;
@ -1028,7 +1028,7 @@ ngx_rtmp_dash_update_fragments(ngx_rtmp_session_t *s, ngx_int_t boundary,
f->duration = (timestamp - f->timestamp);
if (boundary) {
if (boundary) {
ngx_rtmp_dash_close_fragments(s);
ngx_rtmp_dash_open_fragments(s);
@ -1100,7 +1100,7 @@ ngx_rtmp_dash_append(ngx_rtmp_session_t *s, ngx_chain_t *in,
static ngx_int_t
ngx_rtmp_dash_audio(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_rtmp_dash_audio(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
u_char htype;
@ -1111,9 +1111,9 @@ ngx_rtmp_dash_audio(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
dacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_dash_module);
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_dash_module);
codec_ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_codec_module);
if (dacf == NULL || !dacf->dash || ctx == NULL ||
codec_ctx == NULL || h->mlen < 2)
codec_ctx == NULL || h->mlen < 2)
{
return NGX_OK;
}
@ -1148,7 +1148,7 @@ ngx_rtmp_dash_audio(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_int_t
ngx_rtmp_dash_video(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_rtmp_dash_video(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
u_char *p;
@ -1296,7 +1296,7 @@ ngx_rtmp_dash_cleanup_dir(ngx_str_t *ppath, ngx_msec_t playlen)
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, ngx_cycle->log, 0,
"dash: cleanup dir '%V'", &name);
/*
/*
* null-termination gets spoiled in win32
* version of ngx_open_dir
*/

View File

@ -161,7 +161,7 @@ ngx_rtmp_mp4_write_matrix(ngx_buf_t *buf, uint32_t a, uint32_t b, uint32_t c,
uint32_t d, uint32_t tx, uint32_t ty)
{
/*
/*
* transformation matrix
* |a b u|
* |c d v|
@ -205,7 +205,7 @@ ngx_rtmp_mp4_write_ftyp(ngx_buf_t *b, ngx_rtmp_mp4_file_type_t ftype,
ngx_rtmp_mp4_box(b, "dash");
break;
default: /* NGX_RTMP_MP4_FILETYPE_SEG */
pos = ngx_rtmp_mp4_start_box(b, "styp");
@ -219,7 +219,7 @@ ngx_rtmp_mp4_write_ftyp(ngx_buf_t *b, ngx_rtmp_mp4_file_type_t ftype,
}
ngx_rtmp_mp4_update_box_size(b, pos);
return NGX_OK;
}
@ -332,7 +332,7 @@ ngx_rtmp_mp4_write_tkhd(ngx_rtmp_session_t *s, ngx_buf_t *b,
static ngx_int_t
ngx_rtmp_mp4_write_mdhd(ngx_buf_t *b)
ngx_rtmp_mp4_write_mdhd(ngx_buf_t *b)
{
u_char *pos;
@ -348,7 +348,7 @@ ngx_rtmp_mp4_write_mdhd(ngx_buf_t *b)
ngx_rtmp_mp4_field_32(b, 0);
/* time scale*/
ngx_rtmp_mp4_field_32(b, 1000);
ngx_rtmp_mp4_field_32(b, 1000);
/* duration */
ngx_rtmp_mp4_field_32(b, 0);
@ -394,7 +394,7 @@ ngx_rtmp_mp4_write_hdlr(ngx_buf_t *b, ngx_rtmp_mp4_track_type_t ttype)
ngx_rtmp_mp4_data(b, "VideoHandler", sizeof("VideoHandler"));
} else {
/* sound handler string, NULL-terminated */
ngx_rtmp_mp4_data(b, "SoundHandler", sizeof("SoundHandler"));
ngx_rtmp_mp4_data(b, "SoundHandler", sizeof("SoundHandler"));
}
ngx_rtmp_mp4_update_box_size(b, pos);
@ -404,7 +404,7 @@ ngx_rtmp_mp4_write_hdlr(ngx_buf_t *b, ngx_rtmp_mp4_track_type_t ttype)
static ngx_int_t
ngx_rtmp_mp4_write_vmhd(ngx_buf_t *b)
ngx_rtmp_mp4_write_vmhd(ngx_buf_t *b)
{
/* size is always 20, apparently */
ngx_rtmp_mp4_field_32(b, 20);
@ -423,7 +423,7 @@ ngx_rtmp_mp4_write_vmhd(ngx_buf_t *b)
static ngx_int_t
ngx_rtmp_mp4_write_smhd(ngx_buf_t *b)
ngx_rtmp_mp4_write_smhd(ngx_buf_t *b)
{
/* size is always 16, apparently */
ngx_rtmp_mp4_field_32(b, 16);
@ -621,7 +621,7 @@ ngx_rtmp_mp4_write_esds(ngx_rtmp_session_t *s, ngx_buf_t *b)
/* ES Descriptor */
ngx_rtmp_mp4_put_descr(b, 0x03, 23 + dsi_len);
ngx_rtmp_mp4_put_descr(b, 0x03, 23 + dsi_len);
/* ES_ID */
ngx_rtmp_mp4_field_16(b, 1);
@ -632,7 +632,7 @@ ngx_rtmp_mp4_write_esds(ngx_rtmp_session_t *s, ngx_buf_t *b)
/* DecoderConfig Descriptor */
ngx_rtmp_mp4_put_descr(b, 0x04, 15 + dsi_len);
ngx_rtmp_mp4_put_descr(b, 0x04, 15 + dsi_len);
/* objectTypeIndication: Audio ISO/IEC 14496-3 (AAC) */
ngx_rtmp_mp4_field_8(b, 0x40);
@ -644,10 +644,10 @@ ngx_rtmp_mp4_write_esds(ngx_rtmp_session_t *s, ngx_buf_t *b)
ngx_rtmp_mp4_field_24(b, 0);
/* maxBitrate */
ngx_rtmp_mp4_field_32(b, 0x0001F151);
ngx_rtmp_mp4_field_32(b, 0x0001F151);
/* avgBitrate */
ngx_rtmp_mp4_field_32(b, 0x0001F14D);
ngx_rtmp_mp4_field_32(b, 0x0001F14D);
/* DecoderSpecificInfo Descriptor */
@ -744,7 +744,7 @@ ngx_rtmp_mp4_write_stsd(ngx_rtmp_session_t *s, ngx_buf_t *b,
static ngx_int_t
ngx_rtmp_mp4_write_stts(ngx_buf_t *b)
ngx_rtmp_mp4_write_stts(ngx_buf_t *b)
{
u_char *pos;
@ -760,7 +760,7 @@ ngx_rtmp_mp4_write_stts(ngx_buf_t *b)
static ngx_int_t
ngx_rtmp_mp4_write_stsc(ngx_buf_t *b)
ngx_rtmp_mp4_write_stsc(ngx_buf_t *b)
{
u_char *pos;
@ -776,7 +776,7 @@ ngx_rtmp_mp4_write_stsc(ngx_buf_t *b)
static ngx_int_t
ngx_rtmp_mp4_write_stsz(ngx_buf_t *b)
ngx_rtmp_mp4_write_stsz(ngx_buf_t *b)
{
u_char *pos;
@ -793,7 +793,7 @@ ngx_rtmp_mp4_write_stsz(ngx_buf_t *b)
static ngx_int_t
ngx_rtmp_mp4_write_stco(ngx_buf_t *b)
ngx_rtmp_mp4_write_stco(ngx_buf_t *b)
{
u_char *pos;
@ -946,7 +946,7 @@ ngx_rtmp_mp4_write_tfhd(ngx_buf_t *b)
pos = ngx_rtmp_mp4_start_box(b, "tfhd");
/* version & flags */
ngx_rtmp_mp4_field_32(b, 0x00020000);
ngx_rtmp_mp4_field_32(b, 0x00020000);
/* track id */
ngx_rtmp_mp4_field_32(b, 1);
@ -975,7 +975,7 @@ ngx_rtmp_mp4_write_tfdt(ngx_buf_t *b, uint32_t earliest_pres_time)
static ngx_int_t
ngx_rtmp_mp4_write_trun(ngx_buf_t *b, uint32_t sample_count,
ngx_rtmp_mp4_write_trun(ngx_buf_t *b, uint32_t sample_count,
ngx_rtmp_mp4_sample_t *samples, ngx_uint_t sample_mask, u_char *moof_pos)
{
u_char *pos;
@ -984,7 +984,7 @@ ngx_rtmp_mp4_write_trun(ngx_buf_t *b, uint32_t sample_count,
pos = ngx_rtmp_mp4_start_box(b, "trun");
nitems = 0;
/* data offset present */
flags = 0x01;
@ -1007,10 +1007,10 @@ ngx_rtmp_mp4_write_trun(ngx_buf_t *b, uint32_t sample_count,
nitems++;
flags |= 0x000800;
}
offset = (pos - moof_pos) + 20 + (sample_count * nitems * 4) + 8;
ngx_rtmp_mp4_field_32(b, flags);
offset = (pos - moof_pos) + 20 + (sample_count * nitems * 4) + 8;
ngx_rtmp_mp4_field_32(b, flags);
ngx_rtmp_mp4_field_32(b, sample_count);
ngx_rtmp_mp4_field_32(b, offset);
@ -1040,7 +1040,7 @@ ngx_rtmp_mp4_write_trun(ngx_buf_t *b, uint32_t sample_count,
static ngx_int_t
ngx_rtmp_mp4_write_traf(ngx_buf_t *b, uint32_t earliest_pres_time,
ngx_rtmp_mp4_write_traf(ngx_buf_t *b, uint32_t earliest_pres_time,
uint32_t sample_count, ngx_rtmp_mp4_sample_t *samples,
ngx_uint_t sample_mask, u_char *moof_pos)
{
@ -1059,7 +1059,7 @@ ngx_rtmp_mp4_write_traf(ngx_buf_t *b, uint32_t earliest_pres_time,
static ngx_int_t
ngx_rtmp_mp4_write_mfhd(ngx_buf_t *b, uint32_t index)
ngx_rtmp_mp4_write_mfhd(ngx_buf_t *b, uint32_t index)
{
u_char *pos;
@ -1079,7 +1079,7 @@ ngx_rtmp_mp4_write_mfhd(ngx_buf_t *b, uint32_t index)
ngx_int_t
ngx_rtmp_mp4_write_sidx(ngx_buf_t *b, ngx_uint_t reference_size,
uint32_t earliest_pres_time, uint32_t latest_pres_time)
uint32_t earliest_pres_time, uint32_t latest_pres_time)
{
u_char *pos;
uint32_t duration;
@ -1095,7 +1095,7 @@ ngx_rtmp_mp4_write_sidx(ngx_buf_t *b, ngx_uint_t reference_size,
ngx_rtmp_mp4_field_32(b, 1);
/* timescale */
ngx_rtmp_mp4_field_32(b, 1000);
ngx_rtmp_mp4_field_32(b, 1000);
/* earliest presentation time */
ngx_rtmp_mp4_field_32(b, earliest_pres_time);
@ -1110,14 +1110,14 @@ ngx_rtmp_mp4_write_sidx(ngx_buf_t *b, ngx_uint_t reference_size,
ngx_rtmp_mp4_field_16(b, 1);
/* 1st bit is reference type, the rest is reference size */
ngx_rtmp_mp4_field_32(b, reference_size);
ngx_rtmp_mp4_field_32(b, reference_size);
/* subsegment duration */
ngx_rtmp_mp4_field_32(b, duration);
/* first bit is startsWithSAP (=1), next 3 bits are SAP type (=001) */
ngx_rtmp_mp4_field_8(b, 0x90);
ngx_rtmp_mp4_field_8(b, 0x90);
/* SAP delta time */
ngx_rtmp_mp4_field_24(b, 0);
@ -1128,7 +1128,7 @@ ngx_rtmp_mp4_write_sidx(ngx_buf_t *b, ngx_uint_t reference_size,
ngx_int_t
ngx_rtmp_mp4_write_moof(ngx_buf_t *b, uint32_t earliest_pres_time,
ngx_rtmp_mp4_write_moof(ngx_buf_t *b, uint32_t earliest_pres_time,
uint32_t sample_count, ngx_rtmp_mp4_sample_t *samples,
ngx_uint_t sample_mask, uint32_t index)
{
@ -1146,8 +1146,8 @@ ngx_rtmp_mp4_write_moof(ngx_buf_t *b, uint32_t earliest_pres_time,
}
ngx_uint_t
ngx_rtmp_mp4_write_mdat(ngx_buf_t *b, ngx_uint_t size)
ngx_uint_t
ngx_rtmp_mp4_write_mdat(ngx_buf_t *b, ngx_uint_t size)
{
ngx_rtmp_mp4_field_32(b, size);

View File

@ -44,7 +44,7 @@ ngx_int_t ngx_rtmp_mp4_write_moof(ngx_buf_t *b, uint32_t earliest_pres_time,
uint32_t sample_count, ngx_rtmp_mp4_sample_t *samples,
ngx_uint_t sample_mask, uint32_t index);
ngx_int_t ngx_rtmp_mp4_write_sidx(ngx_buf_t *b,
ngx_uint_t reference_size, uint32_t earliest_pres_time,
ngx_uint_t reference_size, uint32_t earliest_pres_time,
uint32_t latest_pres_time);
ngx_uint_t ngx_rtmp_mp4_write_mdat(ngx_buf_t *b, ngx_uint_t size);

View File

@ -22,7 +22,7 @@ static char * ngx_rtmp_hls_variant(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
static ngx_int_t ngx_rtmp_hls_postconfiguration(ngx_conf_t *cf);
static void * ngx_rtmp_hls_create_app_conf(ngx_conf_t *cf);
static char * ngx_rtmp_hls_merge_app_conf(ngx_conf_t *cf,
static char * ngx_rtmp_hls_merge_app_conf(ngx_conf_t *cf,
void *parent, void *child);
static ngx_int_t ngx_rtmp_hls_flush_audio(ngx_rtmp_session_t *s);
@ -122,21 +122,21 @@ static ngx_conf_enum_t ngx_rtmp_hls_naming_slots[] = {
{ ngx_string("timestamp"), NGX_RTMP_HLS_NAMING_TIMESTAMP },
{ ngx_string("system"), NGX_RTMP_HLS_NAMING_SYSTEM },
{ ngx_null_string, 0 }
};
};
static ngx_conf_enum_t ngx_rtmp_hls_slicing_slots[] = {
{ ngx_string("plain"), NGX_RTMP_HLS_SLICING_PLAIN },
{ ngx_string("aligned"), NGX_RTMP_HLS_SLICING_ALIGNED },
{ ngx_null_string, 0 }
};
};
static ngx_conf_enum_t ngx_rtmp_hls_type_slots[] = {
{ ngx_string("live"), NGX_RTMP_HLS_TYPE_LIVE },
{ ngx_string("event"), NGX_RTMP_HLS_TYPE_EVENT },
{ ngx_null_string, 0 }
};
};
static ngx_command_t ngx_rtmp_hls_commands[] = {
@ -355,7 +355,7 @@ ngx_rtmp_hls_write_variant_playlist(ngx_rtmp_session_t *s)
hacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_hls_module);
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_hls_module);
fd = ngx_open_file(ctx->var_playlist_bak.data, NGX_FILE_WRONLY,
fd = ngx_open_file(ctx->var_playlist_bak.data, NGX_FILE_WRONLY,
NGX_FILE_TRUNCATE, NGX_FILE_DEFAULT_ACCESS);
if (fd == NGX_INVALID_FILE) {
@ -404,7 +404,7 @@ ngx_rtmp_hls_write_variant_playlist(ngx_rtmp_session_t *s)
}
p = ngx_slprintf(p, last, "%s", ".m3u8\n");
rc = ngx_write_fd(fd, buffer, p - buffer);
if (rc < 0) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
@ -422,7 +422,7 @@ ngx_rtmp_hls_write_variant_playlist(ngx_rtmp_session_t *s)
== NGX_FILE_ERROR)
{
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
"hls: rename failed: '%V'->'%V'",
"hls: rename failed: '%V'->'%V'",
&ctx->var_playlist_bak, &ctx->var_playlist);
return NGX_ERROR;
}
@ -449,7 +449,7 @@ ngx_rtmp_hls_write_playlist(ngx_rtmp_session_t *s)
hacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_hls_module);
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_hls_module);
fd = ngx_open_file(ctx->playlist_bak.data, NGX_FILE_WRONLY,
fd = ngx_open_file(ctx->playlist_bak.data, NGX_FILE_WRONLY,
NGX_FILE_TRUNCATE, NGX_FILE_DEFAULT_ACCESS);
if (fd == NGX_INVALID_FILE) {
@ -468,7 +468,7 @@ ngx_rtmp_hls_write_playlist(ngx_rtmp_session_t *s)
}
}
p = ngx_snprintf(buffer, sizeof(buffer),
p = ngx_snprintf(buffer, sizeof(buffer),
"#EXTM3U\n"
"#EXT-X-VERSION:3\n"
"#EXT-X-MEDIA-SEQUENCE:%uL\n"
@ -497,7 +497,7 @@ ngx_rtmp_hls_write_playlist(ngx_rtmp_session_t *s)
for (i = 0; i < ctx->nfrags; i++) {
f = ngx_rtmp_hls_get_frag(s, i);
p = ngx_snprintf(buffer, sizeof(buffer),
p = ngx_snprintf(buffer, sizeof(buffer),
"%s"
"#EXTINF:%.3f,\n"
"%V%V%s%uL.ts\n",
@ -525,7 +525,7 @@ ngx_rtmp_hls_write_playlist(ngx_rtmp_session_t *s)
== NGX_FILE_ERROR)
{
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
"hls: rename failed: '%V'->'%V'",
"hls: rename failed: '%V'->'%V'",
&ctx->playlist_bak, &ctx->playlist);
return NGX_ERROR;
}
@ -539,7 +539,7 @@ ngx_rtmp_hls_write_playlist(ngx_rtmp_session_t *s)
static ngx_int_t
ngx_rtmp_hls_copy(ngx_rtmp_session_t *s, void *dst, u_char **src, size_t n,
ngx_rtmp_hls_copy(ngx_rtmp_session_t *s, void *dst, u_char **src, size_t n,
ngx_chain_t **in)
{
u_char *last;
@ -570,7 +570,7 @@ ngx_rtmp_hls_copy(ngx_rtmp_session_t *s, void *dst, u_char **src, size_t n,
}
pn = last - *src;
if (dst) {
ngx_memcpy(dst, *src, pn);
dst = (u_char *)dst + pn;
@ -641,7 +641,7 @@ ngx_rtmp_hls_append_sps_pps(ngx_rtmp_session_t *s, ngx_buf_t *out)
* - version
* - profile
* - compatibility
* - level
* - level
* - nal bytes
*/
@ -814,7 +814,7 @@ ngx_rtmp_hls_open_fragment(ngx_rtmp_session_t *s, uint64_t ts,
ctx->opened = 1;
f = ngx_rtmp_hls_get_frag(s, ctx->nfrags);
ngx_memzero(f, sizeof(*f));
f->active = 1;
@ -874,7 +874,7 @@ ngx_rtmp_hls_restore_stream(ngx_rtmp_session_t *s)
p = buffer;
end = buffer + ret;
for ( ;; ) {
last = ngx_strlchr(p, end, '\n');
@ -1136,7 +1136,7 @@ ngx_rtmp_hls_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
ctx->name.len = ngx_strlen(v->name);
ctx->name.data = ngx_palloc(s->connection->pool, ctx->name.len + 1);
if (ctx->name.data == NULL) {
return NGX_ERROR;
}
@ -1200,7 +1200,7 @@ ngx_rtmp_hls_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
sizeof(".bak") - 1;
ctx->var_playlist_bak.data = ngx_palloc(s->connection->pool,
ctx->var_playlist_bak.len + 1);
pp = ngx_cpymem(ctx->var_playlist_bak.data,
ctx->var_playlist.data,
ctx->var_playlist.len);
@ -1211,7 +1211,7 @@ ngx_rtmp_hls_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
}
}
}
/* playlist path */
@ -1227,9 +1227,9 @@ ngx_rtmp_hls_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
/* playlist bak (new playlist) path */
ctx->playlist_bak.data = ngx_palloc(s->connection->pool,
ctx->playlist_bak.data = ngx_palloc(s->connection->pool,
ctx->playlist.len + sizeof(".bak"));
p = ngx_cpymem(ctx->playlist_bak.data, ctx->playlist.data,
p = ngx_cpymem(ctx->playlist_bak.data, ctx->playlist.data,
ctx->playlist.len);
p = ngx_cpymem(p, ".bak", sizeof(".bak") - 1);
@ -1313,7 +1313,7 @@ ngx_rtmp_hls_parse_aac_header(ngx_rtmp_session_t *s, ngx_uint_t *objtype,
if (*objtype > 4) {
/*
/*
* Mark all extended profiles as LC
* to make Android as happy as possible.
*/
@ -1419,9 +1419,9 @@ ngx_rtmp_hls_flush_audio(ngx_rtmp_session_t *s)
if (!ctx->opened) {
return NGX_OK;
}
b = ctx->aframe;
if (b == NULL || b->pos == b->last) {
return NGX_OK;
}
@ -1452,7 +1452,7 @@ ngx_rtmp_hls_flush_audio(ngx_rtmp_session_t *s)
static ngx_int_t
ngx_rtmp_hls_audio(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_rtmp_hls_audio(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
ngx_rtmp_hls_app_conf_t *hacf;
@ -1470,9 +1470,9 @@ ngx_rtmp_hls_audio(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_hls_module);
codec_ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_codec_module);
if (hacf == NULL || !hacf->hls || ctx == NULL ||
codec_ctx == NULL || h->mlen < 2)
codec_ctx == NULL || h->mlen < 2)
{
return NGX_OK;
}
@ -1512,7 +1512,7 @@ ngx_rtmp_hls_audio(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
return NGX_OK;
}
/*
/*
* start new fragment here if
* there's no video at all, otherwise
* do it in video handler
@ -1557,7 +1557,7 @@ ngx_rtmp_hls_audio(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
"hls: aac header error");
return NGX_OK;
}
/* we have 5 free bytes + 2 bytes of RTMP frame header */
p[0] = 0xff;
@ -1647,7 +1647,7 @@ ngx_rtmp_hls_get_nal_bytes(ngx_rtmp_session_t *s)
static ngx_int_t
ngx_rtmp_hls_video(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_rtmp_hls_video(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
ngx_rtmp_hls_app_conf_t *hacf;
@ -1702,7 +1702,7 @@ ngx_rtmp_hls_video(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
if (htype != 1) {
return NGX_OK;
}
/* 3 bytes: decoder delay */
if (ngx_rtmp_hls_copy(s, &cts, &p, 3, &in) != NGX_OK) {
@ -1718,7 +1718,7 @@ ngx_rtmp_hls_video(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
out.end = buffer + sizeof(buffer);
out.pos = out.start;
out.last = out.pos;
rc = ngx_rtmp_hls_get_nal_bytes(s);
if (rc < 0) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
@ -1833,7 +1833,7 @@ ngx_rtmp_hls_video(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
frame.sid = 0xe0;
frame.key = (ftype == 1);
/*
/*
* start new fragment if
* - we have video key frame AND
* - we have audio buffered or have no audio at all
@ -1974,7 +1974,7 @@ ngx_rtmp_hls_cleanup_dir(ngx_str_t *ppath, ngx_msec_t playlen)
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, ngx_cycle->log, 0,
"hls: cleanup dir '%V'", &name);
/*
/*
* null-termination gets spoiled in win32
* version of ngx_open_dir
*/
@ -1983,7 +1983,7 @@ ngx_rtmp_hls_cleanup_dir(ngx_str_t *ppath, ngx_msec_t playlen)
if (ngx_delete_dir(path) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, ngx_errno,
"hls: cleanup " ngx_delete_dir_n
"hls: cleanup " ngx_delete_dir_n
" failed on '%V'", &spath);
} else {
nerased++;

View File

@ -37,7 +37,7 @@ static u_char ngx_rtmp_mpegts_header[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
/* TS */
0x47, 0x50, 0x01, 0x10, 0x00,
/* PSI */
@ -132,7 +132,7 @@ ngx_rtmp_mpegts_write_frame(ngx_file_t *file, ngx_rtmp_mpegts_frame_t *f,
ngx_log_debug6(NGX_LOG_DEBUG_HTTP, file->log, 0,
"mpegts: pid=%ui, sid=%ui, pts=%uL, "
"dts=%uL, key=%ui, size=%ui",
f->pid, f->sid, f->pts, f->dts,
f->pid, f->sid, f->pts, f->dts,
(ngx_uint_t) f->key, (size_t) (b->last - b->pos));
first = 1;
@ -189,7 +189,7 @@ ngx_rtmp_mpegts_write_frame(ngx_file_t *file, ngx_rtmp_mpegts_frame_t *f,
*p++ = (u_char) flags;
*p++ = (u_char) header_size;
p = ngx_rtmp_mpegts_write_pts(p, flags >> 6, f->pts +
p = ngx_rtmp_mpegts_write_pts(p, flags >> 6, f->pts +
NGX_RTMP_HLS_DELAY);
if (f->dts != f->pts) {

View File

@ -22,12 +22,12 @@ static ngx_int_t ngx_rtmp_add_addrs6(ngx_conf_t *cf, ngx_rtmp_port_t *mport,
ngx_rtmp_conf_addr_t *addr);
#endif
static ngx_int_t ngx_rtmp_cmp_conf_addrs(const void *one, const void *two);
static ngx_int_t ngx_rtmp_init_events(ngx_conf_t *cf,
static ngx_int_t ngx_rtmp_init_events(ngx_conf_t *cf,
ngx_rtmp_core_main_conf_t *cmcf);
static ngx_int_t ngx_rtmp_init_event_handlers(ngx_conf_t *cf,
static ngx_int_t ngx_rtmp_init_event_handlers(ngx_conf_t *cf,
ngx_rtmp_core_main_conf_t *cmcf);
static char * ngx_rtmp_merge_applications(ngx_conf_t *cf,
ngx_array_t *applications, void **app_conf, ngx_rtmp_module_t *module,
static char * ngx_rtmp_merge_applications(ngx_conf_t *cf,
ngx_array_t *applications, void **app_conf, ngx_rtmp_module_t *module,
ngx_uint_t ctx_index);
@ -247,7 +247,7 @@ ngx_rtmp_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
/*ctx->app_conf = cscfp[s]->ctx->loc_conf;*/
rv = module->merge_app_conf(cf,
rv = module->merge_app_conf(cf,
ctx->app_conf[mi],
cscfp[s]->ctx->app_conf[mi]);
if (rv != NGX_CONF_OK) {
@ -343,7 +343,7 @@ ngx_rtmp_merge_applications(ngx_conf_t *cf, ngx_array_t *applications,
}
cacf = (*cacfp)->app_conf[ngx_rtmp_core_module.ctx_index];
rv = ngx_rtmp_merge_applications(cf, &cacf->applications,
rv = ngx_rtmp_merge_applications(cf, &cacf->applications,
(*cacfp)->app_conf,
module, ctx_index);
if (rv != NGX_CONF_OK) {
@ -363,14 +363,14 @@ ngx_rtmp_init_events(ngx_conf_t *cf, ngx_rtmp_core_main_conf_t *cmcf)
size_t n;
for(n = 0; n < NGX_RTMP_MAX_EVENT; ++n) {
if (ngx_array_init(&cmcf->events[n], cf->pool, 1,
if (ngx_array_init(&cmcf->events[n], cf->pool, 1,
sizeof(ngx_rtmp_handler_pt)) != NGX_OK)
{
return NGX_ERROR;
}
}
if (ngx_array_init(&cmcf->amf, cf->pool, 1,
if (ngx_array_init(&cmcf->amf, cf->pool, 1,
sizeof(ngx_rtmp_amf_handler_t)) != NGX_OK)
{
return NGX_ERROR;
@ -433,7 +433,7 @@ ngx_rtmp_init_event_handlers(ngx_conf_t *cf, ngx_rtmp_core_main_conf_t *cmcf)
for(n = 0; n < cmcf->amf.nelts; ++n, ++h) {
ha = cmcf->amf_arrays.elts;
for(m = 0; m < cmcf->amf_arrays.nelts; ++m, ++ha) {
if (h->name.len == ha->key.len
if (h->name.len == ha->key.len
&& !ngx_strncmp(h->name.data, ha->key.data, ha->key.len))
{
break;
@ -443,7 +443,7 @@ ngx_rtmp_init_event_handlers(ngx_conf_t *cf, ngx_rtmp_core_main_conf_t *cmcf)
ha = ngx_array_push(&cmcf->amf_arrays);
ha->key = h->name;
ha->key_hash = ngx_hash_key_lc(ha->key.data, ha->key.len);
ha->value = ngx_array_create(cf->pool, 1,
ha->value = ngx_array_create(cf->pool, 1,
sizeof(ngx_rtmp_handler_pt));
if (ha->value == NULL) {
return NGX_ERROR;

View File

@ -307,7 +307,7 @@ typedef struct ngx_rtmp_core_srv_conf_s {
ngx_int_t max_streams;
ngx_uint_t ack_window;
ngx_int_t chunk_size;
ngx_pool_t *pool;
ngx_chain_t *free;
@ -344,7 +344,7 @@ typedef struct {
char *(*init_main_conf)(ngx_conf_t *cf, void *conf);
void *(*create_srv_conf)(ngx_conf_t *cf);
char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev,
char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev,
void *conf);
void *(*create_app_conf)(ngx_conf_t *cf);
@ -390,7 +390,7 @@ char* ngx_rtmp_user_message_type(uint16_t evt);
#endif
void ngx_rtmp_init_connection(ngx_connection_t *c);
ngx_rtmp_session_t * ngx_rtmp_init_session(ngx_connection_t *c,
ngx_rtmp_session_t * ngx_rtmp_init_session(ngx_connection_t *c,
ngx_rtmp_addr_conf_t *addr_conf);
void ngx_rtmp_finalize_session(ngx_rtmp_session_t *s);
void ngx_rtmp_handshake(ngx_rtmp_session_t *s);
@ -469,9 +469,9 @@ ngx_int_t ngx_rtmp_amf_shared_object_handler(ngx_rtmp_session_t *s,
--ngx_rtmp_ref(b)
ngx_chain_t * ngx_rtmp_alloc_shared_buf(ngx_rtmp_core_srv_conf_t *cscf);
void ngx_rtmp_free_shared_chain(ngx_rtmp_core_srv_conf_t *cscf,
void ngx_rtmp_free_shared_chain(ngx_rtmp_core_srv_conf_t *cscf,
ngx_chain_t *in);
ngx_chain_t * ngx_rtmp_append_shared_bufs(ngx_rtmp_core_srv_conf_t *cscf,
ngx_chain_t * ngx_rtmp_append_shared_bufs(ngx_rtmp_core_srv_conf_t *cscf,
ngx_chain_t *head, ngx_chain_t *in);
#define ngx_rtmp_acquire_shared_chain(in) \
@ -479,7 +479,7 @@ ngx_chain_t * ngx_rtmp_append_shared_bufs(ngx_rtmp_core_srv_conf_t *cscf,
/* Sending messages */
void ngx_rtmp_prepare_message(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
void ngx_rtmp_prepare_message(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_rtmp_header_t *lh, ngx_chain_t *out);
ngx_int_t ngx_rtmp_send_message(ngx_rtmp_session_t *s, ngx_chain_t *out,
ngx_uint_t priority);
@ -494,64 +494,64 @@ ngx_int_t ngx_rtmp_send_message(ngx_rtmp_session_t *s, ngx_chain_t *out,
#define NGX_RTMP_LIMIT_DYNAMIC 2
/* Protocol control messages */
ngx_chain_t * ngx_rtmp_create_chunk_size(ngx_rtmp_session_t *s,
ngx_chain_t * ngx_rtmp_create_chunk_size(ngx_rtmp_session_t *s,
uint32_t chunk_size);
ngx_chain_t * ngx_rtmp_create_abort(ngx_rtmp_session_t *s,
ngx_chain_t * ngx_rtmp_create_abort(ngx_rtmp_session_t *s,
uint32_t csid);
ngx_chain_t * ngx_rtmp_create_ack(ngx_rtmp_session_t *s,
ngx_chain_t * ngx_rtmp_create_ack(ngx_rtmp_session_t *s,
uint32_t seq);
ngx_chain_t * ngx_rtmp_create_ack_size(ngx_rtmp_session_t *s,
ngx_chain_t * ngx_rtmp_create_ack_size(ngx_rtmp_session_t *s,
uint32_t ack_size);
ngx_chain_t * ngx_rtmp_create_bandwidth(ngx_rtmp_session_t *s,
ngx_chain_t * ngx_rtmp_create_bandwidth(ngx_rtmp_session_t *s,
uint32_t ack_size, uint8_t limit_type);
ngx_int_t ngx_rtmp_send_chunk_size(ngx_rtmp_session_t *s,
ngx_int_t ngx_rtmp_send_chunk_size(ngx_rtmp_session_t *s,
uint32_t chunk_size);
ngx_int_t ngx_rtmp_send_abort(ngx_rtmp_session_t *s,
ngx_int_t ngx_rtmp_send_abort(ngx_rtmp_session_t *s,
uint32_t csid);
ngx_int_t ngx_rtmp_send_ack(ngx_rtmp_session_t *s,
ngx_int_t ngx_rtmp_send_ack(ngx_rtmp_session_t *s,
uint32_t seq);
ngx_int_t ngx_rtmp_send_ack_size(ngx_rtmp_session_t *s,
ngx_int_t ngx_rtmp_send_ack_size(ngx_rtmp_session_t *s,
uint32_t ack_size);
ngx_int_t ngx_rtmp_send_bandwidth(ngx_rtmp_session_t *s,
ngx_int_t ngx_rtmp_send_bandwidth(ngx_rtmp_session_t *s,
uint32_t ack_size, uint8_t limit_type);
/* User control messages */
ngx_chain_t * ngx_rtmp_create_stream_begin(ngx_rtmp_session_t *s,
ngx_chain_t * ngx_rtmp_create_stream_begin(ngx_rtmp_session_t *s,
uint32_t msid);
ngx_chain_t * ngx_rtmp_create_stream_eof(ngx_rtmp_session_t *s,
ngx_chain_t * ngx_rtmp_create_stream_eof(ngx_rtmp_session_t *s,
uint32_t msid);
ngx_chain_t * ngx_rtmp_create_stream_dry(ngx_rtmp_session_t *s,
ngx_chain_t * ngx_rtmp_create_stream_dry(ngx_rtmp_session_t *s,
uint32_t msid);
ngx_chain_t * ngx_rtmp_create_set_buflen(ngx_rtmp_session_t *s,
ngx_chain_t * ngx_rtmp_create_set_buflen(ngx_rtmp_session_t *s,
uint32_t msid, uint32_t buflen_msec);
ngx_chain_t * ngx_rtmp_create_recorded(ngx_rtmp_session_t *s,
ngx_chain_t * ngx_rtmp_create_recorded(ngx_rtmp_session_t *s,
uint32_t msid);
ngx_chain_t * ngx_rtmp_create_ping_request(ngx_rtmp_session_t *s,
uint32_t timestamp);
ngx_chain_t * ngx_rtmp_create_ping_response(ngx_rtmp_session_t *s,
ngx_chain_t * ngx_rtmp_create_ping_response(ngx_rtmp_session_t *s,
uint32_t timestamp);
ngx_int_t ngx_rtmp_send_stream_begin(ngx_rtmp_session_t *s,
ngx_int_t ngx_rtmp_send_stream_begin(ngx_rtmp_session_t *s,
uint32_t msid);
ngx_int_t ngx_rtmp_send_stream_eof(ngx_rtmp_session_t *s,
ngx_int_t ngx_rtmp_send_stream_eof(ngx_rtmp_session_t *s,
uint32_t msid);
ngx_int_t ngx_rtmp_send_stream_dry(ngx_rtmp_session_t *s,
ngx_int_t ngx_rtmp_send_stream_dry(ngx_rtmp_session_t *s,
uint32_t msid);
ngx_int_t ngx_rtmp_send_set_buflen(ngx_rtmp_session_t *s,
ngx_int_t ngx_rtmp_send_set_buflen(ngx_rtmp_session_t *s,
uint32_t msid, uint32_t buflen_msec);
ngx_int_t ngx_rtmp_send_recorded(ngx_rtmp_session_t *s,
ngx_int_t ngx_rtmp_send_recorded(ngx_rtmp_session_t *s,
uint32_t msid);
ngx_int_t ngx_rtmp_send_ping_request(ngx_rtmp_session_t *s,
uint32_t timestamp);
ngx_int_t ngx_rtmp_send_ping_response(ngx_rtmp_session_t *s,
ngx_int_t ngx_rtmp_send_ping_response(ngx_rtmp_session_t *s,
uint32_t timestamp);
/* AMF sender/receiver */
ngx_int_t ngx_rtmp_append_amf(ngx_rtmp_session_t *s,
ngx_chain_t **first, ngx_chain_t **last,
ngx_chain_t **first, ngx_chain_t **last,
ngx_rtmp_amf_elt_t *elts, size_t nelts);
ngx_int_t ngx_rtmp_receive_amf(ngx_rtmp_session_t *s, ngx_chain_t *in,
ngx_int_t ngx_rtmp_receive_amf(ngx_rtmp_session_t *s, ngx_chain_t *in,
ngx_rtmp_amf_elt_t *elts, size_t nelts);
ngx_chain_t * ngx_rtmp_create_amf(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,

View File

@ -18,11 +18,11 @@ static ngx_rtmp_play_pt next_play;
#define NGX_RTMP_ACCESS_PLAY 0x02
static char * ngx_rtmp_access_rule(ngx_conf_t *cf, ngx_command_t *cmd,
static char * ngx_rtmp_access_rule(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
static ngx_int_t ngx_rtmp_access_postconfiguration(ngx_conf_t *cf);
static void * ngx_rtmp_access_create_app_conf(ngx_conf_t *cf);
static char * ngx_rtmp_access_merge_app_conf(ngx_conf_t *cf,
static char * ngx_rtmp_access_merge_app_conf(ngx_conf_t *cf,
void *parent, void *child);
@ -331,7 +331,7 @@ ngx_rtmp_access_rule(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
#if (NGX_HAVE_INET6)
ngx_rtmp_access_rule6_t *rule6;
#endif
size_t n;
size_t n;
ngx_uint_t flags;
ngx_memzero(&cidr, sizeof(ngx_cidr_t));
@ -342,7 +342,7 @@ ngx_rtmp_access_rule(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
flags = 0;
if (cf->args->nelts == 2) {
flags = NGX_RTMP_ACCESS_PUBLISH | NGX_RTMP_ACCESS_PLAY;
} else {
@ -356,7 +356,7 @@ ngx_rtmp_access_rule(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
continue;
}
if (value[n].len == sizeof("play") - 1 &&
ngx_strcmp(value[1].data, "play") == 0)
{
@ -430,7 +430,7 @@ ngx_rtmp_access_rule(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
static ngx_int_t
static ngx_int_t
ngx_rtmp_access_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
{
if (s->auto_pushed) {
@ -446,7 +446,7 @@ next:
}
static ngx_int_t
static ngx_int_t
ngx_rtmp_access_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
{
if (ngx_rtmp_access(s, NGX_RTMP_ACCESS_PLAY) != NGX_OK) {

View File

@ -89,7 +89,7 @@ ngx_rtmp_amf_get(ngx_rtmp_amf_ctx_t *ctx, void *p, size_t n)
}
ctx->offset = offset + n;
ctx->link = l;
#ifdef NGX_DEBUG
ngx_rtmp_amf_debug("read", ctx->log, (u_char*)op, on);
#endif
@ -169,8 +169,8 @@ ngx_rtmp_amf_put(ngx_rtmp_amf_ctx_t *ctx, void *p, size_t n)
}
static ngx_int_t
ngx_rtmp_amf_read_object(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
static ngx_int_t
ngx_rtmp_amf_read_object(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
size_t nelts)
{
uint8_t type;
@ -220,7 +220,7 @@ ngx_rtmp_amf_read_object(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
/* TODO: if we require array to be sorted on name
* then we could be able to use binary search */
for(n = 0; n < nelts
for(n = 0; n < nelts
&& (len != elts[n].name.len
|| ngx_strncmp(name, elts[n].name.data, len));
++n);
@ -239,8 +239,8 @@ ngx_rtmp_amf_read_object(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
}
static ngx_int_t
ngx_rtmp_amf_read_array(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
static ngx_int_t
ngx_rtmp_amf_read_array(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
size_t nelts)
{
uint32_t len;
@ -262,8 +262,8 @@ ngx_rtmp_amf_read_array(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
}
static ngx_int_t
ngx_rtmp_amf_read_variant(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
static ngx_int_t
ngx_rtmp_amf_read_variant(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
size_t nelts)
{
uint8_t type;
@ -299,8 +299,8 @@ ngx_rtmp_amf_is_compatible_type(uint8_t t1, uint8_t t2)
}
ngx_int_t
ngx_rtmp_amf_read(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
ngx_int_t
ngx_rtmp_amf_read(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
size_t nelts)
{
void *data;
@ -328,7 +328,7 @@ ngx_rtmp_amf_read(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
return NGX_ERROR;
}
type = type8;
data = (elts &&
data = (elts &&
ngx_rtmp_amf_is_compatible_type(
(uint8_t) (elts->type & 0xff), (uint8_t) type))
? elts->data
@ -393,18 +393,18 @@ ngx_rtmp_amf_read(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
}
case NGX_RTMP_AMF_OBJECT:
if (ngx_rtmp_amf_read_object(ctx, data,
if (ngx_rtmp_amf_read_object(ctx, data,
data && elts ? elts->len / sizeof(ngx_rtmp_amf_elt_t) : 0
) != NGX_OK)
) != NGX_OK)
{
return NGX_ERROR;
}
break;
case NGX_RTMP_AMF_ARRAY:
if (ngx_rtmp_amf_read_array(ctx, data,
if (ngx_rtmp_amf_read_array(ctx, data,
data && elts ? elts->len / sizeof(ngx_rtmp_amf_elt_t) : 0
) != NGX_OK)
) != NGX_OK)
{
return NGX_ERROR;
}
@ -418,7 +418,7 @@ ngx_rtmp_amf_read(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
return NGX_ERROR;
}
break;
case NGX_RTMP_AMF_INT8:
if (ngx_rtmp_amf_get(ctx, data, 1) != NGX_OK) {
return NGX_ERROR;
@ -455,7 +455,7 @@ ngx_rtmp_amf_read(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
}
static ngx_int_t
static ngx_int_t
ngx_rtmp_amf_write_object(ngx_rtmp_amf_ctx_t *ctx,
ngx_rtmp_amf_elt_t *elts, size_t nelts)
{
@ -467,9 +467,9 @@ ngx_rtmp_amf_write_object(ngx_rtmp_amf_ctx_t *ctx,
len = (uint16_t) elts[n].name.len;
if (ngx_rtmp_amf_put(ctx,
ngx_rtmp_amf_reverse_copy(buf,
&len, 2), 2) != NGX_OK)
if (ngx_rtmp_amf_put(ctx,
ngx_rtmp_amf_reverse_copy(buf,
&len, 2), 2) != NGX_OK)
{
return NGX_ERROR;
}
@ -491,7 +491,7 @@ ngx_rtmp_amf_write_object(ngx_rtmp_amf_ctx_t *ctx,
}
static ngx_int_t
static ngx_int_t
ngx_rtmp_amf_write_array(ngx_rtmp_amf_ctx_t *ctx,
ngx_rtmp_amf_elt_t *elts, size_t nelts)
{
@ -500,9 +500,9 @@ ngx_rtmp_amf_write_array(ngx_rtmp_amf_ctx_t *ctx,
u_char buf[4];
len = nelts;
if (ngx_rtmp_amf_put(ctx,
ngx_rtmp_amf_reverse_copy(buf,
&len, 4), 4) != NGX_OK)
if (ngx_rtmp_amf_put(ctx,
ngx_rtmp_amf_reverse_copy(buf,
&len, 4), 4) != NGX_OK)
{
return NGX_ERROR;
}
@ -517,7 +517,7 @@ ngx_rtmp_amf_write_array(ngx_rtmp_amf_ctx_t *ctx,
}
ngx_int_t
ngx_int_t
ngx_rtmp_amf_write(ngx_rtmp_amf_ctx_t *ctx,
ngx_rtmp_amf_elt_t *elts, size_t nelts)
{
@ -545,9 +545,9 @@ ngx_rtmp_amf_write(ngx_rtmp_amf_ctx_t *ctx,
switch(type) {
case NGX_RTMP_AMF_NUMBER:
if (ngx_rtmp_amf_put(ctx,
ngx_rtmp_amf_reverse_copy(buf,
data, 8), 8) != NGX_OK)
if (ngx_rtmp_amf_put(ctx,
ngx_rtmp_amf_reverse_copy(buf,
data, 8), 8) != NGX_OK)
{
return NGX_ERROR;
}
@ -564,9 +564,9 @@ ngx_rtmp_amf_write(ngx_rtmp_amf_ctx_t *ctx,
len = (uint16_t) ngx_strlen((u_char*) data);
}
if (ngx_rtmp_amf_put(ctx,
ngx_rtmp_amf_reverse_copy(buf,
&len, 2), 2) != NGX_OK)
if (ngx_rtmp_amf_put(ctx,
ngx_rtmp_amf_reverse_copy(buf,
&len, 2), 2) != NGX_OK)
{
return NGX_ERROR;
}
@ -597,7 +597,7 @@ ngx_rtmp_amf_write(ngx_rtmp_amf_ctx_t *ctx,
break;
case NGX_RTMP_AMF_ARRAY:
if (ngx_rtmp_amf_write_array(ctx, data,
if (ngx_rtmp_amf_write_array(ctx, data,
elts[n].len / sizeof(ngx_rtmp_amf_elt_t)) != NGX_OK)
{
return NGX_ERROR;
@ -612,8 +612,8 @@ ngx_rtmp_amf_write(ngx_rtmp_amf_ctx_t *ctx,
case NGX_RTMP_AMF_INT16:
if (ngx_rtmp_amf_put(ctx,
ngx_rtmp_amf_reverse_copy(buf,
data, 2), 2) != NGX_OK)
ngx_rtmp_amf_reverse_copy(buf,
data, 2), 2) != NGX_OK)
{
return NGX_ERROR;
}
@ -621,8 +621,8 @@ ngx_rtmp_amf_write(ngx_rtmp_amf_ctx_t *ctx,
case NGX_RTMP_AMF_INT32:
if (ngx_rtmp_amf_put(ctx,
ngx_rtmp_amf_reverse_copy(buf,
data, 4), 4) != NGX_OK)
ngx_rtmp_amf_reverse_copy(buf,
data, 4), 4) != NGX_OK)
{
return NGX_ERROR;
}

View File

@ -19,9 +19,9 @@ 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,
static ngx_int_t ngx_rtmp_auto_push_publish(ngx_rtmp_session_t *s,
ngx_rtmp_publish_t *v);
static ngx_int_t ngx_rtmp_auto_push_delete_stream(ngx_rtmp_session_t *s,
static ngx_int_t ngx_rtmp_auto_push_delete_stream(ngx_rtmp_session_t *s,
ngx_rtmp_delete_stream_t *v);
#endif
@ -112,7 +112,7 @@ ngx_rtmp_auto_push_init_process(ngx_cycle_t *cycle)
return NGX_OK;
}
apcf = (ngx_rtmp_auto_push_conf_t *) ngx_get_conf(cycle->conf_ctx,
apcf = (ngx_rtmp_auto_push_conf_t *) ngx_get_conf(cycle->conf_ctx,
ngx_rtmp_auto_push_module);
if (apcf->auto_push == 0) {
return NGX_OK;
@ -154,7 +154,7 @@ ngx_rtmp_auto_push_init_process(ngx_cycle_t *cycle)
/* Disable unix socket client address extraction
* from accept call
* Nginx generates bad addr_text with this enabled */
ls->addr_ntop = 0;
ls->addr_ntop = 0;
ls->socklen = sizeof(struct sockaddr_un);
sun = ngx_pcalloc(cycle->pool, ls->socklen);
@ -163,17 +163,17 @@ ngx_rtmp_auto_push_init_process(ngx_cycle_t *cycle)
return NGX_ERROR;
}
sun->sun_family = AF_UNIX;
*ngx_snprintf((u_char *) sun->sun_path, sizeof(sun->sun_path),
"%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%i",
*ngx_snprintf((u_char *) sun->sun_path, sizeof(sun->sun_path),
"%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%i",
&apcf->socket_dir, ngx_process_slot)
= 0;
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, cycle->log, 0,
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, cycle->log, 0,
"auto_push: create socket '%s'",
sun->sun_path);
if (ngx_file_info(sun->sun_path, &fi) != ENOENT) {
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, cycle->log, 0,
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, cycle->log, 0,
"auto_push: delete existing socket '%s'",
sun->sun_path);
ngx_delete_file(sun->sun_path);
@ -247,14 +247,14 @@ ngx_rtmp_auto_push_exit_process(ngx_cycle_t *cycle)
ngx_rtmp_auto_push_conf_t *apcf;
u_char path[NGX_MAX_PATH];
apcf = (ngx_rtmp_auto_push_conf_t *) ngx_get_conf(cycle->conf_ctx,
apcf = (ngx_rtmp_auto_push_conf_t *) ngx_get_conf(cycle->conf_ctx,
ngx_rtmp_auto_push_module);
if (apcf->auto_push == 0) {
return;
}
*ngx_snprintf(path, sizeof(path),
"%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%i",
&apcf->socket_dir, ngx_process_slot)
"%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%i",
&apcf->socket_dir, ngx_process_slot)
= 0;
ngx_delete_file(path);
@ -319,10 +319,10 @@ ngx_rtmp_auto_push_reconnect(ngx_event_t *ev)
ngx_core_conf_t *ccf;
ngx_file_info_t fi;
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"auto_push: reconnect");
apcf = (ngx_rtmp_auto_push_conf_t *) ngx_get_conf(ngx_cycle->conf_ctx,
apcf = (ngx_rtmp_auto_push_conf_t *) ngx_get_conf(ngx_cycle->conf_ctx,
ngx_rtmp_auto_push_module);
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_auto_push_module);
if (ctx == NULL) {
@ -366,7 +366,7 @@ ngx_rtmp_auto_push_reconnect(ngx_event_t *ev)
ngx_memzero(&at.url, sizeof(at.url));
u = &at.url.url;
p = ngx_snprintf(path, sizeof(path) - 1,
"unix:%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%i",
"unix:%V/" NGX_RTMP_AUTO_PUSH_SOCKNAME ".%i",
&apcf->socket_dir, n);
*p = 0;
@ -388,12 +388,12 @@ ngx_rtmp_auto_push_reconnect(ngx_event_t *ev)
continue;
}
p = ngx_snprintf(flash_ver, sizeof(flash_ver) - 1, "APSH %i,%i",
p = ngx_snprintf(flash_ver, sizeof(flash_ver) - 1, "APSH %i,%i",
(ngx_int_t) ngx_process_slot, (ngx_int_t) ngx_pid);
at.flash_ver.data = flash_ver;
at.flash_ver.len = p - flash_ver;
ngx_log_debug4(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug4(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"auto_push: connect slot=%i pid=%P socket='%s' name='%s'",
n, pid, path, ctx->name);
@ -455,7 +455,7 @@ ngx_rtmp_auto_push_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
goto next;
}
apcf = (ngx_rtmp_auto_push_conf_t *) ngx_get_conf(ngx_cycle->conf_ctx,
apcf = (ngx_rtmp_auto_push_conf_t *) ngx_get_conf(ngx_cycle->conf_ctx,
ngx_rtmp_auto_push_module);
if (apcf->auto_push == 0) {
goto next;
@ -463,7 +463,7 @@ ngx_rtmp_auto_push_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_auto_push_module);
if (ctx == NULL) {
ctx = ngx_palloc(s->connection->pool,
ctx = ngx_palloc(s->connection->pool,
sizeof(ngx_rtmp_auto_push_ctx_t));
if (ctx == NULL) {
goto next;
@ -477,7 +477,7 @@ ngx_rtmp_auto_push_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
ctx->push_evt.log = s->connection->log;
ctx->push_evt.handler = ngx_rtmp_auto_push_reconnect;
ctx->slots = ngx_pcalloc(s->connection->pool,
ctx->slots = ngx_pcalloc(s->connection->pool,
sizeof(ngx_int_t) * NGX_MAX_PROCESSES);
if (ctx->slots == NULL) {
goto next;
@ -494,7 +494,7 @@ next:
static ngx_int_t
ngx_rtmp_auto_push_delete_stream(ngx_rtmp_session_t *s,
ngx_rtmp_auto_push_delete_stream(ngx_rtmp_session_t *s,
ngx_rtmp_delete_stream_t *v)
{
ngx_rtmp_auto_push_conf_t *apcf;
@ -502,7 +502,7 @@ ngx_rtmp_auto_push_delete_stream(ngx_rtmp_session_t *s,
ngx_rtmp_relay_ctx_t *rctx;
ngx_int_t slot;
apcf = (ngx_rtmp_auto_push_conf_t *) ngx_get_conf(ngx_cycle->conf_ctx,
apcf = (ngx_rtmp_auto_push_conf_t *) ngx_get_conf(ngx_cycle->conf_ctx,
ngx_rtmp_auto_push_module);
if (apcf->auto_push == 0) {
goto next;
@ -518,20 +518,20 @@ ngx_rtmp_auto_push_delete_stream(ngx_rtmp_session_t *s,
/* skip non-relays & publishers */
rctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_relay_module);
if (rctx == NULL ||
if (rctx == NULL ||
rctx->tag != &ngx_rtmp_auto_push_module ||
rctx->publish == NULL)
rctx->publish == NULL)
{
goto next;
}
slot = (ngx_process_t *) rctx->data - &ngx_processes[0];
ngx_log_debug3(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug3(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"auto_push: disconnect slot=%i app='%V' name='%V'",
slot, &rctx->app, &rctx->name);
pctx = ngx_rtmp_get_module_ctx(rctx->publish->session,
pctx = ngx_rtmp_get_module_ctx(rctx->publish->session,
ngx_rtmp_auto_push_module);
if (pctx == NULL) {
goto next;

View File

@ -9,11 +9,11 @@
#include "ngx_rtmp_bandwidth.h"
void
void
ngx_rtmp_update_bandwidth(ngx_rtmp_bandwidth_t *bw, uint32_t bytes)
{
if (ngx_cached_time->sec > bw->intl_end) {
bw->bandwidth = ngx_cached_time->sec >
bw->bandwidth = ngx_cached_time->sec >
bw->intl_end + NGX_RTMP_BANDWIDTH_INTERVAL
? 0
: bw->intl_bytes / NGX_RTMP_BANDWIDTH_INTERVAL;

View File

@ -29,4 +29,3 @@ void ngx_rtmp_update_bandwidth(ngx_rtmp_bandwidth_t *bw, uint32_t bytes);
#endif /* _NGX_RTMP_BANDWIDTH_H_INCLUDED_ */

View File

@ -95,7 +95,7 @@ ngx_module_t ngx_rtmp_cmd_module = {
static void
ngx_rtmp_cmd_fill_args(u_char name[NGX_RTMP_MAX_NAME],
ngx_rtmp_cmd_fill_args(u_char name[NGX_RTMP_MAX_NAME],
u_char args[NGX_RTMP_MAX_ARGS])
{
u_char *p;
@ -120,11 +120,11 @@ ngx_rtmp_cmd_connect_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_rtmp_amf_elt_t in_cmd[] = {
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("app"),
v.app, sizeof(v.app) },
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("flashVer"),
v.flashver, sizeof(v.flashver) },
@ -165,8 +165,8 @@ ngx_rtmp_cmd_connect_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
};
ngx_memzero(&v, sizeof(v));
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
{
return NGX_ERROR;
}
@ -183,7 +183,7 @@ ngx_rtmp_cmd_connect_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
"connect: app='%s' args='%s' flashver='%s' swf_url='%s' "
"tc_url='%s' page_url='%s' acodecs=%uD vcodecs=%uD "
"object_encoding=%ui",
"object_encoding=%ui",
v.app, v.args, v.flashver, v.swf_url, v.tc_url, v.page_url,
(uint32_t)v.acodecs, (uint32_t)v.vcodecs,
(ngx_int_t)v.object_encoding);
@ -207,10 +207,10 @@ ngx_rtmp_cmd_connect(ngx_rtmp_session_t *s, ngx_rtmp_connect_t *v)
static ngx_rtmp_amf_elt_t out_obj[] = {
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("fmsVer"),
NGX_RTMP_FMS_VERSION, 0 },
{ NGX_RTMP_AMF_NUMBER,
ngx_string("capabilities"),
&capabilities, 0 },
@ -218,13 +218,13 @@ ngx_rtmp_cmd_connect(ngx_rtmp_session_t *s, ngx_rtmp_connect_t *v)
static ngx_rtmp_amf_elt_t out_inf[] = {
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("level"),
"status", 0 },
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("code"),
"NetConnection.Connect.Success", 0 },
"NetConnection.Connect.Success", 0 },
{ NGX_RTMP_AMF_STRING,
ngx_string("description"),
@ -238,7 +238,7 @@ ngx_rtmp_cmd_connect(ngx_rtmp_session_t *s, ngx_rtmp_connect_t *v)
static ngx_rtmp_amf_elt_t out_elts[] = {
{ NGX_RTMP_AMF_STRING,
ngx_null_string,
ngx_null_string,
"_result", 0 },
{ NGX_RTMP_AMF_NUMBER,
@ -255,7 +255,7 @@ ngx_rtmp_cmd_connect(ngx_rtmp_session_t *s, ngx_rtmp_connect_t *v)
};
if (s->connected) {
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
"connect: duplicate connection");
return NGX_ERROR;
}
@ -307,7 +307,7 @@ ngx_rtmp_cmd_connect(ngx_rtmp_session_t *s, ngx_rtmp_connect_t *v)
}
if (s->app_conf == NULL) {
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
"connect: application not found: '%V'", &s->app);
return NGX_ERROR;
}
@ -315,12 +315,12 @@ ngx_rtmp_cmd_connect(ngx_rtmp_session_t *s, ngx_rtmp_connect_t *v)
object_encoding = v->object_encoding;
return ngx_rtmp_send_ack_size(s, cscf->ack_window) != NGX_OK ||
ngx_rtmp_send_bandwidth(s, cscf->ack_window,
ngx_rtmp_send_bandwidth(s, cscf->ack_window,
NGX_RTMP_LIMIT_DYNAMIC) != NGX_OK ||
ngx_rtmp_send_chunk_size(s, cscf->chunk_size) != NGX_OK ||
ngx_rtmp_send_amf(s, &h, out_elts,
sizeof(out_elts) / sizeof(out_elts[0]))
!= NGX_OK ? NGX_ERROR : NGX_OK;
!= NGX_OK ? NGX_ERROR : NGX_OK;
}
@ -332,13 +332,13 @@ ngx_rtmp_cmd_create_stream_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_rtmp_amf_elt_t in_elts[] = {
{ NGX_RTMP_AMF_NUMBER,
ngx_null_string,
{ NGX_RTMP_AMF_NUMBER,
ngx_null_string,
&v.trans, sizeof(v.trans) },
};
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
{
return NGX_ERROR;
}
@ -353,7 +353,7 @@ static ngx_int_t
ngx_rtmp_cmd_create_stream(ngx_rtmp_session_t *s, ngx_rtmp_create_stream_t *v)
{
/* support one message stream per connection */
static double stream;
static double stream;
static double trans;
ngx_rtmp_header_t h;
@ -367,7 +367,7 @@ ngx_rtmp_cmd_create_stream(ngx_rtmp_session_t *s, ngx_rtmp_create_stream_t *v)
ngx_null_string,
&trans, 0 },
{ NGX_RTMP_AMF_NULL,
{ NGX_RTMP_AMF_NULL,
ngx_null_string,
NULL, 0 },
@ -403,7 +403,7 @@ ngx_rtmp_cmd_close_stream_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
&v.stream, 0 },
};
if (ngx_rtmp_receive_amf(s, in, in_elts,
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
{
return NGX_ERROR;
@ -430,7 +430,7 @@ ngx_rtmp_cmd_delete_stream_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_rtmp_amf_elt_t in_elts[] = {
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_null_string,
NULL, 0 },
@ -443,8 +443,8 @@ ngx_rtmp_cmd_delete_stream_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
&v.stream, 0 },
};
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
{
return NGX_ERROR;
}
@ -476,7 +476,7 @@ ngx_rtmp_cmd_publish_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
/* transaction is always 0 */
{ NGX_RTMP_AMF_NUMBER,
ngx_null_string,
ngx_null_string,
NULL, 0 },
{ NGX_RTMP_AMF_NULL,
@ -494,8 +494,8 @@ ngx_rtmp_cmd_publish_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_memzero(&v, sizeof(v));
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
{
return NGX_ERROR;
}
@ -525,7 +525,7 @@ ngx_rtmp_cmd_play_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_rtmp_amf_elt_t in_elts[] = {
/* transaction is always 0 */
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_null_string,
NULL, 0 },
@ -552,7 +552,7 @@ ngx_rtmp_cmd_play_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_memzero(&v, sizeof(v));
if (ngx_rtmp_receive_amf(s, in, in_elts,
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
{
return NGX_ERROR;
@ -563,8 +563,8 @@ ngx_rtmp_cmd_play_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
"play: name='%s' args='%s' start=%i duration=%i "
"reset=%i silent=%i",
v.name, v.args, (ngx_int_t) v.start,
(ngx_int_t) v.duration, (ngx_int_t) v.reset,
v.name, v.args, (ngx_int_t) v.start,
(ngx_int_t) v.duration, (ngx_int_t) v.reset,
(ngx_int_t) v.silent);
return ngx_rtmp_play(s, &v);
@ -586,7 +586,7 @@ ngx_rtmp_cmd_pause_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_rtmp_amf_elt_t in_elts[] = {
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_null_string,
NULL, 0 },
@ -605,8 +605,8 @@ ngx_rtmp_cmd_pause_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_memzero(&v, sizeof(v));
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
{
return NGX_ERROR;
}
@ -652,7 +652,7 @@ ngx_rtmp_cmd_seek_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_rtmp_amf_elt_t in_elts[] = {
/* transaction is always 0 */
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_null_string,
NULL, 0 },
@ -667,8 +667,8 @@ ngx_rtmp_cmd_seek_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_memzero(&v, sizeof(v));
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
{
return NGX_ERROR;
}
@ -746,7 +746,7 @@ ngx_rtmp_cmd_postconfiguration(ngx_conf_t *cf)
cmcf = ngx_rtmp_conf_get_module_main_conf(cf, ngx_rtmp_core_module);
/* redirect disconnects to deleteStream
/* redirect disconnects to deleteStream
* to free client modules from registering
* disconnect callback */

View File

@ -97,7 +97,7 @@ typedef struct {
} ngx_rtmp_set_buflen_t;
typedef ngx_int_t (*ngx_rtmp_connect_pt)(ngx_rtmp_session_t *s,
typedef ngx_int_t (*ngx_rtmp_connect_pt)(ngx_rtmp_session_t *s,
ngx_rtmp_connect_t *v);
typedef ngx_int_t (*ngx_rtmp_disconnect_pt)(ngx_rtmp_session_t *s);
typedef ngx_int_t (*ngx_rtmp_create_stream_pt)(ngx_rtmp_session_t *s,
@ -106,13 +106,13 @@ typedef ngx_int_t (*ngx_rtmp_close_stream_pt)(ngx_rtmp_session_t *s,
ngx_rtmp_close_stream_t *v);
typedef ngx_int_t (*ngx_rtmp_delete_stream_pt)(ngx_rtmp_session_t *s,
ngx_rtmp_delete_stream_t *v);
typedef ngx_int_t (*ngx_rtmp_publish_pt)(ngx_rtmp_session_t *s,
typedef ngx_int_t (*ngx_rtmp_publish_pt)(ngx_rtmp_session_t *s,
ngx_rtmp_publish_t *v);
typedef ngx_int_t (*ngx_rtmp_play_pt)(ngx_rtmp_session_t *s,
typedef ngx_int_t (*ngx_rtmp_play_pt)(ngx_rtmp_session_t *s,
ngx_rtmp_play_t *v);
typedef ngx_int_t (*ngx_rtmp_seek_pt)(ngx_rtmp_session_t *s,
typedef ngx_int_t (*ngx_rtmp_seek_pt)(ngx_rtmp_session_t *s,
ngx_rtmp_seek_t *v);
typedef ngx_int_t (*ngx_rtmp_pause_pt)(ngx_rtmp_session_t *s,
typedef ngx_int_t (*ngx_rtmp_pause_pt)(ngx_rtmp_session_t *s,
ngx_rtmp_pause_t *v);
typedef ngx_int_t (*ngx_rtmp_stream_begin_pt)(ngx_rtmp_session_t *s,

View File

@ -17,7 +17,7 @@
static void * ngx_rtmp_codec_create_app_conf(ngx_conf_t *cf);
static char * ngx_rtmp_codec_merge_app_conf(ngx_conf_t *cf,
static char * ngx_rtmp_codec_merge_app_conf(ngx_conf_t *cf,
void *parent, void *child);
static ngx_int_t ngx_rtmp_codec_postconfiguration(ngx_conf_t *cf);
static ngx_int_t ngx_rtmp_codec_reconstruct_meta(ngx_rtmp_session_t *s);
@ -37,7 +37,7 @@ static ngx_conf_enum_t ngx_rtmp_codec_meta_slots[] = {
{ ngx_string("on"), NGX_RTMP_CODEC_META_ON },
{ ngx_string("copy"), NGX_RTMP_CODEC_META_COPY },
{ ngx_null_string, 0 }
};
};
static ngx_command_t ngx_rtmp_codec_commands[] = {
@ -81,7 +81,7 @@ ngx_module_t ngx_rtmp_codec_module = {
};
static const char *
static const char *
audio_codecs[] = {
"",
"ADPCM",
@ -103,7 +103,7 @@ audio_codecs[] = {
};
static const char *
static const char *
video_codecs[] = {
"",
"Jpeg",
@ -116,7 +116,7 @@ video_codecs[] = {
};
u_char *
u_char *
ngx_rtmp_get_audio_codec_name(ngx_uint_t id)
{
return (u_char *)(id < sizeof(audio_codecs) / sizeof(audio_codecs[0])
@ -125,7 +125,7 @@ ngx_rtmp_get_audio_codec_name(ngx_uint_t id)
}
u_char *
u_char *
ngx_rtmp_get_video_codec_name(ngx_uint_t id)
{
return (u_char *)(id < sizeof(video_codecs) / sizeof(video_codecs[0])
@ -149,7 +149,7 @@ ngx_rtmp_codec_get_next_version()
static ngx_int_t
ngx_rtmp_codec_disconnect(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_rtmp_codec_disconnect(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
ngx_rtmp_codec_ctx_t *ctx;
@ -182,7 +182,7 @@ ngx_rtmp_codec_disconnect(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_int_t
ngx_rtmp_codec_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_rtmp_codec_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
ngx_rtmp_core_srv_conf_t *cscf;
@ -191,10 +191,10 @@ ngx_rtmp_codec_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
uint8_t fmt;
ngx_uint_t idx;
u_char *p;
static ngx_uint_t sample_rates[] =
static ngx_uint_t sample_rates[] =
{ 5512, 11025, 22050, 44100 };
static ngx_uint_t aac_sample_rates[] =
static ngx_uint_t aac_sample_rates[] =
{ 96000, 88200, 64000, 48000,
44100, 32000, 24000, 22050,
16000, 12000, 11025, 8000,
@ -203,7 +203,7 @@ ngx_rtmp_codec_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
if (h->type != NGX_RTMP_MSG_AUDIO && h->type != NGX_RTMP_MSG_VIDEO) {
return NGX_OK;
}
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_codec_module);
if (ctx == NULL) {
ctx = ngx_pcalloc(s->connection->pool, sizeof(ngx_rtmp_codec_ctx_t));
@ -243,7 +243,7 @@ ngx_rtmp_codec_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
if (h->type == NGX_RTMP_MSG_AUDIO) {
if (ctx->audio_codec_id == NGX_RTMP_AUDIO_AAC) {
header = &ctx->aac_header;
if (in->buf->last - in->buf->pos > 3) {
p = in->buf->pos + 2;
@ -290,7 +290,7 @@ ngx_rtmp_codec_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
}
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"codec: aac header arrived, sample_rate=%ui",
"codec: aac header arrived, sample_rate=%ui",
ctx->aac_sample_rate);
}
} else {
@ -351,47 +351,47 @@ ngx_rtmp_codec_reconstruct_meta(ngx_rtmp_session_t *s)
ngx_string("Server"),
"NGINX RTMP (github.com/arut/nginx-rtmp-module)", 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("width"),
&v.width, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("height"),
&v.height, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("displayWidth"),
&v.width, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("displayHeight"),
&v.height, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("duration"),
&v.duration, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("framerate"),
&v.frame_rate, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("fps"),
&v.frame_rate, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("videodatarate"),
&v.video_data_rate, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("videocodecid"),
&v.video_codec_id, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("audiodatarate"),
&v.audio_data_rate, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("audiocodecid"),
&v.audio_codec_id, 0 },
@ -406,11 +406,11 @@ ngx_rtmp_codec_reconstruct_meta(ngx_rtmp_session_t *s)
static ngx_rtmp_amf_elt_t out_elts[] = {
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_null_string,
"onMetaData", 0 },
{ NGX_RTMP_AMF_OBJECT,
{ NGX_RTMP_AMF_OBJECT,
ngx_null_string,
out_inf, sizeof(out_inf) },
};
@ -438,7 +438,7 @@ ngx_rtmp_codec_reconstruct_meta(ngx_rtmp_session_t *s)
ngx_memcpy(v.profile, ctx->profile, sizeof(ctx->profile));
ngx_memcpy(v.level, ctx->level, sizeof(ctx->level));
rc = ngx_rtmp_append_amf(s, &ctx->meta, NULL, out_elts,
rc = ngx_rtmp_append_amf(s, &ctx->meta, NULL, out_elts,
sizeof(out_elts) / sizeof(out_elts[0]));
if (rc != NGX_OK || ctx->meta == NULL) {
return NGX_ERROR;
@ -448,8 +448,8 @@ ngx_rtmp_codec_reconstruct_meta(ngx_rtmp_session_t *s)
}
static ngx_int_t
ngx_rtmp_codec_copy_meta(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_int_t
ngx_rtmp_codec_copy_meta(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
ngx_rtmp_codec_ctx_t *ctx;
@ -494,8 +494,8 @@ ngx_rtmp_codec_prepare_meta(ngx_rtmp_session_t *s, uint32_t timestamp)
}
static ngx_int_t
ngx_rtmp_codec_meta_data(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_int_t
ngx_rtmp_codec_meta_data(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
ngx_rtmp_codec_app_conf_t *cacf;
@ -541,39 +541,39 @@ ngx_rtmp_codec_meta_data(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_rtmp_amf_elt_t in_inf[] = {
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("width"),
&v.width, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("height"),
&v.height, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("duration"),
&v.duration, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("framerate"),
&v.frame_rate, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("fps"),
&v.frame_rate, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("videodatarate"),
&v.video_data_rate, 0 },
{ NGX_RTMP_AMF_VARIANT,
{ NGX_RTMP_AMF_VARIANT,
ngx_string("videocodecid"),
in_video_codec_id, sizeof(in_video_codec_id) },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("audiodatarate"),
&v.audio_data_rate, 0 },
{ NGX_RTMP_AMF_VARIANT,
{ NGX_RTMP_AMF_VARIANT,
ngx_string("audiocodecid"),
in_audio_codec_id, sizeof(in_audio_codec_id) },
@ -588,11 +588,11 @@ ngx_rtmp_codec_meta_data(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_rtmp_amf_elt_t in_elts[] = {
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_null_string,
NULL, 0 },
{ NGX_RTMP_AMF_OBJECT,
{ NGX_RTMP_AMF_OBJECT,
ngx_null_string,
in_inf, sizeof(in_inf) },
};
@ -609,13 +609,13 @@ ngx_rtmp_codec_meta_data(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
/* use -1 as a sign of unchanged data;
* 0 is a valid value for uncompressed audio */
v.audio_codec_id_n = -1;
v.audio_codec_id_n = -1;
/* FFmpeg sends a string in front of actal metadata; ignore it */
skip = !(in->buf->last > in->buf->pos
&& *in->buf->pos == NGX_RTMP_AMF_STRING);
if (ngx_rtmp_receive_amf(s, in, in_elts + skip,
sizeof(in_elts) / sizeof(in_elts[0]) - skip))
if (ngx_rtmp_receive_amf(s, in, in_elts + skip,
sizeof(in_elts) / sizeof(in_elts[0]) - skip))
{
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
"codec: error parsing data frame");
@ -640,9 +640,9 @@ ngx_rtmp_codec_meta_data(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
"width=%ui height=%ui duration=%ui frame_rate=%ui "
"video=%s (%ui) audio=%s (%ui)",
ctx->width, ctx->height, ctx->duration, ctx->frame_rate,
ngx_rtmp_get_video_codec_name(ctx->video_codec_id),
ngx_rtmp_get_video_codec_name(ctx->video_codec_id),
ctx->video_codec_id,
ngx_rtmp_get_audio_codec_name(ctx->audio_codec_id),
ngx_rtmp_get_audio_codec_name(ctx->audio_codec_id),
ctx->audio_codec_id);
switch (cacf->meta) {

View File

@ -14,7 +14,7 @@
static char *ngx_rtmp_control(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
static void * ngx_rtmp_control_create_loc_conf(ngx_conf_t *cf);
static char * ngx_rtmp_control_merge_loc_conf(ngx_conf_t *cf,
static char * ngx_rtmp_control_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
@ -46,7 +46,7 @@ static ngx_conf_bitmask_t ngx_rtmp_control_masks[] = {
{ ngx_string("record"), NGX_RTMP_CONTROL_RECORD },
{ ngx_string("drop"), NGX_RTMP_CONTROL_DROP },
{ ngx_null_string, 0 }
};
};
static ngx_command_t ngx_rtmp_control_commands[] = {
@ -133,7 +133,7 @@ ngx_rtmp_control_parse_core(ngx_http_request_t *r,
ngx_rtmp_core_srv_conf_t **pcscf;
ngx_rtmp_core_app_conf_t **pcacf;
core->cmcf = ngx_rtmp_core_main_conf;
if (core->cmcf == NULL) {
return "Missing main RTMP conf";
@ -199,7 +199,7 @@ ngx_rtmp_control_parse_live(ngx_http_request_t *r,
/* find live stream by name */
for (live->ls = live->lacf->streams[ngx_hash_key(name.data, name.len) %
live->lacf->nbuckets];
live->ls; live->ls = live->ls->next)
live->ls; live->ls = live->ls->next)
{
len = ngx_strlen(live->ls->name);
@ -319,7 +319,7 @@ ngx_rtmp_control_record(ngx_http_request_t *r, ngx_str_t *method)
b->last = ngx_cpymem(b->pos, path.data, path.len);
b->last_buf = 1;
ngx_http_send_header(r);
return ngx_http_output_filter(r, &cl);

View File

@ -30,7 +30,7 @@ ngx_rtmp_core_main_conf_t *ngx_rtmp_core_main_conf;
static ngx_conf_deprecated_t ngx_conf_deprecated_so_keepalive = {
ngx_conf_deprecated, "so_keepalive",
ngx_conf_deprecated, "so_keepalive",
"so_keepalive\" parameter of the \"listen"
};
@ -260,10 +260,10 @@ ngx_rtmp_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_value(conf->max_streams, prev->max_streams, 32);
ngx_conf_merge_value(conf->chunk_size, prev->chunk_size, 4096);
ngx_conf_merge_uint_value(conf->ack_window, prev->ack_window, 5000000);
ngx_conf_merge_size_value(conf->max_message, prev->max_message,
ngx_conf_merge_size_value(conf->max_message, prev->max_message,
1 * 1024 * 1024);
ngx_conf_merge_size_value(conf->out_queue, prev->out_queue, 256);
ngx_conf_merge_size_value(conf->out_cork, prev->out_cork,
ngx_conf_merge_size_value(conf->out_cork, prev->out_cork,
conf->out_queue / 8);
ngx_conf_merge_value(conf->play_time_fix, prev->play_time_fix, 1);
ngx_conf_merge_value(conf->publish_time_fix, prev->publish_time_fix, 1);
@ -437,7 +437,7 @@ ngx_rtmp_core_application(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
module = ngx_modules[i]->ctx;
if (module->create_app_conf) {
ctx->app_conf[ngx_modules[i]->ctx_index] =
ctx->app_conf[ngx_modules[i]->ctx_index] =
module->create_app_conf(cf);
if (ctx->app_conf[ngx_modules[i]->ctx_index] == NULL) {
return NGX_CONF_ERROR;

View File

@ -246,7 +246,7 @@ ngx_rtmp_eval_streams(ngx_str_t *in)
}
if (*path == (u_char) '&') {
path++;
v = ngx_atoi(path, in->data + in->len - path);
if (v == NGX_ERROR) {
@ -270,7 +270,7 @@ ngx_rtmp_eval_streams(ngx_str_t *in)
}
dup2(src, dst);
if (close_src) {
ngx_close_file(src);
}

View File

@ -29,7 +29,7 @@ static ngx_int_t ngx_rtmp_exec_postconfiguration(ngx_conf_t *cf);
static void * ngx_rtmp_exec_create_main_conf(ngx_conf_t *cf);
static char * ngx_rtmp_exec_init_main_conf(ngx_conf_t *cf, void *conf);
static void * ngx_rtmp_exec_create_app_conf(ngx_conf_t *cf);
static char * ngx_rtmp_exec_merge_app_conf(ngx_conf_t *cf,
static char * ngx_rtmp_exec_merge_app_conf(ngx_conf_t *cf,
void *parent, void *child);
/*static char * ngx_rtmp_exec_block(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);*/
@ -113,7 +113,7 @@ struct ngx_rtmp_exec_pull_ctx_s {
typedef struct {
ngx_int_t active;
ngx_array_t conf[NGX_RTMP_EXEC_MAX];
ngx_array_t conf[NGX_RTMP_EXEC_MAX];
/* ngx_rtmp_exec_conf_t */
ngx_flag_t respawn;
ngx_flag_t options;
@ -153,7 +153,7 @@ static ngx_command_t ngx_rtmp_exec_commands[] = {
NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_1MORE,
ngx_rtmp_exec_conf,
NGX_RTMP_APP_CONF_OFFSET,
offsetof(ngx_rtmp_exec_app_conf_t, conf) +
offsetof(ngx_rtmp_exec_app_conf_t, conf) +
NGX_RTMP_EXEC_PUSH * sizeof(ngx_array_t),
NULL },
@ -161,7 +161,7 @@ static ngx_command_t ngx_rtmp_exec_commands[] = {
NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_1MORE,
ngx_rtmp_exec_conf,
NGX_RTMP_APP_CONF_OFFSET,
offsetof(ngx_rtmp_exec_app_conf_t, conf) +
offsetof(ngx_rtmp_exec_app_conf_t, conf) +
NGX_RTMP_EXEC_PUSH * sizeof(ngx_array_t),
NULL },
@ -213,7 +213,7 @@ static ngx_command_t ngx_rtmp_exec_commands[] = {
offsetof(ngx_rtmp_exec_app_conf_t, conf) +
NGX_RTMP_EXEC_RECORD_DONE * sizeof(ngx_array_t),
NULL },
{ ngx_string("exec_static"),
NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_1MORE,
ngx_rtmp_exec_conf,
@ -406,7 +406,7 @@ ngx_rtmp_exec_create_main_conf(ngx_conf_t *cf)
emcf->respawn_timeout = NGX_CONF_UNSET_MSEC;
emcf->kill_signal = NGX_CONF_UNSET;
if (ngx_array_init(&emcf->static_conf, cf->pool, 1,
if (ngx_array_init(&emcf->static_conf, cf->pool, 1,
sizeof(ngx_rtmp_exec_conf_t)) != NGX_OK)
{
return NULL;
@ -569,7 +569,7 @@ ngx_rtmp_exec_init_process(ngx_cycle_t *cycle)
/* FreeBSD note:
* When worker is restarted, child process (ffmpeg) will
* not be terminated if it's connected to another
* not be terminated if it's connected to another
* (still alive) worker. That leads to starting
* another instance of exec_static process.
* Need to kill previously started processes.
@ -592,14 +592,14 @@ ngx_rtmp_exec_init_process(ngx_cycle_t *cycle)
#if !(NGX_WIN32)
static void
static void
ngx_rtmp_exec_respawn(ngx_event_t *ev)
{
ngx_rtmp_exec_run((ngx_rtmp_exec_t *) ev->data);
}
static void
static void
ngx_rtmp_exec_child_dead(ngx_event_t *ev)
{
ngx_connection_t *dummy_conn = ev->data;
@ -717,7 +717,7 @@ ngx_rtmp_exec_run(ngx_rtmp_exec_t *e)
}
if (ret == -1) {
close(pipefd[0]);
close(pipefd[1]);
@ -770,7 +770,7 @@ ngx_rtmp_exec_run(ngx_rtmp_exec_t *e)
close(fd);
}
fd = open("/dev/null", O_RDWR);
fd = open("/dev/null", O_RDWR);
dup2(fd, STDIN_FILENO);
dup2(fd, STDOUT_FILENO);
@ -792,7 +792,7 @@ ngx_rtmp_exec_run(ngx_rtmp_exec_t *e)
} else {
ngx_rtmp_eval(e->eval_ctx, arg_in, e->eval, &a, e->log);
}
if (ngx_rtmp_eval_streams(&a) != NGX_DONE) {
continue;
}
@ -817,7 +817,7 @@ ngx_rtmp_exec_run(ngx_rtmp_exec_t *e)
#endif
if (execvp((char *) ec->cmd.data, args) == -1) {
char *msg;
char *msg;
msg = strerror(errno);
@ -839,7 +839,7 @@ ngx_rtmp_exec_run(ngx_rtmp_exec_t *e)
}
if (pipefd[0] != -1) {
e->active = 1;
e->pid = pid;
e->pipefd = pipefd[0];
@ -865,7 +865,7 @@ ngx_rtmp_exec_run(ngx_rtmp_exec_t *e)
}
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, e->log, 0,
"exec: child '%V' started pid=%i",
"exec: child '%V' started pid=%i",
&ec->cmd, (ngx_int_t) pid);
break;
}
@ -885,7 +885,7 @@ ngx_rtmp_exec_init_ctx(ngx_rtmp_session_t *s, u_char name[NGX_RTMP_MAX_NAME],
ngx_rtmp_exec_conf_t *ec;
ngx_rtmp_exec_app_conf_t *eacf;
ngx_rtmp_exec_main_conf_t *emcf;
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_exec_module);
if (ctx != NULL) {
@ -1240,7 +1240,7 @@ ngx_rtmp_exec_close_stream(ngx_rtmp_session_t *s, ngx_rtmp_close_stream_t *v)
}
ctx->flags = 0;
if (ctx->push_exec.nelts > 0) {
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"exec: delete %uz push command(s)",
@ -1381,7 +1381,7 @@ ngx_rtmp_exec_conf(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
if (s == NULL) {
return NGX_CONF_ERROR;
}
v.data += 5;
v.len -= 5;

View File

@ -13,7 +13,7 @@
static ngx_int_t ngx_rtmp_flv_postconfiguration(ngx_conf_t *cf);
static void ngx_rtmp_flv_read_meta(ngx_rtmp_session_t *s, ngx_file_t *f);
static ngx_int_t ngx_rtmp_flv_timestamp_to_offset(ngx_rtmp_session_t *s,
static ngx_int_t ngx_rtmp_flv_timestamp_to_offset(ngx_rtmp_session_t *s,
ngx_file_t *f, ngx_int_t timestamp);
static ngx_int_t ngx_rtmp_flv_init(ngx_rtmp_session_t *s, ngx_file_t *f,
ngx_int_t aindex, ngx_int_t vindex);
@ -122,29 +122,29 @@ ngx_rtmp_flv_init_index(ngx_rtmp_session_t *s, ngx_chain_t *in)
static ngx_rtmp_amf_elt_t in_keyframes[] = {
{ NGX_RTMP_AMF_ARRAY | NGX_RTMP_AMF_CONTEXT,
{ NGX_RTMP_AMF_ARRAY | NGX_RTMP_AMF_CONTEXT,
ngx_string("filepositions"),
&filepositions_ctx, 0 },
{ NGX_RTMP_AMF_ARRAY | NGX_RTMP_AMF_CONTEXT,
{ NGX_RTMP_AMF_ARRAY | NGX_RTMP_AMF_CONTEXT,
ngx_string("times"),
&times_ctx, 0 }
};
static ngx_rtmp_amf_elt_t in_inf[] = {
{ NGX_RTMP_AMF_OBJECT,
{ NGX_RTMP_AMF_OBJECT,
ngx_string("keyframes"),
in_keyframes, sizeof(in_keyframes) }
};
static ngx_rtmp_amf_elt_t in_elts[] = {
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_null_string,
NULL, 0 },
{ NGX_RTMP_AMF_OBJECT,
{ NGX_RTMP_AMF_OBJECT,
ngx_null_string,
in_inf, sizeof(in_inf) },
};
@ -161,15 +161,15 @@ ngx_rtmp_flv_init_index(ngx_rtmp_session_t *s, ngx_chain_t *in)
ngx_memzero(&filepositions_ctx, sizeof(filepositions_ctx));
ngx_memzero(&times_ctx, sizeof(times_ctx));
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
{
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
"flv: init index error");
return NGX_OK;
}
if (filepositions_ctx.link && ngx_rtmp_flv_fill_index(&filepositions_ctx,
if (filepositions_ctx.link && ngx_rtmp_flv_fill_index(&filepositions_ctx,
&ctx->filepositions)
!= NGX_OK)
{
@ -211,7 +211,7 @@ ngx_rtmp_flv_index_value(void *src)
static ngx_int_t
ngx_rtmp_flv_timestamp_to_offset(ngx_rtmp_session_t *s, ngx_file_t *f,
ngx_rtmp_flv_timestamp_to_offset(ngx_rtmp_session_t *s, ngx_file_t *f,
ngx_int_t timestamp)
{
ngx_rtmp_flv_ctx_t *ctx;
@ -226,7 +226,7 @@ ngx_rtmp_flv_timestamp_to_offset(ngx_rtmp_session_t *s, ngx_file_t *f,
}
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"flv: lookup index start timestamp=%i",
"flv: lookup index start timestamp=%i",
timestamp);
if (ctx->meta_read == 0) {
@ -235,7 +235,7 @@ ngx_rtmp_flv_timestamp_to_offset(ngx_rtmp_session_t *s, ngx_file_t *f,
}
if (timestamp <= 0 || ctx->filepositions.nelts == 0
|| ctx->times.nelts == 0)
|| ctx->times.nelts == 0)
{
goto rewind;
}
@ -265,7 +265,7 @@ ngx_rtmp_flv_timestamp_to_offset(ngx_rtmp_session_t *s, ngx_file_t *f,
index * 9 + 1) * 1000;
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"flv: lookup times index=%ui value=%ui",
"flv: lookup times index=%ui value=%ui",
index, (ngx_uint_t) v);
if (timestamp < v) {
@ -275,7 +275,7 @@ ngx_rtmp_flv_timestamp_to_offset(ngx_rtmp_session_t *s, ngx_file_t *f,
if (index >= ctx->filepositions.nelts) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
"flv: index out of bounds: %ui>=%ui",
"flv: index out of bounds: %ui>=%ui",
index, ctx->filepositions.nelts);
goto rewind;
}
@ -295,16 +295,16 @@ ngx_rtmp_flv_timestamp_to_offset(ngx_rtmp_session_t *s, ngx_file_t *f,
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",
"flv: lookup index timestamp=%i offset=%ui",
timestamp, ret);
return ret;
rewind:
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"flv: lookup index timestamp=%i offset=begin",
"flv: lookup index timestamp=%i offset=begin",
timestamp);
return NGX_RTMP_FLV_DATA_OFFSET;
}
@ -330,9 +330,9 @@ ngx_rtmp_flv_read_meta(ngx_rtmp_session_t *s, ngx_file_t *f)
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"flv: read meta");
/* read tag header */
n = ngx_read_file(f, ngx_rtmp_flv_header, sizeof(ngx_rtmp_flv_header),
n = ngx_read_file(f, ngx_rtmp_flv_header, sizeof(ngx_rtmp_flv_header),
NGX_RTMP_FLV_DATA_OFFSET);
if (n != sizeof(ngx_rtmp_flv_header)) {
@ -367,7 +367,7 @@ ngx_rtmp_flv_read_meta(ngx_rtmp_session_t *s, ngx_file_t *f)
/* read metadata */
n = ngx_read_file(f, ngx_rtmp_flv_buffer, size,
sizeof(ngx_rtmp_flv_header) +
sizeof(ngx_rtmp_flv_header) +
NGX_RTMP_FLV_DATA_OFFSET);
if (n != (ssize_t) size) {
@ -426,7 +426,7 @@ ngx_rtmp_flv_send(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t *ts)
"flv: read tag at offset=%i", ctx->offset);
/* read tag header */
n = ngx_read_file(f, ngx_rtmp_flv_header,
n = ngx_read_file(f, ngx_rtmp_flv_header,
sizeof(ngx_rtmp_flv_header), ctx->offset);
if (n != sizeof(ngx_rtmp_flv_header)) {
@ -472,7 +472,7 @@ ngx_rtmp_flv_send(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t *ts)
ngx_log_debug4(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"flv: read tag type=%i size=%uD timestamp=%uD "
"last_timestamp=%uD",
"last_timestamp=%uD",
(ngx_int_t) h.type,size, h.timestamp, last_timestamp);
lh = h;
@ -480,13 +480,13 @@ ngx_rtmp_flv_send(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t *ts)
if (size > sizeof(ngx_rtmp_flv_buffer)) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
"flv: too big message: %D>%uz", size,
"flv: too big message: %D>%uz", size,
sizeof(ngx_rtmp_flv_buffer));
goto next;
}
/* read tag body */
n = ngx_read_file(f, ngx_rtmp_flv_buffer, size,
n = ngx_read_file(f, ngx_rtmp_flv_buffer, size,
ctx->offset - size - 4);
if (n != (ssize_t) size) {
@ -506,7 +506,7 @@ ngx_rtmp_flv_send(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t *ts)
/* output chain */
out = ngx_rtmp_append_shared_bufs(cscf, NULL, &in);
ngx_rtmp_prepare_message(s, &h, ctx->msg_mask & (1 << h.type) ?
ngx_rtmp_prepare_message(s, &h, ctx->msg_mask & (1 << h.type) ?
&lh : NULL, out);
rc = ngx_rtmp_send_message(s, out, 0);
ngx_rtmp_free_shared_chain(cscf, out);
@ -654,7 +654,7 @@ ngx_rtmp_flv_postconfiguration(ngx_conf_t *cf)
}
fmt = ngx_pcalloc(cf->pool, sizeof(ngx_rtmp_play_fmt_t));
if (fmt == NULL) {
return NGX_ERROR;
}

View File

@ -25,7 +25,7 @@ ngx_rtmp_bandwidth_t ngx_rtmp_bw_in;
#ifdef NGX_DEBUG
char*
ngx_rtmp_message_type(uint8_t type)
ngx_rtmp_message_type(uint8_t type)
{
static char* types[] = {
"?",
@ -60,7 +60,7 @@ ngx_rtmp_message_type(uint8_t type)
char*
ngx_rtmp_user_message_type(uint16_t evt)
ngx_rtmp_user_message_type(uint16_t evt)
{
static char* evts[] = {
"stream_begin",
@ -99,14 +99,14 @@ ngx_rtmp_cycle(ngx_rtmp_session_t *s)
static ngx_chain_t *
ngx_rtmp_alloc_in_buf(ngx_rtmp_session_t *s)
ngx_rtmp_alloc_in_buf(ngx_rtmp_session_t *s)
{
ngx_chain_t *cl;
ngx_buf_t *b;
size_t size;
if ((cl = ngx_alloc_chain_link(s->in_pool)) == NULL
|| (cl->buf = ngx_calloc_buf(s->in_pool)) == NULL)
|| (cl->buf = ngx_calloc_buf(s->in_pool)) == NULL)
{
return NULL;
}
@ -144,7 +144,7 @@ ngx_rtmp_reset_ping(ngx_rtmp_session_t *s)
}
static void
static void
ngx_rtmp_ping(ngx_event_t *pev)
{
ngx_connection_t *c;
@ -163,14 +163,14 @@ ngx_rtmp_ping(ngx_event_t *pev)
}
if (s->ping_active) {
ngx_log_error(NGX_LOG_INFO, c->log, 0,
ngx_log_error(NGX_LOG_INFO, c->log, 0,
"ping: unresponded");
ngx_rtmp_finalize_session(s);
return;
}
if (cscf->busy) {
ngx_log_error(NGX_LOG_INFO, c->log, 0,
ngx_log_error(NGX_LOG_INFO, c->log, 0,
"ping: not busy between pings");
ngx_rtmp_finalize_session(s);
return;
@ -247,7 +247,7 @@ ngx_rtmp_recv(ngx_event_t *rev)
ngx_rtmp_finalize_set_chunk_size(s);
}
} else {
} else {
if (old_pos) {
b->pos = b->last = b->start;
@ -273,7 +273,7 @@ ngx_rtmp_recv(ngx_event_t *rev)
s->in_bytes += n;
if (s->ack_size && s->in_bytes - s->in_last_ack >= s->ack_size) {
s->in_last_ack = s->in_bytes;
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, c->log, 0,
@ -348,7 +348,7 @@ ngx_rtmp_recv(ngx_event_t *rev)
if (fmt <= 2 ) {
if (b->last - p < 3)
continue;
/* timestamp:
/* timestamp:
* big-endian 3b -> little-endian 4b */
pp = (u_char*)&timestamp;
pp[2] = *p++;
@ -362,7 +362,7 @@ ngx_rtmp_recv(ngx_event_t *rev)
if (b->last - p < 4)
continue;
/* size:
* big-endian 3b -> little-endian 4b
* big-endian 3b -> little-endian 4b
* type:
* 1b -> 1b*/
pp = (u_char*)&h->mlen;
@ -432,7 +432,7 @@ ngx_rtmp_recv(ngx_event_t *rev)
size = b->last - b->pos;
fsize = h->mlen - st->len;
if (size < ngx_min(fsize, s->in_chunk_size))
if (size < ngx_min(fsize, s->in_chunk_size))
continue;
/* buffer is ready */
@ -495,7 +495,7 @@ ngx_rtmp_send(ngx_event_t *wev)
}
if (wev->timedout) {
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
"client timed out");
c->timedout = 1;
ngx_rtmp_finalize_session(s);
@ -555,8 +555,8 @@ ngx_rtmp_send(ngx_event_t *wev)
}
void
ngx_rtmp_prepare_message(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
void
ngx_rtmp_prepare_message(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_rtmp_header_t *lh, ngx_chain_t *out)
{
ngx_chain_t *l;
@ -582,7 +582,7 @@ ngx_rtmp_prepare_message(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
/* detect packet size */
mlen = 0;
nbufs = 0;
nbufs = 0;
for(l = out; l; l = l->next) {
mlen += (l->buf->last - l->buf->pos);
++nbufs;
@ -681,7 +681,7 @@ ngx_rtmp_prepare_message(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
*p++ = pp[1];
*p++ = pp[0];
/* This CONTRADICTS the standard
/* This CONTRADICTS the standard
* but that's the way flash client
* wants data to be encoded;
* ffmpeg complains */
@ -700,7 +700,7 @@ ngx_rtmp_prepare_message(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_int_t
ngx_rtmp_send_message(ngx_rtmp_session_t *s, ngx_chain_t *out,
ngx_rtmp_send_message(ngx_rtmp_session_t *s, ngx_chain_t *out,
ngx_uint_t priority)
{
ngx_uint_t nmsg;
@ -711,7 +711,7 @@ ngx_rtmp_send_message(ngx_rtmp_session_t *s, ngx_chain_t *out,
priority = 3;
}
/* drop packet?
/* drop packet?
* Note we always leave 1 slot free */
if (nmsg + priority * s->out_queue / 4 >= s->out_queue) {
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
@ -742,7 +742,7 @@ ngx_rtmp_send_message(ngx_rtmp_session_t *s, ngx_chain_t *out,
}
ngx_int_t
ngx_int_t
ngx_rtmp_receive_message(ngx_rtmp_session_t *s,
ngx_rtmp_header_t *h, ngx_chain_t *in)
{
@ -758,14 +758,14 @@ ngx_rtmp_receive_message(ngx_rtmp_session_t *s,
int nbufs;
ngx_chain_t *ch;
for(nbufs = 1, ch = in;
ch->next;
for(nbufs = 1, ch = in;
ch->next;
ch = ch->next, ++nbufs);
ngx_log_debug7(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"RTMP recv %s (%d) csid=%D timestamp=%D "
"mlen=%D msid=%D nbufs=%d",
ngx_rtmp_message_type(h->type), (int)h->type,
ngx_rtmp_message_type(h->type), (int)h->type,
h->csid, h->timestamp, h->mlen, h->msid, nbufs);
}
#endif
@ -788,7 +788,7 @@ ngx_rtmp_receive_message(ngx_rtmp_session_t *s,
}
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"calling handler %d", n);
switch ((*evh)(s, h, in)) {
case NGX_ERROR:
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
@ -803,7 +803,7 @@ ngx_rtmp_receive_message(ngx_rtmp_session_t *s,
}
ngx_int_t
ngx_int_t
ngx_rtmp_set_chunk_size(ngx_rtmp_session_t *s, ngx_uint_t size)
{
ngx_rtmp_core_srv_conf_t *cscf;
@ -848,7 +848,7 @@ ngx_rtmp_set_chunk_size(ngx_rtmp_session_t *s, ngx_uint_t size)
bo = lo->buf;
if (bo->end - bo->last >= bi->last - bi->pos) {
bo->last = ngx_cpymem(bo->last, bi->pos,
bo->last = ngx_cpymem(bo->last, bi->pos,
bi->last - bi->pos);
li = li->next;
if (li == fli) {
@ -859,7 +859,7 @@ ngx_rtmp_set_chunk_size(ngx_rtmp_session_t *s, ngx_uint_t size)
continue;
}
bi->pos += (ngx_cpymem(bo->last, bi->pos,
bi->pos += (ngx_cpymem(bo->last, bi->pos,
bo->end - bo->last) - bo->last);
lo->next = ngx_rtmp_alloc_in_buf(s);
lo = lo->next;
@ -874,7 +874,7 @@ ngx_rtmp_set_chunk_size(ngx_rtmp_session_t *s, ngx_uint_t size)
}
static ngx_int_t
static ngx_int_t
ngx_rtmp_finalize_set_chunk_size(ngx_rtmp_session_t *s)
{
if (s->in_chunk_size_changing && s->in_old_pool) {

View File

@ -34,27 +34,27 @@ static void ngx_rtmp_handshake_done(ngx_rtmp_session_t *s);
/* Handshake keys */
static u_char
static u_char
ngx_rtmp_server_key[] = {
'G', 'e', 'n', 'u', 'i', 'n', 'e', ' ', 'A', 'd', 'o', 'b', 'e', ' ',
'F', 'l', 'a', 's', 'h', ' ', 'M', 'e', 'd', 'i', 'a', ' ',
'S', 'e', 'r', 'v', 'e', 'r', ' ',
'S', 'e', 'r', 'v', 'e', 'r', ' ',
'0', '0', '1',
0xF0, 0xEE, 0xC2, 0x4A, 0x80, 0x68, 0xBE, 0xE8, 0x2E, 0x00, 0xD0, 0xD1,
0x02, 0x9E, 0x7E, 0x57, 0x6E, 0xEC, 0x5D, 0x2D, 0x29, 0x80, 0x6F, 0xAB,
0xF0, 0xEE, 0xC2, 0x4A, 0x80, 0x68, 0xBE, 0xE8, 0x2E, 0x00, 0xD0, 0xD1,
0x02, 0x9E, 0x7E, 0x57, 0x6E, 0xEC, 0x5D, 0x2D, 0x29, 0x80, 0x6F, 0xAB,
0x93, 0xB8, 0xE6, 0x36, 0xCF, 0xEB, 0x31, 0xAE
};
static u_char
static u_char
ngx_rtmp_client_key[] = {
'G', 'e', 'n', 'u', 'i', 'n', 'e', ' ', 'A', 'd', 'o', 'b', 'e', ' ',
'F', 'l', 'a', 's', 'h', ' ', 'P', 'l', 'a', 'y', 'e', 'r', ' ',
'F', 'l', 'a', 's', 'h', ' ', 'P', 'l', 'a', 'y', 'e', 'r', ' ',
'0', '0', '1',
0xF0, 0xEE, 0xC2, 0x4A, 0x80, 0x68, 0xBE, 0xE8, 0x2E, 0x00, 0xD0, 0xD1,
0x02, 0x9E, 0x7E, 0x57, 0x6E, 0xEC, 0x5D, 0x2D, 0x29, 0x80, 0x6F, 0xAB,
0xF0, 0xEE, 0xC2, 0x4A, 0x80, 0x68, 0xBE, 0xE8, 0x2E, 0x00, 0xD0, 0xD1,
0x02, 0x9E, 0x7E, 0x57, 0x6E, 0xEC, 0x5D, 0x2D, 0x29, 0x80, 0x6F, 0xAB,
0x93, 0xB8, 0xE6, 0x36, 0xCF, 0xEB, 0x31, 0xAE
};
@ -71,7 +71,7 @@ ngx_rtmp_client_version[4] = {
};
#define NGX_RTMP_HANDSHAKE_KEYLEN SHA256_DIGEST_LENGTH
#define NGX_RTMP_HANDSHAKE_KEYLEN SHA256_DIGEST_LENGTH
#define NGX_RTMP_HANDSHAKE_BUFSIZE 1537
@ -89,7 +89,7 @@ ngx_rtmp_client_version[4] = {
#define NGX_RTMP_HANDSHAKE_CLIENT_DONE 10
static ngx_str_t ngx_rtmp_server_full_key
static ngx_str_t ngx_rtmp_server_full_key
= { sizeof(ngx_rtmp_server_key), ngx_rtmp_server_key };
static ngx_str_t ngx_rtmp_server_partial_key
= { 36, ngx_rtmp_server_key };
@ -101,7 +101,7 @@ static ngx_str_t ngx_rtmp_client_partial_key
static ngx_int_t
ngx_rtmp_make_digest(ngx_str_t *key, ngx_buf_t *src,
ngx_rtmp_make_digest(ngx_str_t *key, ngx_buf_t *src,
u_char *skip, u_char *dst, ngx_log_t *log)
{
static HMAC_CTX hmac;
@ -120,7 +120,7 @@ ngx_rtmp_make_digest(ngx_str_t *key, ngx_buf_t *src,
HMAC_Update(&hmac, src->pos, skip - src->pos);
}
if (src->last != skip + NGX_RTMP_HANDSHAKE_KEYLEN) {
HMAC_Update(&hmac, skip + NGX_RTMP_HANDSHAKE_KEYLEN,
HMAC_Update(&hmac, skip + NGX_RTMP_HANDSHAKE_KEYLEN,
src->last - skip - NGX_RTMP_HANDSHAKE_KEYLEN);
}
} else {
@ -160,7 +160,7 @@ ngx_rtmp_find_digest(ngx_buf_t *b, ngx_str_t *key, size_t base, ngx_log_t *log)
static ngx_int_t
ngx_rtmp_write_digest(ngx_buf_t *b, ngx_str_t *key, size_t base,
ngx_rtmp_write_digest(ngx_buf_t *b, ngx_str_t *key, size_t base,
ngx_log_t *log)
{
size_t n, offs;
@ -270,7 +270,7 @@ ngx_rtmp_handshake_create_challenge(ngx_rtmp_session_t *s,
static ngx_int_t
ngx_rtmp_handshake_parse_challenge(ngx_rtmp_session_t *s,
ngx_rtmp_handshake_parse_challenge(ngx_rtmp_session_t *s,
ngx_str_t *peer_key, ngx_str_t *key)
{
ngx_buf_t *b;
@ -279,8 +279,8 @@ ngx_rtmp_handshake_parse_challenge(ngx_rtmp_session_t *s,
b = s->hs_buf;
if (*b->pos != '\x03') {
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
"handshake: unexpected RTMP version: %i",
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
"handshake: unexpected RTMP version: %i",
(ngx_int_t)*b->pos);
return NGX_ERROR;
}
@ -304,7 +304,7 @@ ngx_rtmp_handshake_parse_challenge(ngx_rtmp_session_t *s,
offs = ngx_rtmp_find_digest(b, peer_key, 8, s->connection->log);
}
if (offs == NGX_ERROR) {
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
"handshake: digest not found");
s->hs_old = 1;
return NGX_OK;
@ -314,7 +314,7 @@ ngx_rtmp_handshake_parse_challenge(ngx_rtmp_session_t *s,
b->pos += offs;
b->last = b->pos + NGX_RTMP_HANDSHAKE_KEYLEN;
s->hs_digest = ngx_palloc(s->connection->pool, NGX_RTMP_HANDSHAKE_KEYLEN);
if (ngx_rtmp_make_digest(key, b, NULL, s->hs_digest, s->connection->log)
if (ngx_rtmp_make_digest(key, b, NULL, s->hs_digest, s->connection->log)
!= NGX_OK)
{
return NGX_ERROR;
@ -354,8 +354,8 @@ ngx_rtmp_handshake_done(ngx_rtmp_session_t *s)
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"handshake: done");
if (ngx_rtmp_fire_event(s, NGX_RTMP_HANDSHAKE_DONE,
NULL, NULL) != NGX_OK)
if (ngx_rtmp_fire_event(s, NGX_RTMP_HANDSHAKE_DONE,
NULL, NULL) != NGX_OK)
{
ngx_rtmp_finalize_session(s);
return;
@ -381,7 +381,7 @@ ngx_rtmp_handshake_recv(ngx_event_t *rev)
}
if (rev->timedout) {
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
"handshake: recv: client timed out");
c->timedout = 1;
ngx_rtmp_finalize_session(s);
@ -423,25 +423,25 @@ ngx_rtmp_handshake_recv(ngx_event_t *rev)
switch (s->hs_stage) {
case NGX_RTMP_HANDSHAKE_SERVER_SEND_CHALLENGE:
if (ngx_rtmp_handshake_parse_challenge(s,
if (ngx_rtmp_handshake_parse_challenge(s,
&ngx_rtmp_client_partial_key,
&ngx_rtmp_server_full_key) != NGX_OK)
{
ngx_log_error(NGX_LOG_INFO, c->log, 0,
ngx_log_error(NGX_LOG_INFO, c->log, 0,
"handshake: error parsing challenge");
ngx_rtmp_finalize_session(s);
return;
}
if (s->hs_old) {
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"handshake: old-style challenge");
s->hs_buf->pos = s->hs_buf->start;
s->hs_buf->last = s->hs_buf->end;
} else if (ngx_rtmp_handshake_create_challenge(s,
ngx_rtmp_server_version,
&ngx_rtmp_server_partial_key) != NGX_OK)
&ngx_rtmp_server_partial_key) != NGX_OK)
{
ngx_log_error(NGX_LOG_INFO, c->log, 0,
ngx_log_error(NGX_LOG_INFO, c->log, 0,
"handshake: error creating challenge");
ngx_rtmp_finalize_session(s);
return;
@ -454,11 +454,11 @@ ngx_rtmp_handshake_recv(ngx_event_t *rev)
break;
case NGX_RTMP_HANDSHAKE_CLIENT_RECV_RESPONSE:
if (ngx_rtmp_handshake_parse_challenge(s,
if (ngx_rtmp_handshake_parse_challenge(s,
&ngx_rtmp_server_partial_key,
&ngx_rtmp_client_full_key) != NGX_OK)
{
ngx_log_error(NGX_LOG_INFO, c->log, 0,
ngx_log_error(NGX_LOG_INFO, c->log, 0,
"handshake: error parsing challenge");
ngx_rtmp_finalize_session(s);
return;
@ -469,7 +469,7 @@ ngx_rtmp_handshake_recv(ngx_event_t *rev)
case NGX_RTMP_HANDSHAKE_CLIENT_SEND_RESPONSE:
if (ngx_rtmp_handshake_create_response(s) != NGX_OK) {
ngx_log_error(NGX_LOG_INFO, c->log, 0,
ngx_log_error(NGX_LOG_INFO, c->log, 0,
"handshake: response error");
ngx_rtmp_finalize_session(s);
return;
@ -496,7 +496,7 @@ ngx_rtmp_handshake_send(ngx_event_t *wev)
}
if (wev->timedout) {
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
"handshake: send: client timed out");
c->timedout = 1;
ngx_rtmp_finalize_session(s);
@ -539,12 +539,12 @@ ngx_rtmp_handshake_send(ngx_event_t *wev)
switch (s->hs_stage) {
case NGX_RTMP_HANDSHAKE_SERVER_SEND_RESPONSE:
if (s->hs_old) {
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"handshake: old-style response");
s->hs_buf->pos = s->hs_buf->start + 1;
s->hs_buf->last = s->hs_buf->end;
} else if (ngx_rtmp_handshake_create_response(s) != NGX_OK) {
ngx_log_error(NGX_LOG_INFO, c->log, 0,
ngx_log_error(NGX_LOG_INFO, c->log, 0,
"handshake: response error");
ngx_rtmp_finalize_session(s);
return;
@ -603,9 +603,9 @@ ngx_rtmp_client_handshake(ngx_rtmp_session_t *s, unsigned async)
s->hs_buf = ngx_rtmp_alloc_handshake_buffer(s);
s->hs_stage = NGX_RTMP_HANDSHAKE_CLIENT_SEND_CHALLENGE;
if (ngx_rtmp_handshake_create_challenge(s,
if (ngx_rtmp_handshake_create_challenge(s,
ngx_rtmp_client_version,
&ngx_rtmp_client_partial_key) != NGX_OK)
&ngx_rtmp_client_partial_key) != NGX_OK)
{
ngx_rtmp_finalize_session(s);
return;

View File

@ -141,7 +141,7 @@ ngx_rtmp_init_session(ngx_connection_t *c, ngx_rtmp_addr_conf_t *addr_conf)
ngx_rtmp_core_srv_conf_t *cscf;
ngx_rtmp_error_log_ctx_t *ctx;
s = ngx_pcalloc(c->pool, sizeof(ngx_rtmp_session_t) +
s = ngx_pcalloc(c->pool, sizeof(ngx_rtmp_session_t) +
sizeof(ngx_chain_t *) * ((ngx_rtmp_core_srv_conf_t *)
addr_conf->ctx-> srv_conf[ngx_rtmp_core_module
.ctx_index])->out_queue);
@ -184,7 +184,7 @@ ngx_rtmp_init_session(ngx_connection_t *c, ngx_rtmp_addr_conf_t *addr_conf)
s->out_queue = cscf->out_queue;
s->out_cork = cscf->out_cork;
s->in_streams = ngx_pcalloc(c->pool, sizeof(ngx_rtmp_stream_t)
s->in_streams = ngx_pcalloc(c->pool, sizeof(ngx_rtmp_stream_t)
* cscf->max_streams);
if (s->in_streams == NULL) {
ngx_rtmp_close_connection(c);

View File

@ -80,7 +80,7 @@ ngx_rtmp_limit_create_main_conf(ngx_conf_t *cf)
static ngx_int_t
ngx_rtmp_limit_connect(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_rtmp_limit_connect(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
ngx_rtmp_limit_main_conf_t *lmcf;
@ -118,7 +118,7 @@ ngx_rtmp_limit_connect(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_int_t
ngx_rtmp_limit_disconnect(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_rtmp_limit_disconnect(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
ngx_rtmp_limit_main_conf_t *lmcf;
@ -184,7 +184,7 @@ ngx_rtmp_limit_postconfiguration(ngx_conf_t *cf)
h = ngx_array_push(&cmcf->events[NGX_RTMP_CONNECT]);
*h = ngx_rtmp_limit_connect;
h = ngx_array_push(&cmcf->events[NGX_RTMP_DISCONNECT]);
*h = ngx_rtmp_limit_disconnect;

View File

@ -21,7 +21,7 @@ static ngx_rtmp_stream_eof_pt next_stream_eof;
static ngx_int_t ngx_rtmp_live_postconfiguration(ngx_conf_t *cf);
static void * ngx_rtmp_live_create_app_conf(ngx_conf_t *cf);
static char * ngx_rtmp_live_merge_app_conf(ngx_conf_t *cf,
static char * ngx_rtmp_live_merge_app_conf(ngx_conf_t *cf,
void *parent, void *child);
static char *ngx_rtmp_live_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
@ -189,7 +189,7 @@ ngx_rtmp_live_merge_app_conf(ngx_conf_t *cf, void *parent, void *child)
return NGX_CONF_ERROR;
}
conf->streams = ngx_pcalloc(cf->pool,
conf->streams = ngx_pcalloc(cf->pool,
sizeof(ngx_rtmp_live_stream_t *) * conf->nbuckets);
return NGX_CONF_OK;
@ -253,7 +253,7 @@ ngx_rtmp_live_get_stream(ngx_rtmp_session_t *s, u_char *name, int create)
*stream = ngx_palloc(lacf->pool, sizeof(ngx_rtmp_live_stream_t));
}
ngx_memzero(*stream, sizeof(ngx_rtmp_live_stream_t));
ngx_memcpy((*stream)->name, name,
ngx_memcpy((*stream)->name, name,
ngx_min(sizeof((*stream)->name) - 1, len));
(*stream)->epoch = ngx_current_msec;
@ -261,7 +261,7 @@ ngx_rtmp_live_get_stream(ngx_rtmp_session_t *s, u_char *name, int create)
}
static void
static void
ngx_rtmp_live_idle(ngx_event_t *pev)
{
ngx_connection_t *c;
@ -511,7 +511,7 @@ ngx_rtmp_live_join(ngx_rtmp_session_t *s, u_char *name, unsigned publisher)
ctx->session = s;
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"live: join '%s'", name);
stream = ngx_rtmp_live_get_stream(s, name, publisher || lacf->idle_streams);
@ -612,7 +612,7 @@ ngx_rtmp_live_close_stream(ngx_rtmp_session_t *s, ngx_rtmp_close_stream_t *v)
for (pctx = ctx->stream->ctx; pctx; pctx = pctx->next) {
if (pctx->publishing == 0) {
ss = pctx->session;
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, ss->connection->log, 0,
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, ss->connection->log, 0,
"live: no publisher");
ngx_rtmp_finalize_session(ss);
}
@ -693,7 +693,7 @@ next:
}
static ngx_int_t
ngx_rtmp_live_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_rtmp_live_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
ngx_rtmp_live_ctx_t *ctx, *pctx;
@ -1083,7 +1083,7 @@ ngx_rtmp_live_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
ngx_log_debug4(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"live: play: name='%s' start=%uD duration=%uD reset=%d",
v->name, (uint32_t) v->start,
v->name, (uint32_t) v->start,
(uint32_t) v->duration, (uint32_t) v->reset);
/* join stream as subscriber */

View File

@ -16,7 +16,7 @@ static ngx_rtmp_play_pt next_play;
static ngx_int_t ngx_rtmp_log_postconfiguration(ngx_conf_t *cf);
static void *ngx_rtmp_log_create_main_conf(ngx_conf_t *cf);
static void * ngx_rtmp_log_create_app_conf(ngx_conf_t *cf);
static char * ngx_rtmp_log_merge_app_conf(ngx_conf_t *cf,
static char * ngx_rtmp_log_merge_app_conf(ngx_conf_t *cf,
void *parent, void *child);
static char * ngx_rtmp_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
@ -889,7 +889,7 @@ ngx_rtmp_log_write(ngx_rtmp_session_t *s, ngx_rtmp_log_t *log, u_char *buf,
static ngx_int_t
ngx_rtmp_log_disconnect(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_rtmp_log_disconnect(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
ngx_rtmp_log_app_conf_t *lacf;

View File

@ -247,8 +247,8 @@ ngx_rtmp_mp4_mmap(ngx_fd_t fd, size_t size, off_t offset, ngx_fd_t *extra)
CloseHandle(*extra);
}
/*
* non-NULL result means map view handle is open
/*
* non-NULL result means map view handle is open
* and should be closed later
*/
@ -324,21 +324,21 @@ static ngx_int_t ngx_rtmp_mp4_parse_stco(ngx_rtmp_session_t *s, u_char *pos,
u_char *last);
static ngx_int_t ngx_rtmp_mp4_parse_co64(ngx_rtmp_session_t *s, u_char *pos,
u_char *last);
static ngx_int_t ngx_rtmp_mp4_parse_avc1(ngx_rtmp_session_t *s, u_char *pos,
static ngx_int_t ngx_rtmp_mp4_parse_avc1(ngx_rtmp_session_t *s, u_char *pos,
u_char *last);
static ngx_int_t ngx_rtmp_mp4_parse_avcC(ngx_rtmp_session_t *s, u_char *pos,
static ngx_int_t ngx_rtmp_mp4_parse_avcC(ngx_rtmp_session_t *s, u_char *pos,
u_char *last);
static ngx_int_t ngx_rtmp_mp4_parse_mp4a(ngx_rtmp_session_t *s, u_char *pos,
static ngx_int_t ngx_rtmp_mp4_parse_mp4a(ngx_rtmp_session_t *s, u_char *pos,
u_char *last);
static ngx_int_t ngx_rtmp_mp4_parse_mp4v(ngx_rtmp_session_t *s, u_char *pos,
static ngx_int_t ngx_rtmp_mp4_parse_mp4v(ngx_rtmp_session_t *s, u_char *pos,
u_char *last);
static ngx_int_t ngx_rtmp_mp4_parse_esds(ngx_rtmp_session_t *s, u_char *pos,
static ngx_int_t ngx_rtmp_mp4_parse_esds(ngx_rtmp_session_t *s, u_char *pos,
u_char *last);
static ngx_int_t ngx_rtmp_mp4_parse_mp3(ngx_rtmp_session_t *s, u_char *pos,
static ngx_int_t ngx_rtmp_mp4_parse_mp3(ngx_rtmp_session_t *s, u_char *pos,
u_char *last);
static ngx_int_t ngx_rtmp_mp4_parse_nmos(ngx_rtmp_session_t *s, u_char *pos,
static ngx_int_t ngx_rtmp_mp4_parse_nmos(ngx_rtmp_session_t *s, u_char *pos,
u_char *last);
static ngx_int_t ngx_rtmp_mp4_parse_spex(ngx_rtmp_session_t *s, u_char *pos,
static ngx_int_t ngx_rtmp_mp4_parse_spex(ngx_rtmp_session_t *s, u_char *pos,
u_char *last);
@ -357,7 +357,7 @@ static ngx_rtmp_mp4_box_t ngx_rtmp_mp4_boxes[] = {
{ ngx_rtmp_mp4_make_tag('m','d','h','d'), ngx_rtmp_mp4_parse_mdhd },
{ ngx_rtmp_mp4_make_tag('h','d','l','r'), ngx_rtmp_mp4_parse_hdlr },
{ ngx_rtmp_mp4_make_tag('m','i','n','f'), ngx_rtmp_mp4_parse },
{ ngx_rtmp_mp4_make_tag('s','t','b','l'), ngx_rtmp_mp4_parse },
{ ngx_rtmp_mp4_make_tag('s','t','b','l'), ngx_rtmp_mp4_parse },
{ ngx_rtmp_mp4_make_tag('s','t','s','d'), ngx_rtmp_mp4_parse_stsd },
{ ngx_rtmp_mp4_make_tag('s','t','s','c'), ngx_rtmp_mp4_parse_stsc },
{ ngx_rtmp_mp4_make_tag('s','t','t','s'), ngx_rtmp_mp4_parse_stts },
@ -367,29 +367,29 @@ static ngx_rtmp_mp4_box_t ngx_rtmp_mp4_boxes[] = {
{ ngx_rtmp_mp4_make_tag('s','t','z','2'), ngx_rtmp_mp4_parse_stz2 },
{ ngx_rtmp_mp4_make_tag('s','t','c','o'), ngx_rtmp_mp4_parse_stco },
{ ngx_rtmp_mp4_make_tag('c','o','6','4'), ngx_rtmp_mp4_parse_co64 },
{ ngx_rtmp_mp4_make_tag('a','v','c','1'), ngx_rtmp_mp4_parse_avc1 },
{ ngx_rtmp_mp4_make_tag('a','v','c','C'), ngx_rtmp_mp4_parse_avcC },
{ ngx_rtmp_mp4_make_tag('m','p','4','a'), ngx_rtmp_mp4_parse_mp4a },
{ ngx_rtmp_mp4_make_tag('m','p','4','v'), ngx_rtmp_mp4_parse_mp4v },
{ ngx_rtmp_mp4_make_tag('e','s','d','s'), ngx_rtmp_mp4_parse_esds },
{ ngx_rtmp_mp4_make_tag('.','m','p','3'), ngx_rtmp_mp4_parse_mp3 },
{ ngx_rtmp_mp4_make_tag('n','m','o','s'), ngx_rtmp_mp4_parse_nmos },
{ ngx_rtmp_mp4_make_tag('a','v','c','1'), ngx_rtmp_mp4_parse_avc1 },
{ ngx_rtmp_mp4_make_tag('a','v','c','C'), ngx_rtmp_mp4_parse_avcC },
{ ngx_rtmp_mp4_make_tag('m','p','4','a'), ngx_rtmp_mp4_parse_mp4a },
{ ngx_rtmp_mp4_make_tag('m','p','4','v'), ngx_rtmp_mp4_parse_mp4v },
{ ngx_rtmp_mp4_make_tag('e','s','d','s'), ngx_rtmp_mp4_parse_esds },
{ ngx_rtmp_mp4_make_tag('.','m','p','3'), ngx_rtmp_mp4_parse_mp3 },
{ ngx_rtmp_mp4_make_tag('n','m','o','s'), ngx_rtmp_mp4_parse_nmos },
{ ngx_rtmp_mp4_make_tag('s','p','e','x'), ngx_rtmp_mp4_parse_spex },
{ ngx_rtmp_mp4_make_tag('w','a','v','e'), ngx_rtmp_mp4_parse }
};
static ngx_int_t ngx_rtmp_mp4_parse_descr(ngx_rtmp_session_t *s, u_char *pos,
static ngx_int_t ngx_rtmp_mp4_parse_descr(ngx_rtmp_session_t *s, u_char *pos,
u_char *last);
static ngx_int_t ngx_rtmp_mp4_parse_es(ngx_rtmp_session_t *s, u_char *pos,
static ngx_int_t ngx_rtmp_mp4_parse_es(ngx_rtmp_session_t *s, u_char *pos,
u_char *last);
static ngx_int_t ngx_rtmp_mp4_parse_dc(ngx_rtmp_session_t *s, u_char *pos,
static ngx_int_t ngx_rtmp_mp4_parse_dc(ngx_rtmp_session_t *s, u_char *pos,
u_char *last);
static ngx_int_t ngx_rtmp_mp4_parse_ds(ngx_rtmp_session_t *s, u_char *pos,
static ngx_int_t ngx_rtmp_mp4_parse_ds(ngx_rtmp_session_t *s, u_char *pos,
u_char *last);
typedef ngx_int_t (*ngx_rtmp_mp4_descriptor_pt)(ngx_rtmp_session_t *s,
typedef ngx_int_t (*ngx_rtmp_mp4_descriptor_pt)(ngx_rtmp_session_t *s,
u_char *pos, u_char *last);
typedef struct {
@ -460,7 +460,7 @@ ngx_rtmp_mp4_parse_trak(ngx_rtmp_session_t *s, u_char *pos, u_char *last)
}
if (ctx->track && ctx->track->type &&
(ctx->ntracks == 0 ||
(ctx->ntracks == 0 ||
ctx->tracks[0].type != ctx->tracks[ctx->ntracks].type))
{
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
@ -595,7 +595,7 @@ ngx_rtmp_mp4_parse_hdlr(ngx_rtmp_session_t *s, u_char *pos, u_char *last)
static ngx_int_t
ngx_rtmp_mp4_parse_video(ngx_rtmp_session_t *s, u_char *pos, u_char *last,
ngx_rtmp_mp4_parse_video(ngx_rtmp_session_t *s, u_char *pos, u_char *last,
ngx_int_t codec)
{
ngx_rtmp_mp4_ctx_t *ctx;
@ -629,7 +629,7 @@ ngx_rtmp_mp4_parse_video(ngx_rtmp_session_t *s, u_char *pos, u_char *last,
if (ngx_rtmp_mp4_parse(s, pos, last) != NGX_OK) {
return NGX_ERROR;
}
ctx->track->fhdr = (u_char) ctx->track->codec;
return NGX_OK;
@ -843,7 +843,7 @@ ngx_rtmp_mp4_parse_dc(ngx_rtmp_session_t *s, u_char *pos, u_char *last)
}
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: decoder descriptor id=%i codec=%i",
"mp4: decoder descriptor id=%i codec=%i",
(ngx_int_t) id, *pc);
return ngx_rtmp_mp4_parse_descr(s, pos, last);
@ -900,7 +900,7 @@ ngx_rtmp_mp4_parse_descr(ngx_rtmp_session_t *s, u_char *pos, u_char *last)
ngx_uint_t n, ndesc;
ngx_rtmp_mp4_descriptor_t *ds;
ndesc = sizeof(ngx_rtmp_mp4_descriptors)
ndesc = sizeof(ngx_rtmp_mp4_descriptors)
/ sizeof(ngx_rtmp_mp4_descriptors[0]);
while (pos < last) {
@ -937,7 +937,7 @@ ngx_rtmp_mp4_parse_descr(ngx_rtmp_session_t *s, u_char *pos, u_char *last)
}
ngx_log_debug3(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: descriptor%s tag=%i size=%uD",
"mp4: descriptor%s tag=%i size=%uD",
ds ? "" : " unhandled", (ngx_int_t) tag, size);
if (ds && ds->handler(s, pos, pos + size) != NGX_OK) {
@ -1016,12 +1016,12 @@ ngx_rtmp_mp4_parse_stsc(ngx_rtmp_session_t *s, u_char *pos, u_char *last)
t->chunks = (ngx_rtmp_mp4_chunks_t *) pos;
if (pos + sizeof(*t->chunks) + ngx_rtmp_r32(t->chunks->entry_count) *
if (pos + sizeof(*t->chunks) + ngx_rtmp_r32(t->chunks->entry_count) *
sizeof(t->chunks->entries[0])
<= last)
{
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: chunks entries=%uD",
"mp4: chunks entries=%uD",
ngx_rtmp_r32(t->chunks->entry_count));
return NGX_OK;
}
@ -1047,12 +1047,12 @@ ngx_rtmp_mp4_parse_stts(ngx_rtmp_session_t *s, u_char *pos, u_char *last)
t->times = (ngx_rtmp_mp4_times_t *) pos;
if (pos + sizeof(*t->times) + ngx_rtmp_r32(t->times->entry_count) *
if (pos + sizeof(*t->times) + ngx_rtmp_r32(t->times->entry_count) *
sizeof(t->times->entries[0])
<= last)
{
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: times entries=%uD",
"mp4: times entries=%uD",
ngx_rtmp_r32(t->times->entry_count));
return NGX_OK;
}
@ -1078,12 +1078,12 @@ ngx_rtmp_mp4_parse_ctts(ngx_rtmp_session_t *s, u_char *pos, u_char *last)
t->delays = (ngx_rtmp_mp4_delays_t *) pos;
if (pos + sizeof(*t->delays) + ngx_rtmp_r32(t->delays->entry_count) *
if (pos + sizeof(*t->delays) + ngx_rtmp_r32(t->delays->entry_count) *
sizeof(t->delays->entries[0])
<= last)
{
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: delays entries=%uD",
"mp4: delays entries=%uD",
ngx_rtmp_r32(t->delays->entry_count));
return NGX_OK;
}
@ -1109,12 +1109,12 @@ ngx_rtmp_mp4_parse_stss(ngx_rtmp_session_t *s, u_char *pos, u_char *last)
t->keys = (ngx_rtmp_mp4_keys_t *) pos;
if (pos + sizeof(*t->keys) + ngx_rtmp_r32(t->keys->entry_count) *
if (pos + sizeof(*t->keys) + ngx_rtmp_r32(t->keys->entry_count) *
sizeof(t->keys->entries[0])
<= last)
{
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: keys entries=%uD",
"mp4: keys entries=%uD",
ngx_rtmp_r32(t->keys->entry_count));
return NGX_OK;
}
@ -1142,7 +1142,7 @@ ngx_rtmp_mp4_parse_stsz(ngx_rtmp_session_t *s, u_char *pos, u_char *last)
if (pos + sizeof(*t->sizes) <= last && t->sizes->sample_size) {
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: sizes size=%uD",
"mp4: sizes size=%uD",
ngx_rtmp_r32(t->sizes->sample_size));
return NGX_OK;
}
@ -1153,7 +1153,7 @@ ngx_rtmp_mp4_parse_stsz(ngx_rtmp_session_t *s, u_char *pos, u_char *last)
{
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: sizes entries=%uD",
"mp4: sizes entries=%uD",
ngx_rtmp_r32(t->sizes->sample_count));
return NGX_OK;
}
@ -1184,8 +1184,8 @@ ngx_rtmp_mp4_parse_stz2(ngx_rtmp_session_t *s, u_char *pos, u_char *last)
<= last)
{
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: sizes2 field_size=%uD entries=%uD",
ngx_rtmp_r32(t->sizes2->field_size),
"mp4: sizes2 field_size=%uD entries=%uD",
ngx_rtmp_r32(t->sizes2->field_size),
ngx_rtmp_r32(t->sizes2->sample_count));
return NGX_OK;
}
@ -1216,7 +1216,7 @@ ngx_rtmp_mp4_parse_stco(ngx_rtmp_session_t *s, u_char *pos, u_char *last)
<= last)
{
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: offsets entries=%uD",
"mp4: offsets entries=%uD",
ngx_rtmp_r32(t->offsets->entry_count));
return NGX_OK;
}
@ -1247,7 +1247,7 @@ ngx_rtmp_mp4_parse_co64(ngx_rtmp_session_t *s, u_char *pos, u_char *last)
<= last)
{
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: offsets64 entries=%uD",
"mp4: offsets64 entries=%uD",
ngx_rtmp_r32(t->offsets64->entry_count));
return NGX_OK;
}
@ -1278,7 +1278,7 @@ ngx_rtmp_mp4_parse(ngx_rtmp_session_t *s, u_char *pos, u_char *last)
if (pos + size > last) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
"mp4: too big box '%*s': size=%uz",
"mp4: too big box '%*s': size=%uz",
4, &tag, size);
return NGX_ERROR;
}
@ -1287,7 +1287,7 @@ ngx_rtmp_mp4_parse(ngx_rtmp_session_t *s, u_char *pos, u_char *last)
nboxes = sizeof(ngx_rtmp_mp4_boxes) / sizeof(ngx_rtmp_mp4_boxes[0]);
for (n = 0; n < nboxes && b->tag != tag; ++n, ++b);
if (n == nboxes) {
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: box unhandled '%*s'", 4, &tag);
@ -1334,7 +1334,7 @@ ngx_rtmp_mp4_next_time(ngx_rtmp_session_t *s, ngx_rtmp_mp4_track_t *t)
ngx_log_debug8(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: track#%ui time[%ui] [%ui/%uD][%ui/%uD]=%uD t=%uD",
t->id, cr->pos, cr->time_pos,
t->id, cr->pos, cr->time_pos,
ngx_rtmp_r32(t->times->entry_count),
cr->time_count, ngx_rtmp_r32(te->sample_count),
ngx_rtmp_r32(te->sample_delta),
@ -1353,7 +1353,7 @@ ngx_rtmp_mp4_next_time(ngx_rtmp_session_t *s, ngx_rtmp_mp4_track_t *t)
static ngx_int_t
ngx_rtmp_mp4_seek_time(ngx_rtmp_session_t *s, ngx_rtmp_mp4_track_t *t,
ngx_rtmp_mp4_seek_time(ngx_rtmp_session_t *s, ngx_rtmp_mp4_track_t *t,
uint32_t timestamp)
{
ngx_rtmp_mp4_cursor_t *cr;
@ -1370,7 +1370,7 @@ ngx_rtmp_mp4_seek_time(ngx_rtmp_session_t *s, ngx_rtmp_mp4_track_t *t,
while (cr->time_pos < ngx_rtmp_r32(t->times->entry_count)) {
dt = ngx_rtmp_r32(te->sample_delta) * ngx_rtmp_r32(te->sample_count);
if (cr->timestamp + dt >= timestamp) {
if (te->sample_delta == 0) {
return NGX_ERROR;
@ -1402,7 +1402,7 @@ ngx_rtmp_mp4_seek_time(ngx_rtmp_session_t *s, ngx_rtmp_mp4_track_t *t,
ngx_log_debug8(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: track#%ui seek time[%ui] [%ui/%uD][%ui/%uD]=%uD "
"t=%uD",
t->id, cr->pos, cr->time_pos,
t->id, cr->pos, cr->time_pos,
ngx_rtmp_r32(t->times->entry_count),
cr->time_count,
ngx_rtmp_r32(te->sample_count),
@ -1445,7 +1445,7 @@ ngx_rtmp_mp4_update_offset(ngx_rtmp_session_t *s, ngx_rtmp_mp4_track_t *t)
ngx_log_debug4(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: track#%ui offset[%ui/%uD]=%O",
t->id, cr->chunk,
t->id, cr->chunk,
ngx_rtmp_r32(t->offsets->entry_count),
cr->offset);
@ -1499,7 +1499,7 @@ ngx_rtmp_mp4_next_chunk(ngx_rtmp_session_t *s, ngx_rtmp_mp4_track_t *t)
return NGX_ERROR;
}
ce = &t->chunks->entries[cr->chunk_pos];
cr->chunk_count++;
@ -1558,8 +1558,8 @@ ngx_rtmp_mp4_seek_chunk(ngx_rtmp_session_t *s, ngx_rtmp_mp4_track_t *t)
while (cr->chunk_pos + 1 < ngx_rtmp_r32(t->chunks->entry_count)) {
nce = ce + 1;
dpos = (ngx_rtmp_r32(nce->first_chunk) -
dpos = (ngx_rtmp_r32(nce->first_chunk) -
ngx_rtmp_r32(ce->first_chunk)) *
ngx_rtmp_r32(ce->samples_per_chunk);
@ -1580,7 +1580,7 @@ ngx_rtmp_mp4_seek_chunk(ngx_rtmp_session_t *s, ngx_rtmp_mp4_track_t *t)
cr->chunk = ngx_rtmp_r32(ce->first_chunk) + dchunk;
cr->chunk_pos = (ngx_uint_t) (ce - t->chunks->entries);
cr->chunk_count = (ngx_uint_t) (cr->pos - pos - dchunk *
cr->chunk_count = (ngx_uint_t) (cr->pos - pos - dchunk *
ngx_rtmp_r32(ce->samples_per_chunk));
ngx_log_debug7(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
@ -1630,7 +1630,7 @@ ngx_rtmp_mp4_next_size(ngx_rtmp_session_t *s, ngx_rtmp_mp4_track_t *t)
ngx_log_debug4(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: track#%ui size[%ui/%uD]=%uz",
t->id, cr->size_pos,
t->id, cr->size_pos,
ngx_rtmp_r32(t->sizes->sample_count),
cr->size);
@ -1699,7 +1699,7 @@ ngx_rtmp_mp4_seek_size(ngx_rtmp_session_t *s, ngx_rtmp_mp4_track_t *t)
ngx_log_debug4(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: track#%ui seek size[%ui/%uD]=%uz",
t->id, cr->size_pos,
t->id, cr->size_pos,
ngx_rtmp_r32(t->sizes->sample_count),
cr->size);
@ -1752,7 +1752,7 @@ ngx_rtmp_mp4_next_key(ngx_rtmp_session_t *s, ngx_rtmp_mp4_track_t *t)
return NGX_OK;
}
ke = &t->keys->entries[cr->key_pos];
cr->key = (cr->pos + 1 == ngx_rtmp_r32(*ke));
@ -1891,7 +1891,7 @@ ngx_rtmp_mp4_seek_delay(ngx_rtmp_session_t *s, ngx_rtmp_mp4_track_t *t)
while (cr->delay_pos < ngx_rtmp_r32(t->delays->entry_count)) {
dpos = ngx_rtmp_r32(de->sample_count);
if (pos + dpos > cr->pos) {
cr->delay_count = cr->pos - pos;
cr->delay = ngx_rtmp_r32(de->sample_offset);
@ -1964,46 +1964,46 @@ ngx_rtmp_mp4_send_meta(ngx_rtmp_session_t *s)
static ngx_rtmp_amf_elt_t out_inf[] = {
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("width"),
&v.width, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("height"),
&v.height, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("displayWidth"),
&v.width, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("displayHeight"),
&v.height, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("duration"),
&v.duration, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("videocodecid"),
&v.video_codec_id, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("audiocodecid"),
&v.audio_codec_id, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("audiosamplerate"),
&v.audio_sample_rate, 0 },
};
static ngx_rtmp_amf_elt_t out_elts[] = {
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_null_string,
"onMetaData", 0 },
{ NGX_RTMP_AMF_OBJECT,
{ NGX_RTMP_AMF_OBJECT,
ngx_null_string,
out_inf, sizeof(out_inf) },
};
@ -2040,7 +2040,7 @@ ngx_rtmp_mp4_send_meta(ngx_rtmp_session_t *s)
}
out = NULL;
rc = ngx_rtmp_append_amf(s, &out, NULL, out_elts,
rc = ngx_rtmp_append_amf(s, &out, NULL, out_elts,
sizeof(out_elts) / sizeof(out_elts[0]));
if (rc != NGX_OK || out == NULL) {
return NGX_ERROR;
@ -2129,7 +2129,7 @@ ngx_rtmp_mp4_send(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t *ts)
active = 0;
last_timestamp = 0;
end_timestamp = ctx->start_timestamp +
end_timestamp = ctx->start_timestamp +
(ngx_current_msec - ctx->epoch) + buflen;
for (n = 0; n < ctx->ntracks; ++n, ++t) {
@ -2171,7 +2171,7 @@ ngx_rtmp_mp4_send(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t *ts)
fhdr[0] = t->fhdr;
fhdr[1] = 0;
if (t->type == NGX_RTMP_MSG_VIDEO) {
fhdr[0] |= 0x10;
fhdr[2] = fhdr[3] = fhdr[4] = 0;
@ -2207,8 +2207,8 @@ ngx_rtmp_mp4_send(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t *ts)
ngx_log_debug5(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"mp4: track#%ui read frame offset=%O, size=%uz, "
"timestamp=%uD, last_timestamp=%uD",
t->id, cr->offset, cr->size, timestamp,
"timestamp=%uD, last_timestamp=%uD",
t->id, cr->offset, cr->size, timestamp,
last_timestamp);
ngx_rtmp_mp4_buffer[0] = t->fhdr;
@ -2225,7 +2225,7 @@ ngx_rtmp_mp4_send(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t *ts)
if (t->header) {
fhdr_size = 5;
rdelay = ngx_rtmp_mp4_to_rtmp_timestamp(t, cr->delay);
ngx_rtmp_mp4_buffer[1] = 1;
@ -2243,12 +2243,12 @@ ngx_rtmp_mp4_send(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t *ts)
if (cr->size + fhdr_size > sizeof(ngx_rtmp_mp4_buffer)) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
"mp4: track#%ui too big frame: %D>%uz",
"mp4: track#%ui too big frame: %D>%uz",
t->id, cr->size, sizeof(ngx_rtmp_mp4_buffer));
continue;
}
ret = ngx_read_file(f, ngx_rtmp_mp4_buffer + fhdr_size,
ret = ngx_read_file(f, ngx_rtmp_mp4_buffer + fhdr_size,
cr->size, cr->offset);
if (ret != (ssize_t) cr->size) {
@ -2262,7 +2262,7 @@ ngx_rtmp_mp4_send(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t *ts)
in_buf.last = ngx_rtmp_mp4_buffer + cr->size + fhdr_size;
out = ngx_rtmp_append_shared_bufs(cscf, NULL, &in);
ngx_rtmp_prepare_message(s, &h, cr->not_first ? &lh : NULL, out);
rc = ngx_rtmp_send_message(s, out, 0);
ngx_rtmp_free_shared_chain(cscf, out);
@ -2403,7 +2403,7 @@ ngx_rtmp_mp4_init(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_int_t aindex,
return NGX_ERROR;
}
return ngx_rtmp_mp4_parse(s, (u_char *) ctx->mmaped + page_offset,
return ngx_rtmp_mp4_parse(s, (u_char *) ctx->mmaped + page_offset,
(u_char *) ctx->mmaped + page_offset + size);
}
@ -2566,7 +2566,7 @@ ngx_rtmp_mp4_postconfiguration(ngx_conf_t *cf)
}
fmt = ngx_pcalloc(cf->pool, sizeof(ngx_rtmp_play_fmt_t));
if (fmt == NULL) {
return NGX_ERROR;
}

View File

@ -11,7 +11,7 @@
static ngx_int_t ngx_rtmp_netcall_postconfiguration(ngx_conf_t *cf);
static void * ngx_rtmp_netcall_create_srv_conf(ngx_conf_t *cf);
static char * ngx_rtmp_netcall_merge_srv_conf(ngx_conf_t *cf,
static char * ngx_rtmp_netcall_merge_srv_conf(ngx_conf_t *cf,
void *parent, void *child);
static void ngx_rtmp_netcall_close(ngx_connection_t *cc);
@ -132,7 +132,7 @@ ngx_rtmp_netcall_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
static ngx_int_t
ngx_rtmp_netcall_disconnect(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_rtmp_netcall_disconnect(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
ngx_rtmp_netcall_ctx_t *ctx;
@ -150,7 +150,7 @@ ngx_rtmp_netcall_disconnect(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
}
static ngx_int_t
static ngx_int_t
ngx_rtmp_netcall_get_peer(ngx_peer_connection_t *pc, void *data)
{
ngx_rtmp_netcall_session_t *cs = data;
@ -163,7 +163,7 @@ ngx_rtmp_netcall_get_peer(ngx_peer_connection_t *pc, void *data)
}
static void
static void
ngx_rtmp_netcall_free_peer(ngx_peer_connection_t *pc, void *data,
ngx_uint_t state)
{
@ -192,7 +192,7 @@ ngx_rtmp_netcall_create(ngx_rtmp_session_t *s, ngx_rtmp_netcall_init_t *ci)
/* get module context */
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_netcall_module);
if (ctx == NULL) {
ctx = ngx_pcalloc(c->pool,
ctx = ngx_pcalloc(c->pool,
sizeof(ngx_rtmp_netcall_ctx_t));
if (ctx == NULL) {
return NGX_ERROR;
@ -247,7 +247,7 @@ ngx_rtmp_netcall_create(ngx_rtmp_session_t *s, ngx_rtmp_netcall_init_t *ci)
/* connect */
rc = ngx_event_connect_peer(pc);
if (rc != NGX_OK && rc != NGX_AGAIN ) {
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"netcall: connection failed");
goto error;
}
@ -259,7 +259,7 @@ ngx_rtmp_netcall_create(ngx_rtmp_session_t *s, ngx_rtmp_netcall_init_t *ci)
cs->out = ci->create(s, ci->arg, pool);
if (cs->out == NULL) {
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"netcall: creation failed");
ngx_close_connection(pc->connection);
goto error;
@ -454,7 +454,7 @@ ngx_rtmp_netcall_send(ngx_event_t *wev)
}
if (wev->timedout) {
ngx_log_error(NGX_LOG_INFO, cc->log, NGX_ETIMEDOUT,
ngx_log_error(NGX_LOG_INFO, cc->log, NGX_ETIMEDOUT,
"netcall: client send timed out");
cc->timedout = 1;
ngx_rtmp_netcall_close(cc);
@ -546,7 +546,7 @@ ngx_rtmp_netcall_http_format_request(ngx_int_t method, ngx_str_t *host,
if (bl == NULL) {
return NULL;
}
b = ngx_create_temp_buf(pool, sizeof(rq_tmpl) + host->len +
content_type->len + NGX_SIZE_T_LEN);
if (b == NULL) {
@ -583,7 +583,7 @@ ngx_rtmp_netcall_http_format_session(ngx_rtmp_session_t *s, ngx_pool_t *pool)
sizeof("app=") - 1 + s->app.len * 3 +
sizeof("&flashver=") - 1 + s->flashver.len * 3 +
sizeof("&swfurl=") - 1 + s->swf_url.len * 3 +
sizeof("&tcurl=") - 1 + s->tc_url.len * 3 +
sizeof("&tcurl=") - 1 + s->tc_url.len * 3 +
sizeof("&pageurl=") - 1 + s->page_url.len * 3 +
sizeof("&addr=") - 1 + addr_text->len * 3
);
@ -599,35 +599,35 @@ ngx_rtmp_netcall_http_format_session(ngx_rtmp_session_t *s, ngx_pool_t *pool)
b->last = (u_char*) ngx_escape_uri(b->last, s->app.data, s->app.len,
NGX_ESCAPE_ARGS);
b->last = ngx_cpymem(b->last, (u_char*) "&flashver=",
b->last = ngx_cpymem(b->last, (u_char*) "&flashver=",
sizeof("&flashver=") - 1);
b->last = (u_char*) ngx_escape_uri(b->last, s->flashver.data,
b->last = (u_char*) ngx_escape_uri(b->last, s->flashver.data,
s->flashver.len, NGX_ESCAPE_ARGS);
b->last = ngx_cpymem(b->last, (u_char*) "&swfurl=",
b->last = ngx_cpymem(b->last, (u_char*) "&swfurl=",
sizeof("&swfurl=") - 1);
b->last = (u_char*) ngx_escape_uri(b->last, s->swf_url.data,
b->last = (u_char*) ngx_escape_uri(b->last, s->swf_url.data,
s->swf_url.len, NGX_ESCAPE_ARGS);
b->last = ngx_cpymem(b->last, (u_char*) "&tcurl=",
b->last = ngx_cpymem(b->last, (u_char*) "&tcurl=",
sizeof("&tcurl=") - 1);
b->last = (u_char*) ngx_escape_uri(b->last, s->tc_url.data,
b->last = (u_char*) ngx_escape_uri(b->last, s->tc_url.data,
s->tc_url.len, NGX_ESCAPE_ARGS);
b->last = ngx_cpymem(b->last, (u_char*) "&pageurl=",
b->last = ngx_cpymem(b->last, (u_char*) "&pageurl=",
sizeof("&pageurl=") - 1);
b->last = (u_char*) ngx_escape_uri(b->last, s->page_url.data,
b->last = (u_char*) ngx_escape_uri(b->last, s->page_url.data,
s->page_url.len, NGX_ESCAPE_ARGS);
b->last = ngx_cpymem(b->last, (u_char*) "&addr=", sizeof("&addr=") -1);
b->last = (u_char*) ngx_escape_uri(b->last, addr_text->data,
b->last = (u_char*) ngx_escape_uri(b->last, addr_text->data,
addr_text->len, NGX_ESCAPE_ARGS);
return cl;
}
ngx_chain_t *
ngx_chain_t *
ngx_rtmp_netcall_http_skip_header(ngx_chain_t *in)
{
ngx_buf_t *b;
@ -654,7 +654,7 @@ ngx_rtmp_netcall_http_skip_header(ngx_chain_t *in)
}
b = in->buf;
}
switch (*b->pos++) {
case '\r':
state = (state == lf) ? lfcr : normal;

View File

@ -18,7 +18,7 @@ typedef ngx_chain_t * (*ngx_rtmp_netcall_create_pt)(ngx_rtmp_session_t *s,
typedef ngx_int_t (*ngx_rtmp_netcall_filter_pt)(ngx_chain_t *in);
typedef ngx_int_t (*ngx_rtmp_netcall_sink_pt)(ngx_rtmp_session_t *s,
ngx_chain_t *in);
typedef ngx_int_t (*ngx_rtmp_netcall_handle_pt)(ngx_rtmp_session_t *s,
typedef ngx_int_t (*ngx_rtmp_netcall_handle_pt)(ngx_rtmp_session_t *s,
void *arg, ngx_chain_t *in);
#define NGX_RTMP_NETCALL_HTTP_GET 0
@ -45,12 +45,12 @@ typedef struct {
} ngx_rtmp_netcall_init_t;
ngx_int_t ngx_rtmp_netcall_create(ngx_rtmp_session_t *s,
ngx_int_t ngx_rtmp_netcall_create(ngx_rtmp_session_t *s,
ngx_rtmp_netcall_init_t *ci);
/* HTTP handling */
ngx_chain_t * ngx_rtmp_netcall_http_format_session(ngx_rtmp_session_t *s,
ngx_chain_t * ngx_rtmp_netcall_http_format_session(ngx_rtmp_session_t *s,
ngx_pool_t *pool);
ngx_chain_t * ngx_rtmp_netcall_http_format_request(ngx_int_t method,
ngx_str_t *host, ngx_str_t *uri, ngx_chain_t *args, ngx_chain_t *body,
@ -59,8 +59,8 @@ ngx_chain_t * ngx_rtmp_netcall_http_skip_header(ngx_chain_t *in);
/* Memcache handling */
ngx_chain_t * ngx_rtmp_netcall_memcache_set(ngx_rtmp_session_t *s,
ngx_pool_t *pool, ngx_str_t *key, ngx_str_t *value,
ngx_chain_t * ngx_rtmp_netcall_memcache_set(ngx_rtmp_session_t *s,
ngx_pool_t *pool, ngx_str_t *key, ngx_str_t *value,
ngx_uint_t flags, ngx_uint_t sec);

View File

@ -29,16 +29,16 @@ static char *ngx_rtmp_notify_method(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
static ngx_int_t ngx_rtmp_notify_postconfiguration(ngx_conf_t *cf);
static void * ngx_rtmp_notify_create_app_conf(ngx_conf_t *cf);
static char * ngx_rtmp_notify_merge_app_conf(ngx_conf_t *cf,
static char * ngx_rtmp_notify_merge_app_conf(ngx_conf_t *cf,
void *parent, void *child);
static void *ngx_rtmp_notify_create_srv_conf(ngx_conf_t *cf);
static char *ngx_rtmp_notify_merge_srv_conf(ngx_conf_t *cf, void *parent,
void *child);
static ngx_int_t ngx_rtmp_notify_done(ngx_rtmp_session_t *s, char *cbname,
static ngx_int_t ngx_rtmp_notify_done(ngx_rtmp_session_t *s, char *cbname,
ngx_uint_t url_idx);
ngx_str_t ngx_rtmp_notify_urlencoded =
ngx_str_t ngx_rtmp_notify_urlencoded =
ngx_string("application/x-www-form-urlencoded");
@ -348,7 +348,7 @@ ngx_rtmp_notify_create_request(ngx_rtmp_session_t *s, ngx_pool_t *pool,
static ngx_chain_t *
ngx_rtmp_notify_connect_create(ngx_rtmp_session_t *s, void *arg,
ngx_rtmp_notify_connect_create(ngx_rtmp_session_t *s, void *arg,
ngx_pool_t *pool)
{
ngx_rtmp_connect_t *v = arg;
@ -369,7 +369,7 @@ ngx_rtmp_notify_connect_create(ngx_rtmp_session_t *s, void *arg,
}
/* these values are still missing in session
* so we have to construct the request from
* so we have to construct the request from
* connection struct */
app_len = ngx_strlen(v->app);
@ -386,7 +386,7 @@ ngx_rtmp_notify_connect_create(ngx_rtmp_session_t *s, void *arg,
sizeof("&app=") - 1 + app_len * 3 +
sizeof("&flashver=") - 1 + flashver_len * 3 +
sizeof("&swfurl=") - 1 + swf_url_len * 3 +
sizeof("&tcurl=") - 1 + tc_url_len * 3 +
sizeof("&tcurl=") - 1 + tc_url_len * 3 +
sizeof("&pageurl=") - 1 + page_url_len * 3 +
sizeof("&addr=") - 1 + addr_text->len * 3 +
1 + args_len
@ -403,31 +403,31 @@ ngx_rtmp_notify_connect_create(ngx_rtmp_session_t *s, void *arg,
b->last = (u_char*) ngx_escape_uri(b->last, v->app, app_len,
NGX_ESCAPE_ARGS);
b->last = ngx_cpymem(b->last, (u_char*) "&flashver=",
b->last = ngx_cpymem(b->last, (u_char*) "&flashver=",
sizeof("&flashver=") - 1);
b->last = (u_char*) ngx_escape_uri(b->last, v->flashver, flashver_len,
NGX_ESCAPE_ARGS);
b->last = ngx_cpymem(b->last, (u_char*) "&swfurl=",
b->last = ngx_cpymem(b->last, (u_char*) "&swfurl=",
sizeof("&swfurl=") - 1);
b->last = (u_char*) ngx_escape_uri(b->last, v->swf_url, swf_url_len,
NGX_ESCAPE_ARGS);
b->last = ngx_cpymem(b->last, (u_char*) "&tcurl=",
b->last = ngx_cpymem(b->last, (u_char*) "&tcurl=",
sizeof("&tcurl=") - 1);
b->last = (u_char*) ngx_escape_uri(b->last, v->tc_url, tc_url_len,
NGX_ESCAPE_ARGS);
b->last = ngx_cpymem(b->last, (u_char*) "&pageurl=",
b->last = ngx_cpymem(b->last, (u_char*) "&pageurl=",
sizeof("&pageurl=") - 1);
b->last = (u_char*) ngx_escape_uri(b->last, v->page_url, page_url_len,
NGX_ESCAPE_ARGS);
b->last = ngx_cpymem(b->last, (u_char*) "&addr=", sizeof("&addr=") -1);
b->last = (u_char*) ngx_escape_uri(b->last, addr_text->data,
b->last = (u_char*) ngx_escape_uri(b->last, addr_text->data,
addr_text->len, NGX_ESCAPE_ARGS);
b->last = ngx_cpymem(b->last, (u_char*) "&call=connect",
b->last = ngx_cpymem(b->last, (u_char*) "&call=connect",
sizeof("&call=connect") - 1);
if (args_len) {
@ -451,7 +451,7 @@ ngx_rtmp_notify_connect_create(ngx_rtmp_session_t *s, void *arg,
static ngx_chain_t *
ngx_rtmp_notify_disconnect_create(ngx_rtmp_session_t *s, void *arg,
ngx_rtmp_notify_disconnect_create(ngx_rtmp_session_t *s, void *arg,
ngx_pool_t *pool)
{
ngx_rtmp_notify_srv_conf_t *nscf;
@ -477,7 +477,7 @@ ngx_rtmp_notify_disconnect_create(ngx_rtmp_session_t *s, void *arg,
pl->buf = b;
pl->next = NULL;
b->last = ngx_cpymem(b->last, (u_char*) "&call=disconnect",
b->last = ngx_cpymem(b->last, (u_char*) "&call=disconnect",
sizeof("&call=disconnect") - 1);
b->last = ngx_cpymem(b->last, (u_char*) "&app=", sizeof("&app=") - 1);
@ -512,7 +512,7 @@ ngx_rtmp_notify_disconnect_create(ngx_rtmp_session_t *s, void *arg,
static ngx_chain_t *
ngx_rtmp_notify_publish_create(ngx_rtmp_session_t *s, void *arg,
ngx_rtmp_notify_publish_create(ngx_rtmp_session_t *s, void *arg,
ngx_pool_t *pool)
{
ngx_rtmp_publish_t *v = arg;
@ -542,7 +542,7 @@ ngx_rtmp_notify_publish_create(ngx_rtmp_session_t *s, void *arg,
pl->buf = b;
pl->next = NULL;
b->last = ngx_cpymem(b->last, (u_char*) "&call=publish",
b->last = ngx_cpymem(b->last, (u_char*) "&call=publish",
sizeof("&call=publish") - 1);
b->last = ngx_cpymem(b->last, (u_char*) "&name=", sizeof("&name=") - 1);
@ -563,7 +563,7 @@ ngx_rtmp_notify_publish_create(ngx_rtmp_session_t *s, void *arg,
static ngx_chain_t *
ngx_rtmp_notify_play_create(ngx_rtmp_session_t *s, void *arg,
ngx_rtmp_notify_play_create(ngx_rtmp_session_t *s, void *arg,
ngx_pool_t *pool)
{
ngx_rtmp_play_t *v = arg;
@ -581,7 +581,7 @@ ngx_rtmp_notify_play_create(ngx_rtmp_session_t *s, void *arg,
args_len = ngx_strlen(v->args);
b = ngx_create_temp_buf(pool,
sizeof("&call=play") +
sizeof("&call=play") +
sizeof("&name=") + name_len * 3 +
sizeof("&start=&duration=&reset=") +
NGX_INT32_LEN * 3 + 1 + args_len);
@ -592,7 +592,7 @@ ngx_rtmp_notify_play_create(ngx_rtmp_session_t *s, void *arg,
pl->buf = b;
pl->next = NULL;
b->last = ngx_cpymem(b->last, (u_char*) "&call=play",
b->last = ngx_cpymem(b->last, (u_char*) "&call=play",
sizeof("&call=play") - 1);
b->last = ngx_cpymem(b->last, (u_char*) "&name=", sizeof("&name=") - 1);
@ -614,7 +614,7 @@ ngx_rtmp_notify_play_create(ngx_rtmp_session_t *s, void *arg,
static ngx_chain_t *
ngx_rtmp_notify_done_create(ngx_rtmp_session_t *s, void *arg,
ngx_rtmp_notify_done_create(ngx_rtmp_session_t *s, void *arg,
ngx_pool_t *pool)
{
ngx_rtmp_notify_done_t *ds = arg;
@ -665,7 +665,7 @@ ngx_rtmp_notify_done_create(ngx_rtmp_session_t *s, void *arg,
static ngx_chain_t *
ngx_rtmp_notify_update_create(ngx_rtmp_session_t *s, void *arg,
ngx_rtmp_notify_update_create(ngx_rtmp_session_t *s, void *arg,
ngx_pool_t *pool)
{
ngx_chain_t *pl;
@ -755,7 +755,7 @@ ngx_rtmp_notify_record_done_create(ngx_rtmp_session_t *s, void *arg,
b = ngx_create_temp_buf(pool,
sizeof("&call=record_done") +
sizeof("&recorder=") + v->recorder.len +
sizeof("&recorder=") + v->recorder.len +
sizeof("&name=") + name_len * 3 +
sizeof("&path=") + v->path.len * 3 +
1 + args_len);
@ -766,10 +766,10 @@ ngx_rtmp_notify_record_done_create(ngx_rtmp_session_t *s, void *arg,
pl->buf = b;
pl->next = NULL;
b->last = ngx_cpymem(b->last, (u_char*) "&call=record_done",
b->last = ngx_cpymem(b->last, (u_char*) "&call=record_done",
sizeof("&call=record_done") - 1);
b->last = ngx_cpymem(b->last, (u_char *) "&recorder=",
b->last = ngx_cpymem(b->last, (u_char *) "&recorder=",
sizeof("&recorder=") - 1);
b->last = (u_char*) ngx_escape_uri(b->last, v->recorder.data,
v->recorder.len, NGX_ESCAPE_ARGS);
@ -792,9 +792,9 @@ ngx_rtmp_notify_record_done_create(ngx_rtmp_session_t *s, void *arg,
}
static ngx_int_t
ngx_rtmp_notify_parse_http_retcode(ngx_rtmp_session_t *s,
ngx_chain_t *in)
static ngx_int_t
ngx_rtmp_notify_parse_http_retcode(ngx_rtmp_session_t *s,
ngx_chain_t *in)
{
ngx_buf_t *b;
ngx_int_t n;
@ -832,7 +832,7 @@ ngx_rtmp_notify_parse_http_retcode(ngx_rtmp_session_t *s,
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
"notify: empty or broken HTTP response");
/*
/*
* not enough data;
* it can happen in case of empty or broken reply
*/
@ -841,8 +841,8 @@ ngx_rtmp_notify_parse_http_retcode(ngx_rtmp_session_t *s,
}
static ngx_int_t
ngx_rtmp_notify_parse_http_header(ngx_rtmp_session_t *s,
static ngx_int_t
ngx_rtmp_notify_parse_http_header(ngx_rtmp_session_t *s,
ngx_chain_t *in, ngx_str_t *name, u_char *data, size_t len)
{
ngx_buf_t *b;
@ -947,8 +947,8 @@ ngx_rtmp_notify_clear_flag(ngx_rtmp_session_t *s, ngx_uint_t flag)
}
static ngx_int_t
ngx_rtmp_notify_connect_handle(ngx_rtmp_session_t *s,
static ngx_int_t
ngx_rtmp_notify_connect_handle(ngx_rtmp_session_t *s,
void *arg, ngx_chain_t *in)
{
ngx_rtmp_connect_t *v = arg;
@ -979,8 +979,8 @@ ngx_rtmp_notify_connect_handle(ngx_rtmp_session_t *s,
}
static ngx_int_t
ngx_rtmp_notify_publish_handle(ngx_rtmp_session_t *s,
static ngx_int_t
ngx_rtmp_notify_publish_handle(ngx_rtmp_session_t *s,
void *arg, ngx_chain_t *in)
{
ngx_rtmp_publish_t *v = arg;
@ -1058,8 +1058,8 @@ next:
}
static ngx_int_t
ngx_rtmp_notify_play_handle(ngx_rtmp_session_t *s,
static ngx_int_t
ngx_rtmp_notify_play_handle(ngx_rtmp_session_t *s,
void *arg, ngx_chain_t *in)
{
ngx_rtmp_play_t *v = arg;
@ -1137,8 +1137,8 @@ next:
}
static ngx_int_t
ngx_rtmp_notify_update_handle(ngx_rtmp_session_t *s,
static ngx_int_t
ngx_rtmp_notify_update_handle(ngx_rtmp_session_t *s,
void *arg, ngx_chain_t *in)
{
ngx_rtmp_notify_app_conf_t *nacf;
@ -1148,7 +1148,7 @@ ngx_rtmp_notify_update_handle(ngx_rtmp_session_t *s,
nacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_notify_module);
rc = ngx_rtmp_notify_parse_http_retcode(s, in);
if ((!nacf->update_strict && rc == NGX_ERROR) ||
(nacf->update_strict && rc != NGX_OK))
{
@ -1170,7 +1170,7 @@ ngx_rtmp_notify_update_handle(ngx_rtmp_session_t *s,
}
static void
static void
ngx_rtmp_notify_update(ngx_event_t *e)
{
ngx_connection_t *c;
@ -1206,7 +1206,7 @@ ngx_rtmp_notify_update(ngx_event_t *e)
static void
ngx_rtmp_notify_init(ngx_rtmp_session_t *s,
ngx_rtmp_notify_init(ngx_rtmp_session_t *s,
u_char name[NGX_RTMP_MAX_NAME], u_char args[NGX_RTMP_MAX_ARGS],
ngx_uint_t flags)
{
@ -1545,7 +1545,7 @@ ngx_rtmp_notify_parse_url(ngx_conf_t *cf, ngx_str_t *url)
u->url.data = url->data + add;
u->default_port = 80;
u->uri_part = 1;
if (ngx_parse_url(cf->pool, u) != NGX_OK) {
if (u->err) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,

View File

@ -23,7 +23,7 @@ static char *ngx_rtmp_play_url(ngx_conf_t *cf, ngx_command_t *cmd,
static void *ngx_rtmp_play_create_main_conf(ngx_conf_t *cf);
static ngx_int_t ngx_rtmp_play_postconfiguration(ngx_conf_t *cf);
static void * ngx_rtmp_play_create_app_conf(ngx_conf_t *cf);
static char * ngx_rtmp_play_merge_app_conf(ngx_conf_t *cf,
static char * ngx_rtmp_play_merge_app_conf(ngx_conf_t *cf,
void *parent, void *child);
static ngx_int_t ngx_rtmp_play_do_init(ngx_rtmp_session_t *s);
@ -122,7 +122,7 @@ ngx_rtmp_play_create_main_conf(ngx_conf_t *cf)
return NULL;
}
if (ngx_array_init(&pmcf->fmts, cf->pool, 1,
if (ngx_array_init(&pmcf->fmts, cf->pool, 1,
sizeof(ngx_rtmp_play_fmt_t *))
!= NGX_OK)
{
@ -716,8 +716,8 @@ ngx_rtmp_play_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
* we should not move out of play directory */
for (p = v->name; *p; ++p) {
if (ngx_path_separator(p[0]) &&
p[1] == '.' && p[2] == '.' &&
ngx_path_separator(p[3]))
p[1] == '.' && p[2] == '.' &&
ngx_path_separator(p[3]))
{
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
"play: bad name '%s'", v->name);
@ -735,7 +735,7 @@ ngx_rtmp_play_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
ctx->session = s;
ctx->aindex = ngx_rtmp_play_parse_index('a', v->args);
ctx->vindex = ngx_rtmp_play_parse_index('v', v->args);
ctx->file.log = s->connection->log;
ngx_memcpy(ctx->name, v->name, NGX_RTMP_MAX_NAME);
@ -744,7 +744,7 @@ ngx_rtmp_play_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
name.data = v->name;
pfmt = pmcf->fmts.elts;
for (n = 0; n < pmcf->fmts.nelts; ++n, ++pfmt) {
fmt = *pfmt;
@ -765,7 +765,7 @@ ngx_rtmp_play_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
}
if (name.len >= sfx->len &&
ngx_strncasecmp(sfx->data, name.data + name.len - sfx->len,
ngx_strncasecmp(sfx->data, name.data + name.len - sfx->len,
sfx->len) == 0)
{
ctx->fmt = fmt;
@ -785,7 +785,7 @@ ngx_rtmp_play_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
sfx = &ctx->fmt->sfx;
if (name.len < sfx->len ||
ngx_strncasecmp(sfx->data, name.data + name.len - sfx->len,
ngx_strncasecmp(sfx->data, name.data + name.len - sfx->len,
sfx->len))
{
ctx->sfx = *sfx;
@ -857,7 +857,7 @@ ngx_rtmp_play_next_entry(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
pe->root, v->name + ctx->pfx_size, &ctx->sfx);
*p = 0;
ctx->file.fd = ngx_open_file(path, NGX_FILE_RDONLY, NGX_FILE_OPEN,
ctx->file.fd = ngx_open_file(path, NGX_FILE_RDONLY, NGX_FILE_OPEN,
NGX_FILE_DEFAULT_ACCESS);
if (ctx->file.fd == NGX_INVALID_FILE) {
@ -994,7 +994,7 @@ ngx_rtmp_play_remote_create(ngx_rtmp_session_t *s, void *arg, ngx_pool_t *pool)
}
static ngx_int_t
static ngx_int_t
ngx_rtmp_play_remote_handle(ngx_rtmp_session_t *s, void *arg, ngx_chain_t *in)
{
ngx_rtmp_play_t *v = arg;
@ -1022,7 +1022,7 @@ ngx_rtmp_play_remote_handle(ngx_rtmp_session_t *s, void *arg, ngx_chain_t *in)
}
static ngx_int_t
static ngx_int_t
ngx_rtmp_play_remote_sink(ngx_rtmp_session_t *s, ngx_chain_t *in)
{
ngx_rtmp_play_ctx_t *ctx;
@ -1046,7 +1046,7 @@ ngx_rtmp_play_remote_sink(ngx_rtmp_session_t *s, ngx_chain_t *in)
}
/* 10th header byte is HTTP response header */
if (++ctx->nheader == 10 && *b->pos != (u_char) '2') {
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
"play: remote HTTP response code: %cxx",
*b->pos);
return NGX_ERROR;
@ -1069,7 +1069,7 @@ ngx_rtmp_play_remote_sink(ngx_rtmp_session_t *s, ngx_chain_t *in)
rc = ngx_write_fd(ctx->file.fd, b->pos, b->last - b->pos);
if (rc == NGX_ERROR) {
ngx_log_error(NGX_LOG_INFO, s->connection->log, ngx_errno,
ngx_log_error(NGX_LOG_INFO, s->connection->log, ngx_errno,
"play: error writing to temp file");
return NGX_ERROR;
}
@ -1209,7 +1209,7 @@ ngx_rtmp_play_url(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
if (pe->root == NULL) {
return NGX_CONF_ERROR;
}
*pe->root = value[n];
continue;

View File

@ -14,13 +14,13 @@
#include "ngx_rtmp_cmd_module.h"
typedef ngx_int_t (*ngx_rtmp_play_init_pt) (ngx_rtmp_session_t *s,
typedef ngx_int_t (*ngx_rtmp_play_init_pt) (ngx_rtmp_session_t *s,
ngx_file_t *f, ngx_int_t aindex, ngx_int_t vindex);
typedef ngx_int_t (*ngx_rtmp_play_done_pt) (ngx_rtmp_session_t *s,
ngx_file_t *f);
typedef ngx_int_t (*ngx_rtmp_play_start_pt) (ngx_rtmp_session_t *s,
typedef ngx_int_t (*ngx_rtmp_play_start_pt) (ngx_rtmp_session_t *s,
ngx_file_t *f);
typedef ngx_int_t (*ngx_rtmp_play_seek_pt) (ngx_rtmp_session_t *s,
typedef ngx_int_t (*ngx_rtmp_play_seek_pt) (ngx_rtmp_session_t *s,
ngx_file_t *f, ngx_uint_t offs);
typedef ngx_int_t (*ngx_rtmp_play_stop_pt) (ngx_rtmp_session_t *s,
ngx_file_t *f);

View File

@ -12,12 +12,12 @@
#include <string.h>
ngx_int_t
ngx_int_t
ngx_rtmp_protocol_message_handler(ngx_rtmp_session_t *s,
ngx_rtmp_header_t *h, ngx_chain_t *in)
{
ngx_buf_t *b;
u_char *p;
u_char *p;
uint32_t val;
uint8_t limit;
@ -67,7 +67,7 @@ ngx_rtmp_protocol_message_handler(ngx_rtmp_session_t *s,
(void)limit;
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"receive bandwidth=%uD limit=%d",
"receive bandwidth=%uD limit=%d",
val, (int)limit);
/* receive window size =val
@ -83,12 +83,12 @@ ngx_rtmp_protocol_message_handler(ngx_rtmp_session_t *s,
}
ngx_int_t
ngx_int_t
ngx_rtmp_user_message_handler(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
ngx_buf_t *b;
u_char *p;
u_char *p;
uint16_t evt;
uint32_t val;
@ -107,7 +107,7 @@ ngx_rtmp_user_message_handler(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
p[1] = b->pos[0];
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"RTMP recv user evt %s (%i)",
"RTMP recv user evt %s (%i)",
ngx_rtmp_user_message_type(evt), (ngx_int_t) evt);
p = (u_char *) &val;
@ -256,7 +256,7 @@ ngx_rtmp_fetch_uint32(ngx_chain_t **in, uint32_t *ret, ngx_int_t n)
}
ngx_int_t
ngx_int_t
ngx_rtmp_aggregate_message_handler(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
@ -322,7 +322,7 @@ ngx_rtmp_aggregate_message_handler(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
}
if (cl == NULL) {
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
"RTMP error parsing aggregate");
return NGX_ERROR;
}
@ -364,7 +364,7 @@ ngx_rtmp_aggregate_message_handler(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
}
ngx_int_t
ngx_int_t
ngx_rtmp_amf_message_handler(ngx_rtmp_session_t *s,
ngx_rtmp_header_t *h, ngx_chain_t *in)
{
@ -379,14 +379,14 @@ ngx_rtmp_amf_message_handler(ngx_rtmp_session_t *s,
static ngx_rtmp_amf_elt_t elts[] = {
{ NGX_RTMP_AMF_STRING,
ngx_null_string,
ngx_null_string,
func, sizeof(func) },
};
/* AMF command names come with string type, but shared object names
* come without type */
if (h->type == NGX_RTMP_MSG_AMF_SHARED ||
h->type == NGX_RTMP_MSG_AMF3_SHARED)
if (h->type == NGX_RTMP_MSG_AMF_SHARED ||
h->type == NGX_RTMP_MSG_AMF3_SHARED)
{
elts[0].type |= NGX_RTMP_AMF_TYPELESS;
} else {
@ -396,7 +396,7 @@ ngx_rtmp_amf_message_handler(ngx_rtmp_session_t *s,
if ((h->type == NGX_RTMP_MSG_AMF3_SHARED ||
h->type == NGX_RTMP_MSG_AMF3_META ||
h->type == NGX_RTMP_MSG_AMF3_CMD)
&& in->buf->last > in->buf->pos)
&& in->buf->last > in->buf->pos)
{
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"AMF3 prefix: %ui", (ngx_int_t)*in->buf->pos);
@ -411,8 +411,8 @@ ngx_rtmp_amf_message_handler(ngx_rtmp_session_t *s,
act.log = s->connection->log;
memset(func, 0, sizeof(func));
if (ngx_rtmp_amf_read(&act, elts,
sizeof(elts) / sizeof(elts[0])) != NGX_OK)
if (ngx_rtmp_amf_read(&act, elts,
sizeof(elts) / sizeof(elts[0])) != NGX_OK)
{
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"AMF cmd failed");
@ -425,14 +425,14 @@ ngx_rtmp_amf_message_handler(ngx_rtmp_session_t *s,
len = ngx_strlen(func);
ch = ngx_hash_find(&cmcf->amf_hash,
ch = ngx_hash_find(&cmcf->amf_hash,
ngx_hash_strlow(func, func, len), func, len);
if (ch && ch->nelts) {
ph = ch->elts;
for (n = 0; n < ch->nelts; ++n, ++ph) {
ngx_log_debug3(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"AMF func '%s' passed to handler %d/%d",
"AMF func '%s' passed to handler %d/%d",
func, n, ch->nelts);
switch ((*ph)(s, h, in)) {
case NGX_ERROR:
@ -461,4 +461,4 @@ ngx_rtmp_receive_amf(ngx_rtmp_session_t *s, ngx_chain_t *in,
act.log = s->connection->log;
return ngx_rtmp_amf_read(&act, elts, nelts);
}
}

View File

@ -26,9 +26,9 @@ static char *ngx_rtmp_record_recorder(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
static ngx_int_t ngx_rtmp_record_postconfiguration(ngx_conf_t *cf);
static void * ngx_rtmp_record_create_app_conf(ngx_conf_t *cf);
static char * ngx_rtmp_record_merge_app_conf(ngx_conf_t *cf,
static char * ngx_rtmp_record_merge_app_conf(ngx_conf_t *cf,
void *parent, void *child);
static ngx_int_t ngx_rtmp_record_write_frame(ngx_rtmp_session_t *s,
static ngx_int_t ngx_rtmp_record_write_frame(ngx_rtmp_session_t *s,
ngx_rtmp_record_rec_ctx_t *rctx,
ngx_rtmp_header_t *h, ngx_chain_t *in, ngx_int_t inc_nframes);
static ngx_int_t ngx_rtmp_record_av(ngx_rtmp_session_t *s,
@ -39,7 +39,7 @@ static ngx_int_t ngx_rtmp_record_node_open(ngx_rtmp_session_t *s,
ngx_rtmp_record_rec_ctx_t *rctx);
static ngx_int_t ngx_rtmp_record_node_close(ngx_rtmp_session_t *s,
ngx_rtmp_record_rec_ctx_t *rctx);
static void ngx_rtmp_record_make_path(ngx_rtmp_session_t *s,
static void ngx_rtmp_record_make_path(ngx_rtmp_session_t *s,
ngx_rtmp_record_rec_ctx_t *rctx, ngx_str_t *path);
static ngx_int_t ngx_rtmp_record_init(ngx_rtmp_session_t *s);
@ -221,7 +221,7 @@ ngx_rtmp_record_merge_app_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_value(conf->append, prev->append, 0);
ngx_conf_merge_value(conf->lock_file, prev->lock_file, 0);
ngx_conf_merge_value(conf->notify, prev->notify, 0);
ngx_conf_merge_msec_value(conf->interval, prev->interval,
ngx_conf_merge_msec_value(conf->interval, prev->interval,
(ngx_msec_t) NGX_CONF_UNSET);
ngx_conf_merge_bitmask_value(conf->flags, prev->flags, 0);
ngx_conf_merge_ptr_value(conf->url, prev->url, NULL);
@ -248,9 +248,9 @@ ngx_rtmp_record_write_header(ngx_file_t *file)
0x56, /* 'V' */
0x01, /* version = 1 */
0x05, /* 00000 1 0 1 = has audio & video */
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x09, /* header size */
0x00,
0x00,
@ -292,7 +292,7 @@ ngx_rtmp_record_open(ngx_rtmp_session_t *s, ngx_uint_t n, ngx_str_t *path)
ngx_rtmp_record_rec_ctx_t *rctx;
ngx_int_t rc;
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"record: #%ui manual open", n);
rctx = ngx_rtmp_record_get_node_ctx(s, n);
@ -320,7 +320,7 @@ ngx_rtmp_record_close(ngx_rtmp_session_t *s, ngx_uint_t n, ngx_str_t *path)
ngx_rtmp_record_rec_ctx_t *rctx;
ngx_int_t rc;
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"record: #%ui manual close", n);
rctx = ngx_rtmp_record_get_node_ctx(s, n);
@ -385,7 +385,7 @@ ngx_rtmp_record_make_path(ngx_rtmp_session_t *s,
p = pbuf;
l = pbuf + sizeof(pbuf) - 1;
p = ngx_cpymem(p, rracf->path.data,
p = ngx_cpymem(p, rracf->path.data,
ngx_min(rracf->path.len, (size_t)(l - p - 1)));
*p++ = '/';
p = (u_char *)ngx_escape_uri(p, ctx->name, ngx_min(ngx_strlen(ctx->name),
@ -393,7 +393,7 @@ ngx_rtmp_record_make_path(ngx_rtmp_session_t *s,
/* append timestamp */
if (rracf->unique) {
p = ngx_cpymem(p, buf, ngx_min(ngx_sprintf(buf, "-%T",
p = ngx_cpymem(p, buf, ngx_min(ngx_sprintf(buf, "-%T",
rctx->timestamp) - buf, l - p));
}
@ -401,7 +401,7 @@ ngx_rtmp_record_make_path(ngx_rtmp_session_t *s,
ngx_libc_localtime(rctx->timestamp, &tm);
p += strftime((char *) p, l - p, (char *) rracf->suffix.data, &tm);
} else {
p = ngx_cpymem(p, rracf->suffix.data,
p = ngx_cpymem(p, rracf->suffix.data,
ngx_min(rracf->suffix.len, (size_t)(l - p)));
}
@ -409,7 +409,7 @@ ngx_rtmp_record_make_path(ngx_rtmp_session_t *s,
path->data = pbuf;
path->len = p - pbuf;
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"record: %V path: '%V'", &rracf->id, path);
}
@ -432,7 +432,7 @@ ngx_rtmp_record_notify_error(ngx_rtmp_session_t *s,
static ngx_int_t
ngx_rtmp_record_node_open(ngx_rtmp_session_t *s,
ngx_rtmp_record_node_open(ngx_rtmp_session_t *s,
ngx_rtmp_record_rec_ctx_t *rctx)
{
ngx_rtmp_record_app_conf_t *rracf;
@ -450,7 +450,7 @@ ngx_rtmp_record_node_open(ngx_rtmp_session_t *s,
return NGX_AGAIN;
}
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"record: %V opening", &rracf->id);
ngx_memzero(rctx, sizeof(*rctx));
@ -494,7 +494,7 @@ ngx_rtmp_record_node_open(ngx_rtmp_session_t *s,
}
#endif
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"record: %V opened '%V'", &rracf->id, &path);
if (rracf->notify) {
@ -720,7 +720,7 @@ ngx_rtmp_record_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
return NGX_ERROR;
}
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"record: publish %ui nodes",
racf->rec.nelts);
@ -732,8 +732,8 @@ ngx_rtmp_record_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
/* terminate name on /../ */
for (p = ctx->name; *p; ++p) {
if (ngx_path_separator(p[0]) &&
p[1] == '.' && p[2] == '.' &&
ngx_path_separator(p[3]))
p[1] == '.' && p[2] == '.' &&
ngx_path_separator(p[3]))
{
*p = 0;
break;
@ -807,7 +807,7 @@ ngx_rtmp_record_node_close(ngx_rtmp_session_t *s,
rctx->file.fd = NGX_INVALID_FILE;
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"record: %V closed", &rracf->id);
if (rracf->notify) {
@ -833,14 +833,14 @@ ngx_rtmp_record_node_close(ngx_rtmp_session_t *s,
static ngx_int_t
ngx_rtmp_record_close_stream(ngx_rtmp_session_t *s,
ngx_rtmp_record_close_stream(ngx_rtmp_session_t *s,
ngx_rtmp_close_stream_t *v)
{
if (s->auto_pushed) {
goto next;
}
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"record: close_stream");
ngx_rtmp_record_stop(s);
@ -851,7 +851,7 @@ next:
static ngx_int_t
ngx_rtmp_record_write_frame(ngx_rtmp_session_t *s,
ngx_rtmp_record_write_frame(ngx_rtmp_session_t *s,
ngx_rtmp_record_rec_ctx_t *rctx,
ngx_rtmp_header_t *h, ngx_chain_t *in,
ngx_int_t inc_nframes)
@ -891,7 +891,7 @@ ngx_rtmp_record_write_frame(ngx_rtmp_session_t *s,
tag_size = (ph - hdr) + h->mlen;
if (ngx_write_file(&rctx->file, hdr, ph - hdr, rctx->file.offset)
== NGX_ERROR)
== NGX_ERROR)
{
ngx_rtmp_record_notify_error(s, rctx);
@ -911,7 +911,7 @@ ngx_rtmp_record_write_frame(ngx_rtmp_session_t *s,
continue;
}
if (ngx_write_file(&rctx->file, in->buf->pos, in->buf->last
if (ngx_write_file(&rctx->file, in->buf->pos, in->buf->last
- in->buf->pos, rctx->file.offset)
== NGX_ERROR)
{
@ -928,9 +928,9 @@ ngx_rtmp_record_write_frame(ngx_rtmp_session_t *s,
*ph++ = p[1];
*ph++ = p[0];
if (ngx_write_file(&rctx->file, hdr, ph - hdr,
if (ngx_write_file(&rctx->file, hdr, ph - hdr,
rctx->file.offset)
== NGX_ERROR)
== NGX_ERROR)
{
return NGX_ERROR;
}
@ -962,7 +962,7 @@ ngx_rtmp_record_get_chain_mlen(ngx_chain_t *in)
static ngx_int_t
ngx_rtmp_record_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_rtmp_record_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
ngx_rtmp_record_ctx_t *ctx;
@ -1076,7 +1076,7 @@ ngx_rtmp_record_node_av(ngx_rtmp_session_t *s, ngx_rtmp_record_rec_ctx_t *rctx,
if (!rctx->aac_header_sent && codec_ctx->aac_header &&
(rracf->flags & NGX_RTMP_RECORD_AUDIO))
{
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"record: %V writing AAC header", &rracf->id);
ch.type = NGX_RTMP_MSG_AUDIO;
@ -1084,7 +1084,7 @@ ngx_rtmp_record_node_av(ngx_rtmp_session_t *s, ngx_rtmp_record_rec_ctx_t *rctx,
if (ngx_rtmp_record_write_frame(s, rctx, &ch,
codec_ctx->aac_header, 0)
!= NGX_OK)
!= NGX_OK)
{
return NGX_OK;
}
@ -1093,11 +1093,11 @@ ngx_rtmp_record_node_av(ngx_rtmp_session_t *s, ngx_rtmp_record_rec_ctx_t *rctx,
}
/* AVC header */
if (!rctx->avc_header_sent && codec_ctx->avc_header &&
if (!rctx->avc_header_sent && codec_ctx->avc_header &&
(rracf->flags & (NGX_RTMP_RECORD_VIDEO|
NGX_RTMP_RECORD_KEYFRAMES)))
{
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"record: %V writing AVC header", &rracf->id);
ch.type = NGX_RTMP_MSG_VIDEO;
@ -1105,7 +1105,7 @@ ngx_rtmp_record_node_av(ngx_rtmp_session_t *s, ngx_rtmp_record_rec_ctx_t *rctx,
if (ngx_rtmp_record_write_frame(s, rctx, &ch,
codec_ctx->avc_header, 0)
!= NGX_OK)
!= NGX_OK)
{
return NGX_OK;
}
@ -1118,7 +1118,7 @@ ngx_rtmp_record_node_av(ngx_rtmp_session_t *s, ngx_rtmp_record_rec_ctx_t *rctx,
if (codec_ctx && codec_ctx->video_codec_id == NGX_RTMP_VIDEO_H264 &&
!rctx->avc_header_sent)
{
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"record: %V skipping until H264 header", &rracf->id);
return NGX_OK;
}
@ -1129,9 +1129,9 @@ ngx_rtmp_record_node_av(ngx_rtmp_session_t *s, ngx_rtmp_record_rec_ctx_t *rctx,
{
rctx->video_key_sent = 1;
}
if (!rctx->video_key_sent) {
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"record: %V skipping until keyframe", &rracf->id);
return NGX_OK;
}
@ -1140,7 +1140,7 @@ ngx_rtmp_record_node_av(ngx_rtmp_session_t *s, ngx_rtmp_record_rec_ctx_t *rctx,
if (codec_ctx && codec_ctx->audio_codec_id == NGX_RTMP_AUDIO_AAC &&
!rctx->aac_header_sent)
{
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"record: %V skipping until AAC header", &rracf->id);
return NGX_OK;
}
@ -1198,7 +1198,7 @@ ngx_rtmp_record_recorder(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
module = ngx_modules[i]->ctx;
if (module->create_app_conf) {
ctx->app_conf[ngx_modules[i]->ctx_index] =
ctx->app_conf[ngx_modules[i]->ctx_index] =
module->create_app_conf(cf);
if (ctx->app_conf[ngx_modules[i]->ctx_index] == NULL) {
return NGX_CONF_ERROR;

View File

@ -69,7 +69,7 @@ ngx_uint_t ngx_rtmp_record_find(ngx_rtmp_record_app_conf_t *racf,
* 'n' is record node index in config array.
* Note: these functions allocate path in static buffer */
ngx_int_t ngx_rtmp_record_open(ngx_rtmp_session_t *s, ngx_uint_t n,
ngx_int_t ngx_rtmp_record_open(ngx_rtmp_session_t *s, ngx_uint_t n,
ngx_str_t *path);
ngx_int_t ngx_rtmp_record_close(ngx_rtmp_session_t *s, ngx_uint_t n,
ngx_str_t *path);
@ -81,7 +81,7 @@ typedef struct {
} ngx_rtmp_record_done_t;
typedef ngx_int_t (*ngx_rtmp_record_done_pt)(ngx_rtmp_session_t *s,
typedef ngx_int_t (*ngx_rtmp_record_done_pt)(ngx_rtmp_session_t *s,
ngx_rtmp_record_done_t *v);

View File

@ -19,11 +19,11 @@ static ngx_rtmp_close_stream_pt next_close_stream;
static ngx_int_t ngx_rtmp_relay_init_process(ngx_cycle_t *cycle);
static ngx_int_t ngx_rtmp_relay_postconfiguration(ngx_conf_t *cf);
static void * ngx_rtmp_relay_create_app_conf(ngx_conf_t *cf);
static char * ngx_rtmp_relay_merge_app_conf(ngx_conf_t *cf,
static char * ngx_rtmp_relay_merge_app_conf(ngx_conf_t *cf,
void *parent, void *child);
static char * ngx_rtmp_relay_push_pull(ngx_conf_t *cf, ngx_command_t *cmd,
static char * ngx_rtmp_relay_push_pull(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
static ngx_int_t ngx_rtmp_relay_publish(ngx_rtmp_session_t *s,
static ngx_int_t ngx_rtmp_relay_publish(ngx_rtmp_session_t *s,
ngx_rtmp_publish_t *v);
static ngx_rtmp_relay_ctx_t * ngx_rtmp_relay_create_connection(
ngx_rtmp_conf_ctx_t *cctx, ngx_str_t* name,
@ -107,7 +107,7 @@ static ngx_command_t ngx_rtmp_relay_commands[] = {
NGX_RTMP_APP_CONF_OFFSET,
offsetof(ngx_rtmp_relay_app_conf_t, push_reconnect),
NULL },
{ ngx_string("pull_reconnect"),
NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
ngx_conf_set_msec_slot,
@ -202,14 +202,14 @@ ngx_rtmp_relay_merge_app_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_rtmp_relay_app_conf_t *prev = parent;
ngx_rtmp_relay_app_conf_t *conf = child;
conf->ctx = ngx_pcalloc(cf->pool, sizeof(ngx_rtmp_relay_ctx_t *)
conf->ctx = ngx_pcalloc(cf->pool, sizeof(ngx_rtmp_relay_ctx_t *)
* conf->nbuckets);
ngx_conf_merge_value(conf->session_relay, prev->session_relay, 0);
ngx_conf_merge_msec_value(conf->buflen, prev->buflen, 5000);
ngx_conf_merge_msec_value(conf->push_reconnect, prev->push_reconnect,
ngx_conf_merge_msec_value(conf->push_reconnect, prev->push_reconnect,
3000);
ngx_conf_merge_msec_value(conf->pull_reconnect, prev->pull_reconnect,
ngx_conf_merge_msec_value(conf->pull_reconnect, prev->pull_reconnect,
3000);
return NGX_CONF_OK;
@ -251,9 +251,9 @@ ngx_rtmp_relay_push_reconnect(ngx_event_t *ev)
ngx_uint_t n;
ngx_rtmp_relay_target_t *target, **t;
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"relay: push reconnect");
racf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_relay_module);
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_relay_module);
@ -273,7 +273,7 @@ ngx_rtmp_relay_push_reconnect(ngx_event_t *ev)
for (pctx = ctx->play; pctx; pctx = pctx->next) {
if (pctx->tag == &ngx_rtmp_relay_module &&
pctx->data == target)
pctx->data == target)
{
break;
}
@ -290,7 +290,7 @@ ngx_rtmp_relay_push_reconnect(ngx_event_t *ev)
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
"relay: push reconnect failed name='%V' app='%V' "
"playpath='%V' url='%V'",
&ctx->name, &target->app, &target->play_path,
&ctx->name, &target->app, &target->play_path,
&target->url.url);
if (!ctx->push_evt.timer_set) {
@ -300,14 +300,14 @@ ngx_rtmp_relay_push_reconnect(ngx_event_t *ev)
}
static ngx_int_t
static ngx_int_t
ngx_rtmp_relay_get_peer(ngx_peer_connection_t *pc, void *data)
{
return NGX_OK;
}
static void
static void
ngx_rtmp_relay_free_peer(ngx_peer_connection_t *pc, void *data,
ngx_uint_t state)
{
@ -353,7 +353,7 @@ ngx_rtmp_relay_create_connection(ngx_rtmp_conf_ctx_t *cctx, ngx_str_t* name,
racf = ngx_rtmp_get_module_app_conf(cctx, ngx_rtmp_relay_module);
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, racf->log, 0,
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, racf->log, 0,
"relay: create remote context");
pool = NULL;
@ -429,8 +429,8 @@ ngx_rtmp_relay_create_connection(ngx_rtmp_conf_ctx_t *cctx, ngx_str_t* name,
if (rctx->play_path.len == 0 && p != last) {
v.data = p;
v.len = last - p;
if (ngx_rtmp_relay_copy_str(pool, &rctx->play_path, &v)
!= NGX_OK)
if (ngx_rtmp_relay_copy_str(pool, &rctx->play_path, &v)
!= NGX_OK)
{
goto clear;
}
@ -468,7 +468,7 @@ ngx_rtmp_relay_create_connection(ngx_rtmp_conf_ctx_t *cctx, ngx_str_t* name,
rc = ngx_event_connect_peer(pc);
if (rc != NGX_OK && rc != NGX_AGAIN ) {
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, racf->log, 0,
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, racf->log, 0,
"relay: connection failed");
goto clear;
}
@ -499,7 +499,7 @@ ngx_rtmp_relay_create_connection(ngx_rtmp_conf_ctx_t *cctx, ngx_str_t* name,
rctx->session = rs;
ngx_rtmp_set_ctx(rs, rctx, ngx_rtmp_relay_module);
ngx_str_set(&rs->flashver, "ngx-local-relay");
#if (NGX_STAT_STUB)
(void) ngx_atomic_fetch_add(ngx_stat_active, 1);
#endif
@ -535,7 +535,7 @@ ngx_rtmp_relay_create_local_ctx(ngx_rtmp_session_t *s, ngx_str_t *name,
{
ngx_rtmp_relay_ctx_t *ctx;
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"relay: create local context");
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_relay_module);
@ -556,8 +556,8 @@ ngx_rtmp_relay_create_local_ctx(ngx_rtmp_session_t *s, ngx_str_t *name,
return NULL;
}
if (ngx_rtmp_relay_copy_str(s->connection->pool, &ctx->name, name)
!= NGX_OK)
if (ngx_rtmp_relay_copy_str(s->connection->pool, &ctx->name, name)
!= NGX_OK)
{
return NULL;
}
@ -591,7 +591,7 @@ ngx_rtmp_relay_create(ngx_rtmp_session_t *s, ngx_str_t *name,
cctx = &racf->ctx[hash % racf->nbuckets];
for (; *cctx; cctx = &(*cctx)->next) {
if ((*cctx)->name.len == name->len
&& !ngx_memcmp(name->data, (*cctx)->name.data,
&& !ngx_memcmp(name->data, (*cctx)->name.data,
name->len))
{
break;
@ -624,7 +624,7 @@ ngx_int_t
ngx_rtmp_relay_pull(ngx_rtmp_session_t *s, ngx_str_t *name,
ngx_rtmp_relay_target_t *target)
{
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
"relay: create pull name='%V' app='%V' playpath='%V' url='%V'",
name, &target->app, &target->play_path, &target->url.url);
@ -638,7 +638,7 @@ ngx_int_t
ngx_rtmp_relay_push(ngx_rtmp_session_t *s, ngx_str_t *name,
ngx_rtmp_relay_target_t *target)
{
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
"relay: create push name='%V' app='%V' playpath='%V' url='%V'",
name, &target->app, &target->play_path, &target->url.url);
@ -691,7 +691,7 @@ ngx_rtmp_relay_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
"relay: push failed name='%V' app='%V' "
"playpath='%V' url='%V'",
&name, &target->app, &target->play_path,
&name, &target->app, &target->play_path,
&target->url.url);
if (!ctx->push_evt.timer_set) {
@ -743,7 +743,7 @@ ngx_rtmp_relay_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
"relay: pull failed name='%V' app='%V' "
"playpath='%V' url='%V'",
&name, &target->app, &target->play_path,
&name, &target->app, &target->play_path,
&target->url.url);
}
@ -765,7 +765,7 @@ ngx_rtmp_relay_play_local(ngx_rtmp_session_t *s)
ngx_memzero(&v, sizeof(ngx_rtmp_play_t));
v.silent = 1;
*(ngx_cpymem(v.name, ctx->name.data,
*(ngx_cpymem(v.name, ctx->name.data,
ngx_min(sizeof(v.name) - 1, ctx->name.len))) = 0;
return ngx_rtmp_play(s, &v);
@ -785,7 +785,7 @@ ngx_rtmp_relay_publish_local(ngx_rtmp_session_t *s)
ngx_memzero(&v, sizeof(ngx_rtmp_publish_t));
v.silent = 1;
*(ngx_cpymem(v.name, ctx->name.data,
*(ngx_cpymem(v.name, ctx->name.data,
ngx_min(sizeof(v.name) - 1, ctx->name.len))) = 0;
return ngx_rtmp_publish(s, &v);
@ -801,23 +801,23 @@ ngx_rtmp_relay_send_connect(ngx_rtmp_session_t *s)
static ngx_rtmp_amf_elt_t out_cmd[] = {
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("app"),
NULL, 0 }, /* <-- fill */
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("tcUrl"),
NULL, 0 }, /* <-- fill */
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("pageUrl"),
NULL, 0 }, /* <-- fill */
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("swfUrl"),
NULL, 0 }, /* <-- fill */
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("flashVer"),
NULL, 0 }, /* <-- fill */
@ -833,7 +833,7 @@ ngx_rtmp_relay_send_connect(ngx_rtmp_session_t *s)
static ngx_rtmp_amf_elt_t out_elts[] = {
{ NGX_RTMP_AMF_STRING,
ngx_null_string,
ngx_null_string,
"connect", 0 },
{ NGX_RTMP_AMF_NUMBER,
@ -874,7 +874,7 @@ ngx_rtmp_relay_send_connect(ngx_rtmp_session_t *s)
out_cmd[1].data = ctx->tc_url.data;
out_cmd[1].len = ctx->tc_url.len;
} else {
len = sizeof("rtmp://") - 1 + ctx->url.len +
len = sizeof("rtmp://") - 1 + ctx->url.len +
sizeof("/") - 1 + ctx->app.len;
p = ngx_palloc(s->connection->pool, len);
if (p == NULL) {
@ -921,7 +921,7 @@ ngx_rtmp_relay_send_connect(ngx_rtmp_session_t *s)
|| ngx_rtmp_send_amf(s, &h, out_elts,
sizeof(out_elts) / sizeof(out_elts[0])) != NGX_OK
? NGX_ERROR
: NGX_OK;
: NGX_OK;
}
@ -933,7 +933,7 @@ ngx_rtmp_relay_send_create_stream(ngx_rtmp_session_t *s)
static ngx_rtmp_amf_elt_t out_elts[] = {
{ NGX_RTMP_AMF_STRING,
ngx_null_string,
ngx_null_string,
"createStream", 0 },
{ NGX_RTMP_AMF_NUMBER,
@ -965,7 +965,7 @@ ngx_rtmp_relay_send_publish(ngx_rtmp_session_t *s)
static ngx_rtmp_amf_elt_t out_elts[] = {
{ NGX_RTMP_AMF_STRING,
ngx_null_string,
ngx_null_string,
"publish", 0 },
{ NGX_RTMP_AMF_NUMBER,
@ -1021,7 +1021,7 @@ ngx_rtmp_relay_send_play(ngx_rtmp_session_t *s)
static ngx_rtmp_amf_elt_t out_elts[] = {
{ NGX_RTMP_AMF_STRING,
ngx_null_string,
ngx_null_string,
"play", 0 },
{ NGX_RTMP_AMF_NUMBER,
@ -1079,7 +1079,7 @@ ngx_rtmp_relay_send_play(ngx_rtmp_session_t *s)
return ngx_rtmp_send_amf(s, &h, out_elts,
sizeof(out_elts) / sizeof(out_elts[0])) != NGX_OK
|| ngx_rtmp_send_set_buflen(s, NGX_RTMP_RELAY_MSID,
|| ngx_rtmp_send_set_buflen(s, NGX_RTMP_RELAY_MSID,
racf->buflen) != NGX_OK
? NGX_ERROR
: NGX_OK;
@ -1100,11 +1100,11 @@ ngx_rtmp_relay_on_result(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_rtmp_amf_elt_t in_inf[] = {
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("level"),
&v.level, sizeof(v.level) },
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("code"),
&v.code, sizeof(v.code) },
@ -1135,13 +1135,13 @@ ngx_rtmp_relay_on_result(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
}
ngx_memzero(&v, sizeof(v));
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
{
return NGX_ERROR;
}
ngx_log_debug3(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug3(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"relay: _result: level='%s' code='%s' description='%s'",
v.level, v.code, v.desc);
@ -1183,11 +1183,11 @@ ngx_rtmp_relay_on_error(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_rtmp_amf_elt_t in_inf[] = {
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("level"),
&v.level, sizeof(v.level) },
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("code"),
&v.code, sizeof(v.code) },
@ -1218,13 +1218,13 @@ ngx_rtmp_relay_on_error(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
}
ngx_memzero(&v, sizeof(v));
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
if (ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0])))
{
return NGX_ERROR;
}
ngx_log_debug3(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug3(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"relay: _error: level='%s' code='%s' description='%s'",
v.level, v.code, v.desc);
@ -1246,11 +1246,11 @@ ngx_rtmp_relay_on_status(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_rtmp_amf_elt_t in_inf[] = {
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("level"),
&v.level, sizeof(v.level) },
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("code"),
&v.code, sizeof(v.code) },
@ -1289,14 +1289,14 @@ ngx_rtmp_relay_on_status(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_memzero(&v, sizeof(v));
if (h->type == NGX_RTMP_MSG_AMF_META) {
ngx_rtmp_receive_amf(s, in, in_elts_meta,
ngx_rtmp_receive_amf(s, in, in_elts_meta,
sizeof(in_elts_meta) / sizeof(in_elts_meta[0]));
} else {
ngx_rtmp_receive_amf(s, in, in_elts,
ngx_rtmp_receive_amf(s, in, in_elts,
sizeof(in_elts) / sizeof(in_elts[0]));
}
ngx_log_debug3(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
ngx_log_debug3(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"relay: onStatus: level='%s' code='%s' description='%s'",
v.level, v.code, v.desc);
@ -1351,13 +1351,13 @@ ngx_rtmp_relay_close(ngx_rtmp_session_t *s)
}
}
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, ctx->session->connection->log, 0,
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, ctx->session->connection->log, 0,
"relay: play disconnect app='%V' name='%V'",
&ctx->app, &ctx->name);
/* push reconnect */
if (s->relay && ctx->tag == &ngx_rtmp_relay_module &&
!ctx->publish->push_evt.timer_set)
if (s->relay && ctx->tag == &ngx_rtmp_relay_module &&
!ctx->publish->push_evt.timer_set)
{
ngx_add_timer(&ctx->publish->push_evt, racf->push_reconnect);
}
@ -1373,8 +1373,8 @@ ngx_rtmp_relay_close(ngx_rtmp_session_t *s)
#endif
if (ctx->publish->play == NULL && ctx->publish->session->relay) {
ngx_log_debug2(NGX_LOG_DEBUG_RTMP,
ctx->publish->session->connection->log, 0,
ngx_log_debug2(NGX_LOG_DEBUG_RTMP,
ctx->publish->session->connection->log, 0,
"relay: publish disconnect empty app='%V' name='%V'",
&ctx->app, &ctx->name);
ngx_rtmp_finalize_session(ctx->publish->session);
@ -1386,7 +1386,7 @@ ngx_rtmp_relay_close(ngx_rtmp_session_t *s)
}
/* publish end disconnect */
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, ctx->session->connection->log, 0,
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, ctx->session->connection->log, 0,
"relay: publish disconnect app='%V' name='%V'",
&ctx->app, &ctx->name);
@ -1396,7 +1396,7 @@ ngx_rtmp_relay_close(ngx_rtmp_session_t *s)
for (cctx = &ctx->play; *cctx; cctx = &(*cctx)->next) {
(*cctx)->publish = NULL;
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, (*cctx)->session->connection->log,
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, (*cctx)->session->connection->log,
0, "relay: play disconnect orphan app='%V' name='%V'",
&(*cctx)->app, &(*cctx)->name);
ngx_rtmp_finalize_session((*cctx)->session);
@ -1472,7 +1472,7 @@ ngx_rtmp_relay_push_pull(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
u->url.data += 7;
u->url.len -= 7;
}
if (ngx_parse_url(cf->pool, u) != NGX_OK) {
if (u->err) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
@ -1622,7 +1622,7 @@ ngx_rtmp_relay_init_process(ngx_cycle_t *cycle)
pcscf = cmcf->servers.elts;
for (n = 0; n < cmcf->servers.nelts; ++n, ++pcscf) {
cscf = *pcscf;
pcacf = cscf->applications.elts;

View File

@ -6,7 +6,7 @@
#ifndef _NGX_RTMP_RELAY_H_INCLUDED_
#define _NGX_RTMP_RELAY_H_INCLUDED_
#include <ngx_config.h>
#include <ngx_core.h>

View File

@ -26,7 +26,7 @@
if (__l == NULL) { \
return NULL; \
} \
__b = __l->buf;
__b = __l->buf;
#define NGX_RTMP_UCTL_START(s, type, utype) \
NGX_RTMP_USER_START(s, type); \
@ -170,7 +170,7 @@ ngx_rtmp_create_bandwidth(ngx_rtmp_session_t *s, uint32_t ack_size,
uint8_t limit_type)
{
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"create: bandwidth ack_size=%uD limit=%d",
"create: bandwidth ack_size=%uD limit=%d",
ack_size, (int)limit_type);
{
@ -224,7 +224,7 @@ ngx_rtmp_create_stream_eof(ngx_rtmp_session_t *s, uint32_t msid)
{
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);
@ -268,7 +268,7 @@ ngx_rtmp_send_stream_dry(ngx_rtmp_session_t *s, uint32_t msid)
ngx_chain_t *
ngx_rtmp_create_set_buflen(ngx_rtmp_session_t *s, uint32_t msid,
ngx_rtmp_create_set_buflen(ngx_rtmp_session_t *s, uint32_t msid,
uint32_t buflen_msec)
{
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
@ -287,7 +287,7 @@ ngx_rtmp_create_set_buflen(ngx_rtmp_session_t *s, uint32_t msid,
ngx_int_t
ngx_rtmp_send_set_buflen(ngx_rtmp_session_t *s, uint32_t msid,
ngx_rtmp_send_set_buflen(ngx_rtmp_session_t *s, uint32_t msid,
uint32_t buflen_msec)
{
return ngx_rtmp_send_shared_packet(s,
@ -296,7 +296,7 @@ ngx_rtmp_send_set_buflen(ngx_rtmp_session_t *s, uint32_t msid,
ngx_chain_t *
ngx_rtmp_create_recorded(ngx_rtmp_session_t *s, uint32_t msid)
ngx_rtmp_create_recorded(ngx_rtmp_session_t *s, uint32_t msid)
{
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"create: recorded msid=%uD", msid);
@ -312,7 +312,7 @@ ngx_rtmp_create_recorded(ngx_rtmp_session_t *s, uint32_t msid)
ngx_int_t
ngx_rtmp_send_recorded(ngx_rtmp_session_t *s, uint32_t msid)
ngx_rtmp_send_recorded(ngx_rtmp_session_t *s, uint32_t msid)
{
return ngx_rtmp_send_shared_packet(s,
ngx_rtmp_create_recorded(s, msid));
@ -320,7 +320,7 @@ ngx_rtmp_send_recorded(ngx_rtmp_session_t *s, uint32_t msid)
ngx_chain_t *
ngx_rtmp_create_ping_request(ngx_rtmp_session_t *s, uint32_t timestamp)
ngx_rtmp_create_ping_request(ngx_rtmp_session_t *s, uint32_t timestamp)
{
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"create: ping_request timestamp=%uD", timestamp);
@ -336,7 +336,7 @@ ngx_rtmp_create_ping_request(ngx_rtmp_session_t *s, uint32_t timestamp)
ngx_int_t
ngx_rtmp_send_ping_request(ngx_rtmp_session_t *s, uint32_t timestamp)
ngx_rtmp_send_ping_request(ngx_rtmp_session_t *s, uint32_t timestamp)
{
return ngx_rtmp_send_shared_packet(s,
ngx_rtmp_create_ping_request(s, timestamp));
@ -344,7 +344,7 @@ ngx_rtmp_send_ping_request(ngx_rtmp_session_t *s, uint32_t timestamp)
ngx_chain_t *
ngx_rtmp_create_ping_response(ngx_rtmp_session_t *s, uint32_t timestamp)
ngx_rtmp_create_ping_response(ngx_rtmp_session_t *s, uint32_t timestamp)
{
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"create: ping_response timestamp=%uD", timestamp);
@ -360,14 +360,14 @@ ngx_rtmp_create_ping_response(ngx_rtmp_session_t *s, uint32_t timestamp)
ngx_int_t
ngx_rtmp_send_ping_response(ngx_rtmp_session_t *s, uint32_t timestamp)
ngx_rtmp_send_ping_response(ngx_rtmp_session_t *s, uint32_t timestamp)
{
return ngx_rtmp_send_shared_packet(s,
ngx_rtmp_create_ping_response(s, timestamp));
}
static ngx_chain_t *
static ngx_chain_t *
ngx_rtmp_alloc_amf_buf(void *arg)
{
return ngx_rtmp_alloc_shared_buf((ngx_rtmp_core_srv_conf_t *)arg);
@ -379,7 +379,7 @@ ngx_rtmp_alloc_amf_buf(void *arg)
/* NOTE: this function does not free shared bufs on error */
ngx_int_t
ngx_rtmp_append_amf(ngx_rtmp_session_t *s,
ngx_chain_t **first, ngx_chain_t **last,
ngx_chain_t **first, ngx_chain_t **last,
ngx_rtmp_amf_elt_t *elts, size_t nelts)
{
ngx_rtmp_amf_ctx_t act;
@ -463,26 +463,26 @@ ngx_rtmp_create_status(ngx_rtmp_session_t *s, char *code, char* level,
static ngx_rtmp_amf_elt_t out_inf[] = {
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("level"),
NULL, 0 },
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("code"),
NULL, 0 },
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("description"),
NULL, 0 },
};
static ngx_rtmp_amf_elt_t out_elts[] = {
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_null_string,
"onStatus", 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_null_string,
&trans, 0 },
@ -510,7 +510,7 @@ ngx_rtmp_create_status(ngx_rtmp_session_t *s, char *code, char* level,
h.csid = NGX_RTMP_CSID_AMF;
h.msid = NGX_RTMP_MSID;
return ngx_rtmp_create_amf(s, &h, out_elts,
return ngx_rtmp_create_amf(s, &h, out_elts,
sizeof(out_elts) / sizeof(out_elts[0]));
}
@ -533,26 +533,26 @@ ngx_rtmp_create_play_status(ngx_rtmp_session_t *s, char *code, char* level,
static ngx_rtmp_amf_elt_t out_inf[] = {
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("code"),
NULL, 0 },
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_string("level"),
NULL, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("duration"),
&dduration, 0 },
{ NGX_RTMP_AMF_NUMBER,
{ NGX_RTMP_AMF_NUMBER,
ngx_string("bytes"),
&dbytes, 0 },
};
static ngx_rtmp_amf_elt_t out_elts[] = {
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_null_string,
"onPlayStatus", 0 },
@ -580,7 +580,7 @@ ngx_rtmp_create_play_status(ngx_rtmp_session_t *s, char *code, char* level,
h.msid = NGX_RTMP_MSID;
h.timestamp = duration;
return ngx_rtmp_create_amf(s, &h, out_elts,
return ngx_rtmp_create_amf(s, &h, out_elts,
sizeof(out_elts) / sizeof(out_elts[0]));
}
@ -603,7 +603,7 @@ ngx_rtmp_create_sample_access(ngx_rtmp_session_t *s)
static ngx_rtmp_amf_elt_t access_elts[] = {
{ NGX_RTMP_AMF_STRING,
{ NGX_RTMP_AMF_STRING,
ngx_null_string,
"|RtmpSampleAccess", 0 },

View File

@ -9,7 +9,7 @@
#include "ngx_rtmp.h"
ngx_chain_t *
ngx_chain_t *
ngx_rtmp_alloc_shared_buf(ngx_rtmp_core_srv_conf_t *cscf)
{
u_char *p;
@ -25,7 +25,7 @@ ngx_rtmp_alloc_shared_buf(ngx_rtmp_core_srv_conf_t *cscf)
size = cscf->chunk_size + NGX_RTMP_MAX_CHUNK_HEADER;
p = ngx_pcalloc(cscf->pool, NGX_RTMP_REFCOUNT_BYTES
p = ngx_pcalloc(cscf->pool, NGX_RTMP_REFCOUNT_BYTES
+ sizeof(ngx_chain_t)
+ sizeof(ngx_buf_t)
+ size);
@ -56,7 +56,7 @@ ngx_rtmp_alloc_shared_buf(ngx_rtmp_core_srv_conf_t *cscf)
}
void
void
ngx_rtmp_free_shared_chain(ngx_rtmp_core_srv_conf_t *cscf, ngx_chain_t *in)
{
ngx_chain_t *cl;
@ -76,7 +76,7 @@ ngx_rtmp_free_shared_chain(ngx_rtmp_core_srv_conf_t *cscf, ngx_chain_t *in)
ngx_chain_t *
ngx_rtmp_append_shared_bufs(ngx_rtmp_core_srv_conf_t *cscf,
ngx_rtmp_append_shared_bufs(ngx_rtmp_core_srv_conf_t *cscf,
ngx_chain_t *head, ngx_chain_t *in)
{
ngx_chain_t *l, **ll;
@ -105,7 +105,7 @@ ngx_rtmp_append_shared_bufs(ngx_rtmp_core_srv_conf_t *cscf,
}
while (l->buf->end - l->buf->last >= in->buf->last - p) {
l->buf->last = ngx_cpymem(l->buf->last, p,
l->buf->last = ngx_cpymem(l->buf->last, p,
in->buf->last - p);
in = in->next;
if (in == NULL) {

View File

@ -19,7 +19,7 @@ static ngx_int_t ngx_rtmp_stat_init_process(ngx_cycle_t *cycle);
static char *ngx_rtmp_stat(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
static ngx_int_t ngx_rtmp_stat_postconfiguration(ngx_conf_t *cf);
static void * ngx_rtmp_stat_create_loc_conf(ngx_conf_t *cf);
static char * ngx_rtmp_stat_merge_loc_conf(ngx_conf_t *cf,
static char * ngx_rtmp_stat_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
@ -49,7 +49,7 @@ static ngx_conf_bitmask_t ngx_rtmp_stat_masks[] = {
{ ngx_string("live"), NGX_RTMP_STAT_LIVE },
{ ngx_string("clients"), NGX_RTMP_STAT_CLIENTS },
{ ngx_null_string, 0 }
};
};
static ngx_command_t ngx_rtmp_stat_commands[] = {
@ -109,7 +109,7 @@ ngx_module_t ngx_rtmp_stat_module = {
static ngx_int_t
ngx_rtmp_stat_init_process(ngx_cycle_t *cycle)
{
/*
/*
* HTTP process initializer is called
* after event module initializer
* so we can run posted events here
@ -159,7 +159,7 @@ ngx_rtmp_stat_escape(ngx_http_request_t *r, void *data, size_t len)
}
#if (NGX_WIN32)
/*
/*
* Fix broken MSVC memcpy optimization for 4-byte data
* when this function is inlined
*/
@ -199,7 +199,7 @@ ngx_rtmp_stat_output(ngx_http_request_t *r, ngx_chain_t ***lll,
if (cl == NULL) {
return;
}
b = ngx_create_temp_buf(r->pool,
b = ngx_create_temp_buf(r->pool,
ngx_max(NGX_RTMP_STAT_BUFSIZE, real_len));
if (b == NULL || b->pos == NULL) {
return;
@ -255,22 +255,22 @@ ngx_rtmp_stat_bw(ngx_http_request_t *r, ngx_chain_t ***lll,
ngx_rtmp_update_bandwidth(bw_out, 0);
NGX_RTMP_STAT_L("<in>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(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),
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(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),
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(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),
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%uL", bw_out->bandwidth * 8) - buf);
NGX_RTMP_STAT_L("</bwout>\r\n");
}
@ -300,7 +300,7 @@ ngx_rtmp_stat_get_pool_size(ngx_pool_t *pool, ngx_uint_t *nlarge,
static void
ngx_rtmp_stat_dump_pool(ngx_http_request_t *r, ngx_chain_t ***lll,
ngx_rtmp_stat_dump_pool(ngx_http_request_t *r, ngx_chain_t ***lll,
ngx_pool_t *pool)
{
ngx_uint_t nlarge, size;
@ -363,7 +363,7 @@ ngx_rtmp_stat_client(ngx_http_request_t *r, ngx_chain_t ***lll,
static void
ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
ngx_rtmp_live_app_conf_t *lacf)
{
ngx_rtmp_live_stream_t *stream;
@ -412,20 +412,20 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
ngx_rtmp_stat_client(r, lll, s);
NGX_RTMP_STAT_L("<dropped>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%ui", ctx->ndropped) - buf);
NGX_RTMP_STAT_L("</dropped>");
NGX_RTMP_STAT_L("<avsync>");
if (!lacf->interleave) {
NGX_RTMP_STAT(bbuf, ngx_snprintf(bbuf, sizeof(bbuf),
NGX_RTMP_STAT(bbuf, ngx_snprintf(bbuf, sizeof(bbuf),
"%D", ctx->cs[1].timestamp -
ctx->cs[0].timestamp) - bbuf);
}
NGX_RTMP_STAT_L("</avsync>");
NGX_RTMP_STAT_L("<timestamp>");
NGX_RTMP_STAT(bbuf, ngx_snprintf(bbuf, sizeof(bbuf),
NGX_RTMP_STAT(bbuf, ngx_snprintf(bbuf, sizeof(bbuf),
"%D", s->current_time) - bbuf);
NGX_RTMP_STAT_L("</timestamp>");
@ -447,13 +447,13 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
if (codec) {
NGX_RTMP_STAT_L("<meta><width>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%ui", codec->width) - buf);
NGX_RTMP_STAT_L("</width><height>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%ui", codec->height) - buf);
NGX_RTMP_STAT_L("</height><framerate>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%ui", codec->frame_rate) - buf);
NGX_RTMP_STAT_L("</framerate>");
cname = ngx_rtmp_get_video_codec_name(codec->video_codec_id);
@ -482,7 +482,7 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
}
NGX_RTMP_STAT_L("<nclients>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%ui", nclients) - buf);
NGX_RTMP_STAT_L("</nclients>\r\n");
@ -499,7 +499,7 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
}
NGX_RTMP_STAT_L("<nclients>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%ui", total_nclients) - buf);
NGX_RTMP_STAT_L("</nclients>\r\n");
@ -508,7 +508,7 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
static void
ngx_rtmp_stat_play(ngx_http_request_t *r, ngx_chain_t ***lll,
ngx_rtmp_stat_play(ngx_http_request_t *r, ngx_chain_t ***lll,
ngx_rtmp_play_app_conf_t *pacf)
{
ngx_rtmp_play_ctx_t *ctx, *sctx;
@ -551,7 +551,7 @@ ngx_rtmp_stat_play(ngx_http_request_t *r, ngx_chain_t ***lll,
ngx_rtmp_stat_client(r, lll, s);
NGX_RTMP_STAT_L("<timestamp>");
NGX_RTMP_STAT(bbuf, ngx_snprintf(bbuf, sizeof(bbuf),
NGX_RTMP_STAT(bbuf, ngx_snprintf(bbuf, sizeof(bbuf),
"%D", s->current_time) - bbuf);
NGX_RTMP_STAT_L("</timestamp>");
@ -571,7 +571,7 @@ ngx_rtmp_stat_play(ngx_http_request_t *r, ngx_chain_t ***lll,
}
NGX_RTMP_STAT_L("<nclients>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%ui", total_nclients) - buf);
NGX_RTMP_STAT_L("</nclients>\r\n");
@ -580,7 +580,7 @@ ngx_rtmp_stat_play(ngx_http_request_t *r, ngx_chain_t ***lll,
static void
ngx_rtmp_stat_application(ngx_http_request_t *r, ngx_chain_t ***lll,
ngx_rtmp_stat_application(ngx_http_request_t *r, ngx_chain_t ***lll,
ngx_rtmp_core_app_conf_t *cacf)
{
ngx_rtmp_stat_loc_conf_t *slcf;
@ -593,12 +593,12 @@ ngx_rtmp_stat_application(ngx_http_request_t *r, ngx_chain_t ***lll,
slcf = ngx_http_get_module_loc_conf(r, ngx_rtmp_stat_module);
if (slcf->stat & NGX_RTMP_STAT_LIVE) {
ngx_rtmp_stat_live(r, lll,
ngx_rtmp_stat_live(r, lll,
cacf->app_conf[ngx_rtmp_live_module.ctx_index]);
}
if (slcf->stat & NGX_RTMP_STAT_PLAY) {
ngx_rtmp_stat_play(r, lll,
ngx_rtmp_stat_play(r, lll,
cacf->app_conf[ngx_rtmp_play_module.ctx_index]);
}
@ -607,7 +607,7 @@ ngx_rtmp_stat_application(ngx_http_request_t *r, ngx_chain_t ***lll,
static void
ngx_rtmp_stat_server(ngx_http_request_t *r, ngx_chain_t ***lll,
ngx_rtmp_stat_server(ngx_http_request_t *r, ngx_chain_t ***lll,
ngx_rtmp_core_srv_conf_t *cscf)
{
ngx_rtmp_core_app_conf_t **cacf;