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
2015-08-12 13:22:09 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9fb4640a8f5d1562d57981578585928d5bd24760
9fb4640a
1 parent
267846a3
enable the SRS_PERF_TCP_NODELAY and add config tcp_nodelay. 2.0.182
隐藏空白字符变更
内嵌
并排对比
正在显示
9 个修改的文件
包含
44 行增加
和
12 行删除
README.md
trunk/conf/full.conf
trunk/conf/realtime.conf
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/app/srs_app_rtmp_conn.hpp
trunk/src/core/srs_core.hpp
trunk/src/core/srs_core_performance.hpp
README.md
查看文件 @
9fb4640
...
...
@@ -342,6 +342,7 @@ Remark:
## History
*
v2.0, 2015-08-12, enable the SRS_PERF_TCP_NODELAY and add config tcp_nodelay. 2.0.182
*
v2.0, 2015-08-11, for
[
#442
](
https://github.com/simple-rtmp-server/srs/issues/442
)
support kickoff connected client. 2.0.181
*
v2.0, 2015-07-21, for
[
#169
](
https://github.com/simple-rtmp-server/srs/issues/169
)
support default values for transcode. 2.0.180
*
v2.0, 2015-07-21, fix
[
#435
](
https://github.com/simple-rtmp-server/srs/issues/435
)
add pageUrl for HTTP callback on_play.
...
...
trunk/conf/full.conf
查看文件 @
9fb4640
...
...
@@ -851,6 +851,10 @@ vhost min.delay.com {
# drop the old whole gop.
# default: 30
queue_length
10
;
# whether enable the TCP_NODELAY
# if on, set the nodelay of fd by setsockopt
# default: off
tcp_nodelay
on
;
}
# the vhost for antisuck.
...
...
trunk/conf/realtime.conf
查看文件 @
9fb4640
...
...
@@ -12,4 +12,5 @@ vhost __defaultVhost__ {
enabled
off
;
}
mw_latency
100
;
tcp_nodelay
on
;
}
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
9fb4640
...
...
@@ -1750,7 +1750,7 @@ int SrsConfig::check_config()
&&
n
!=
"time_jitter"
&&
n
!=
"mix_correct"
&&
n
!=
"atc"
&&
n
!=
"atc_auto"
&&
n
!=
"debug_srs_upnode"
&&
n
!=
"mr"
&&
n
!=
"mw_latency"
&&
n
!=
"min_latency"
&&
n
!=
"mr"
&&
n
!=
"mw_latency"
&&
n
!=
"min_latency"
&&
n
!=
"tcp_nodelay"
&&
n
!=
"security"
&&
n
!=
"http_remux"
&&
n
!=
"http"
&&
n
!=
"http_static"
&&
n
!=
"hds"
...
...
@@ -2489,6 +2489,23 @@ bool SrsConfig::get_realtime_enabled(string vhost)
return
SRS_CONF_PERFER_FALSE
(
conf
->
arg0
());
}
bool
SrsConfig
::
get_tcp_nodelay
(
string
vhost
)
{
static
bool
DEFAULT
=
false
;
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
return
DEFAULT
;
}
conf
=
conf
->
get
(
"tcp_nodelay"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
DEFAULT
;
}
return
SRS_CONF_PERFER_FALSE
(
conf
->
arg0
());
}
int
SrsConfig
::
get_global_chunk_size
()
{
SrsConfDirective
*
conf
=
root
->
get
(
"chunk_size"
);
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
9fb4640
...
...
@@ -522,6 +522,10 @@ public:
*/
// TODO: FIXME: add utest for min_latency.
virtual
bool
get_realtime_enabled
(
std
::
string
vhost
);
/**
* whether enable tcp nodelay for all clients of vhost.
*/
virtual
bool
get_tcp_nodelay
(
std
::
string
vhost
);
private
:
/**
* get the global chunk size.
...
...
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
9fb4640
...
...
@@ -591,7 +591,7 @@ int SrsRtmpConn::do_playing(SrsSource* source, SrsConsumer* consumer, SrsQueueRe
change_mw_sleep
(
_srs_config
->
get_mw_sleep_ms
(
req
->
vhost
));
// set the sock options.
play_
set_sock_options
();
set_sock_options
();
while
(
!
disposed
)
{
// collect elapse for pithy print.
...
...
@@ -769,6 +769,9 @@ int SrsRtmpConn::do_publishing(SrsSource* source, SrsPublishRecvThread* trd)
srs_error
(
"start isolate recv thread failed. ret=%d"
,
ret
);
return
ret
;
}
// set the sock options.
set_sock_options
();
int64_t
nb_msgs
=
0
;
while
(
!
disposed
)
{
...
...
@@ -1093,10 +1096,10 @@ void SrsRtmpConn::change_mw_sleep(int sleep_ms)
mw_sleep
=
sleep_ms
;
}
void
SrsRtmpConn
::
play_
set_sock_options
()
void
SrsRtmpConn
::
set_sock_options
()
{
if
(
_srs_config
->
get_tcp_nodelay
(
req
->
vhost
))
{
#ifdef SRS_PERF_TCP_NODELAY
if
(
true
)
{
int
fd
=
st_netfd_fileno
(
stfd
);
socklen_t
nb_v
=
sizeof
(
int
);
...
...
@@ -1112,8 +1115,10 @@ void SrsRtmpConn::play_set_sock_options()
getsockopt
(
fd
,
IPPROTO_TCP
,
TCP_NODELAY
,
&
v
,
&
nb_v
);
srs_trace
(
"set TCP_NODELAY %d=>%d"
,
ov
,
v
);
}
#else
srs_warn
(
"SRS_PERF_TCP_NODELAY is disabled but tcp_nodelay configed."
);
#endif
}
}
int
SrsRtmpConn
::
check_edge_token_traverse_auth
()
...
...
trunk/src/app/srs_app_rtmp_conn.hpp
查看文件 @
9fb4640
...
...
@@ -119,7 +119,7 @@ private:
virtual
int
process_publish_message
(
SrsSource
*
source
,
SrsCommonMessage
*
msg
,
bool
vhost_is_edge
);
virtual
int
process_play_control_msg
(
SrsConsumer
*
consumer
,
SrsCommonMessage
*
msg
);
virtual
void
change_mw_sleep
(
int
sleep_ms
);
virtual
void
play_
set_sock_options
();
virtual
void
set_sock_options
();
private
:
virtual
int
check_edge_token_traverse_auth
();
virtual
int
connect_server
(
int
origin_index
,
st_netfd_t
*
pstsock
);
...
...
trunk/src/core/srs_core.hpp
查看文件 @
9fb4640
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 18
1
#define VERSION_REVISION 18
2
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
...
...
trunk/src/core/srs_core_performance.hpp
查看文件 @
9fb4640
...
...
@@ -163,12 +163,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//#undef SRS_PERF_COMPLEX_SEND
#define SRS_PERF_COMPLEX_SEND
/**
* whether enable the TCP_NODELAY
* user maybe need send small tcp packet for some network.
* @see https://github.com/simple-rtmp-server/srs/issues/320
*/
//#define SRS_PERF_TCP_NODELAY
* whether enable the TCP_NODELAY
* user maybe need send small tcp packet for some network.
* @see https://github.com/simple-rtmp-server/srs/issues/320
*/
#undef SRS_PERF_TCP_NODELAY
#define SRS_PERF_TCP_NODELAY
/**
* set the socket send buffer,
* to force the server to send smaller tcp packet.
...
...
请
注册
或
登录
后发表评论