Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-07-25 11:04:13 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7865b0e9355dca337084cd1f21c5c8ab7fdf0999
7865b0e9
1 parent
630bdf0c
refine config, check chunk size.
显示空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
43 行增加
和
19 行删除
trunk/src/app/srs_app_config.cpp
trunk/src/kernel/srs_kernel_consts.hpp
trunk/src/rtmp/srs_protocol_stack.cpp
trunk/src/app/srs_app_config.cpp
查看文件 @
7865b0e
...
...
@@ -1181,6 +1181,8 @@ int SrsConfig::check_config()
{
int
ret
=
ERROR_SUCCESS
;
vector
<
SrsConfDirective
*>
vhosts
=
get_vhosts
();
////////////////////////////////////////////////////////////////////////
// check empty
////////////////////////////////////////////////////////////////////////
...
...
@@ -1256,7 +1258,6 @@ int SrsConfig::check_config()
}
}
if
(
true
)
{
vector
<
SrsConfDirective
*>
vhosts
=
get_vhosts
();
for
(
int
i
=
0
;
i
<
(
int
)
vhosts
.
size
();
i
++
)
{
SrsConfDirective
*
conf
=
vhosts
[
i
];
for
(
int
i
=
0
;
conf
&&
i
<
(
int
)
conf
->
directives
.
size
();
i
++
)
{
...
...
@@ -1441,7 +1442,30 @@ int SrsConfig::check_config()
return
ret
;
}
// TODO: FIXME: check others.
////////////////////////////////////////////////////////////////////////
// check chunk size
////////////////////////////////////////////////////////////////////////
if
(
get_global_chunk_size
()
<
SRS_CONSTS_RTMP_MIN_CHUNK_SIZE
||
get_global_chunk_size
()
>
SRS_CONSTS_RTMP_MAX_CHUNK_SIZE
)
{
ret
=
ERROR_SYSTEM_CONFIG_INVALID
;
srs_error
(
"directive chunk_size invalid, chunk_size=%d, must in [%d, %d], ret=%d"
,
get_global_chunk_size
(),
SRS_CONSTS_RTMP_MIN_CHUNK_SIZE
,
SRS_CONSTS_RTMP_MAX_CHUNK_SIZE
,
ret
);
return
ret
;
}
for
(
int
i
=
0
;
i
<
(
int
)
vhosts
.
size
();
i
++
)
{
SrsConfDirective
*
vhost
=
vhosts
[
i
];
if
(
get_chunk_size
(
vhost
->
arg0
())
<
SRS_CONSTS_RTMP_MIN_CHUNK_SIZE
||
get_chunk_size
(
vhost
->
arg0
())
>
SRS_CONSTS_RTMP_MAX_CHUNK_SIZE
)
{
ret
=
ERROR_SYSTEM_CONFIG_INVALID
;
srs_error
(
"directive vhost %s chunk_size invalid, chunk_size=%d, must in [%d, %d], ret=%d"
,
vhost
->
arg0
().
c_str
(),
get_chunk_size
(
vhost
->
arg0
()),
SRS_CONSTS_RTMP_MIN_CHUNK_SIZE
,
SRS_CONSTS_RTMP_MAX_CHUNK_SIZE
,
ret
);
return
ret
;
}
}
////////////////////////////////////////////////////////////////////////
// check log name and level
...
...
@@ -1475,7 +1499,6 @@ int SrsConfig::check_config()
srs_warn
(
"http_api is disabled by configure"
);
}
#endif
vector
<
SrsConfDirective
*>
vhosts
=
get_vhosts
();
for
(
int
i
=
0
;
i
<
(
int
)
vhosts
.
size
();
i
++
)
{
SrsConfDirective
*
vhost
=
vhosts
[
i
];
srs_assert
(
vhost
!=
NULL
);
...
...
trunk/src/kernel/srs_kernel_consts.hpp
查看文件 @
7865b0e
...
...
@@ -50,6 +50,20 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// 6. Chunking, RTMP protocol default chunk size.
#define SRS_CONSTS_RTMP_PROTOCOL_CHUNK_SIZE 128
/**
* 6. Chunking
* The chunk size is configurable. It can be set using a control
* message(Set Chunk Size) as described in section 7.1. The maximum
* chunk size can be 65536 bytes and minimum 128 bytes. Larger values
* reduce CPU usage, but also commit to larger writes that can delay
* other content on lower bandwidth connections. Smaller chunks are not
* good for high-bit rate streaming. Chunk size is maintained
* independently for each direction.
*/
#define SRS_CONSTS_RTMP_MIN_CHUNK_SIZE 128
#define SRS_CONSTS_RTMP_MAX_CHUNK_SIZE 65536
// the following is the timeout for rtmp protocol,
// to avoid death connection.
...
...
trunk/src/rtmp/srs_protocol_stack.cpp
查看文件 @
7865b0e
...
...
@@ -169,19 +169,6 @@ messages.
*****************************************************************************
****************************************************************************/
/**
* 6. Chunking
* The chunk size is configurable. It can be set using a control
* message(Set Chunk Size) as described in section 7.1. The maximum
* chunk size can be 65536 bytes and minimum 128 bytes. Larger values
* reduce CPU usage, but also commit to larger writes that can delay
* other content on lower bandwidth connections. Smaller chunks are not
* good for high-bit rate streaming. Chunk size is maintained
* independently for each direction.
*/
#define RTMP_MIN_CHUNK_SIZE 128
#define RTMP_MAX_CHUNK_SIZE 65536
/**
* 6.1. Chunk Format
* Extended timestamp: 0 or 4 bytes
* This field MUST be sent when the normal timsestamp is set to
...
...
@@ -3724,16 +3711,16 @@ int SrsSetChunkSizePacket::decode(SrsStream* stream)
chunk_size
=
stream
->
read_4bytes
();
srs_info
(
"decode chunk size success. chunk_size=%d"
,
chunk_size
);
if
(
chunk_size
<
RTMP_MIN_CHUNK_SIZE
)
{
if
(
chunk_size
<
SRS_CONSTS_
RTMP_MIN_CHUNK_SIZE
)
{
ret
=
ERROR_RTMP_CHUNK_SIZE
;
srs_error
(
"invalid chunk size. min=%d, actual=%d, ret=%d"
,
ERROR_RTMP_CHUNK_SIZE
,
chunk_size
,
ret
);
return
ret
;
}
if
(
chunk_size
>
RTMP_MAX_CHUNK_SIZE
)
{
if
(
chunk_size
>
SRS_CONSTS_
RTMP_MAX_CHUNK_SIZE
)
{
ret
=
ERROR_RTMP_CHUNK_SIZE
;
srs_error
(
"invalid chunk size. max=%d, actual=%d, ret=%d"
,
RTMP_MAX_CHUNK_SIZE
,
chunk_size
,
ret
);
SRS_CONSTS_
RTMP_MAX_CHUNK_SIZE
,
chunk_size
,
ret
);
return
ret
;
}
...
...
请
注册
或
登录
后发表评论