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
2013-11-09 20:56:35 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ed3525056c15aeb5f4326aa5a994c919965d6d9e
ed352505
1 parent
c78af697
support config the chunk_size.
显示空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
27 行增加
和
4 行删除
README.md
trunk/conf/srs.conf
trunk/src/core/srs_core_client.cpp
trunk/src/core/srs_core_config.cpp
trunk/src/core/srs_core_config.hpp
README.md
查看文件 @
ed35250
...
...
@@ -48,6 +48,7 @@ url: rtmp://127.0.0.1:1935/live/livestream
*
nginx v1.5.0: 139524 lines
<br/>
### History
*
v0.4, 2013-11-09, support config the chunk_size.
*
v0.4, 2013-11-09, support pause for live stream.
*
v0.3, 2013-11-04, v0.3 released. 11773 lines.
*
v0.3, 2013-11-04, support refer/play-refer/publish-refer.
...
...
trunk/conf/srs.conf
查看文件 @
ed35250
# the listen ports, split by space.
listen
1935
19350
;
# the default chunk size is 128, max is 65536,
# some client does not support chunk size change,
# however, most clients supports it and it can improve
# performance about 10%.
# if not specified, set to 4096.
chunk_size
65000
;
# vhost list, the __defaultVhost__ is the default vhost
# for which cannot identify the required vhost.
vhost
__
defaultVhost__
{
}
# the vhost disabled.
vhost
removed
.
vhost
.
com
{
# whether the vhost is enabled.
# if off, all request access denied.
# default: on
enabled
off
;
}
# the vhost for min delay, donot cache any stream.
vhost
min
.
delay
.
com
{
# whether cache the last gop.
# if on, cache the last gop and dispatch to client,
...
...
@@ -18,6 +29,7 @@ vhost min.delay.com {
# default: on
gop_cache
off
;
}
# the vhost for antisuck.
vhost
refer
.
anti_suck
.
com
{
# the common refer for play and publish.
# if the page url of client not in the refer, access denied.
...
...
trunk/src/core/srs_core_client.cpp
查看文件 @
ed35250
...
...
@@ -24,6 +24,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_client.hpp>
#include <arpa/inet.h>
#include <stdlib.h>
#include <srs_core_error.hpp>
#include <srs_core_log.hpp>
...
...
@@ -135,20 +136,23 @@ int SrsClient::do_cycle()
req
->
strip
();
srs_trace
(
"identify client success. type=%d, stream_name=%s"
,
type
,
req
->
stream
.
c_str
());
// TODO: read from config.
int
chunk_size
=
4096
;
SrsConfDirective
*
conf
=
config
->
get_chunk_size
();
if
(
conf
&&
!
conf
->
arg0
().
empty
())
{
chunk_size
=
::
atoi
(
conf
->
arg0
().
c_str
());
}
if
((
ret
=
rtmp
->
set_chunk_size
(
chunk_size
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"set chunk
size failed. ret=%d"
,
ret
);
srs_error
(
"set chunk
_size=%d failed. ret=%d"
,
chunk_size
,
ret
);
return
ret
;
}
srs_
verbose
(
"set chunk size success"
);
srs_
trace
(
"set chunk_size=%d success"
,
chunk_size
);
// find a source to publish.
SrsSource
*
source
=
SrsSource
::
find
(
req
->
get_stream_url
());
srs_assert
(
source
!=
NULL
);
SrsConfDirective
*
conf
=
config
->
get_gop_cache
(
req
->
vhost
);
bool
enabled_cache
=
true
;
conf
=
config
->
get_gop_cache
(
req
->
vhost
);
if
(
conf
&&
conf
->
arg0
()
==
"off"
)
{
enabled_cache
=
false
;
}
...
...
trunk/src/core/srs_core_config.cpp
查看文件 @
ed35250
...
...
@@ -536,6 +536,11 @@ SrsConfDirective* Config::get_listen()
return
root
->
get
(
"listen"
);
}
SrsConfDirective
*
Config
::
get_chunk_size
()
{
return
root
->
get
(
"chunk_size"
);
}
int
Config
::
parse_argv
(
int
&
i
,
char
**
argv
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
trunk/src/core/srs_core_config.hpp
查看文件 @
ed35250
...
...
@@ -102,6 +102,7 @@ public:
virtual
SrsConfDirective
*
get_refer_play
(
std
::
string
vhost
);
virtual
SrsConfDirective
*
get_refer_publish
(
std
::
string
vhost
);
virtual
SrsConfDirective
*
get_listen
();
virtual
SrsConfDirective
*
get_chunk_size
();
private
:
virtual
int
parse_argv
(
int
&
i
,
char
**
argv
);
virtual
void
print_help
(
char
**
argv
);
...
...
请
注册
或
登录
后发表评论