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-01-01 19:58:33 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3dbb2132d322473b5ad87bc6fab48319b9fac0ff
3dbb2132
1 parent
a9a6a7cd
change server timeout longer, recv timeout from 5s to 30s
显示空白字符变更
内嵌
并排对比
正在显示
7 个修改的文件
包含
46 行增加
和
28 行删除
trunk/src/core/srs_core_client.cpp
trunk/src/core/srs_core_encoder.cpp
trunk/src/core/srs_core_forward.cpp
trunk/src/core/srs_core_protocol.cpp
trunk/src/core/srs_core_protocol.hpp
trunk/src/core/srs_core_thread.cpp
trunk/src/core/srs_core_thread.hpp
trunk/src/core/srs_core_client.cpp
查看文件 @
3dbb213
...
...
@@ -42,11 +42,6 @@ using namespace std;
#include <srs_core_http.hpp>
#include <srs_core_bandwidth.hpp>
#define SRS_PULSE_TIMEOUT_MS 100
#define SRS_SEND_TIMEOUT_US 5000000L
#define SRS_RECV_TIMEOUT_US SRS_SEND_TIMEOUT_US
#define SRS_STREAM_BUSY_SLEEP_MS 2000
SrsClient
::
SrsClient
(
SrsServer
*
srs_server
,
st_netfd_t
client_stfd
)
:
SrsConnection
(
srs_server
,
client_stfd
)
{
...
...
@@ -198,7 +193,7 @@ int SrsClient::service_cycle()
srs_warn
(
"stream %s is already publishing. ret=%d"
,
req
->
get_stream_url
().
c_str
(),
ret
);
// to delay request
st_usleep
(
SRS_STREAM_BUSY_SLEEP_
MS
*
1000
);
st_usleep
(
SRS_STREAM_BUSY_SLEEP_
US
);
return
ret
;
}
...
...
@@ -324,12 +319,12 @@ int SrsClient::playing(SrsSource* source)
SrsAutoFree
(
SrsConsumer
,
consumer
,
false
);
srs_verbose
(
"consumer created success."
);
rtmp
->
set_recv_timeout
(
SRS_PULSE_TIMEOUT_
MS
*
1000
);
rtmp
->
set_recv_timeout
(
SRS_PULSE_TIMEOUT_
US
);
SrsPithyPrint
pithy_print
(
SRS_STAGE_PLAY_USER
);
while
(
true
)
{
pithy_print
.
elapse
(
SRS_PULSE_TIMEOUT_
MS
);
pithy_print
.
elapse
(
SRS_PULSE_TIMEOUT_
US
/
1000
);
// switch to other st-threads.
st_usleep
(
0
);
...
...
trunk/src/core/srs_core_encoder.cpp
查看文件 @
3dbb213
...
...
@@ -37,11 +37,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_config.hpp>
#include <srs_core_rtmp.hpp>
#include <srs_core_pithy_print.hpp>
#include <srs_core_protocol.hpp>
#ifdef SRS_FFMPEG
#define SRS_ENCODER_SLEEP_MS 2000
#define SRS_ENCODER_COPY "copy"
#define SRS_ENCODER_VCODEC "libx264"
#define SRS_ENCODER_ACODEC "libaacplus"
...
...
@@ -483,7 +482,7 @@ void SrsFFMPEG::stop()
SrsEncoder
::
SrsEncoder
()
{
pthread
=
new
SrsThread
(
this
,
SRS_ENCODER_SLEEP_
M
S
);
pthread
=
new
SrsThread
(
this
,
SRS_ENCODER_SLEEP_
U
S
);
pithy_print
=
new
SrsPithyPrint
(
SRS_STAGE_ENCODER
);
}
...
...
@@ -549,7 +548,7 @@ int SrsEncoder::cycle()
// pithy print
encoder
();
pithy_print
->
elapse
(
SRS_ENCODER_SLEEP_
MS
);
pithy_print
->
elapse
(
SRS_ENCODER_SLEEP_
US
/
1000
);
return
ret
;
}
...
...
trunk/src/core/srs_core_forward.cpp
查看文件 @
3dbb213
...
...
@@ -38,11 +38,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_source.hpp>
#include <srs_core_autofree.hpp>
#define SRS_PULSE_TIMEOUT_MS 100
#define SRS_FORWARDER_SLEEP_MS 2000
#define SRS_SEND_TIMEOUT_US 3000000L
#define SRS_RECV_TIMEOUT_US SRS_SEND_TIMEOUT_US
SrsForwarder
::
SrsForwarder
(
SrsSource
*
_source
)
{
source
=
_source
;
...
...
@@ -51,7 +46,7 @@ SrsForwarder::SrsForwarder(SrsSource* _source)
stfd
=
NULL
;
stream_id
=
0
;
pthread
=
new
SrsThread
(
this
,
SRS_FORWARDER_SLEEP_
M
S
);
pthread
=
new
SrsThread
(
this
,
SRS_FORWARDER_SLEEP_
U
S
);
queue
=
new
SrsMessageQueue
();
jitter
=
new
SrsRtmpJitter
();
}
...
...
@@ -286,7 +281,7 @@ int SrsForwarder::forward()
{
int
ret
=
ERROR_SUCCESS
;
client
->
set_recv_timeout
(
SRS_PULSE_TIMEOUT_
MS
*
1000
);
client
->
set_recv_timeout
(
SRS_PULSE_TIMEOUT_
US
);
SrsPithyPrint
pithy_print
(
SRS_STAGE_FORWARDER
);
...
...
@@ -322,7 +317,7 @@ int SrsForwarder::forward()
SrsAutoFree
(
SrsSharedPtrMessage
*
,
msgs
,
true
);
// pithy print
pithy_print
.
elapse
(
SRS_PULSE_TIMEOUT_
MS
);
pithy_print
.
elapse
(
SRS_PULSE_TIMEOUT_
US
/
1000
);
if
(
pithy_print
.
can_print
())
{
srs_trace
(
"-> time=%"
PRId64
", msgs=%d, obytes=%"
PRId64
", ibytes=%"
PRId64
", okbps=%d, ikbps=%d"
,
pithy_print
.
get_age
(),
count
,
client
->
get_send_bytes
(),
client
->
get_recv_bytes
(),
client
->
get_send_kbps
(),
client
->
get_recv_kbps
());
...
...
trunk/src/core/srs_core_protocol.cpp
查看文件 @
3dbb213
...
...
@@ -282,8 +282,6 @@ messages.
/****************************************************************************
*****************************************************************************
****************************************************************************/
// when got a messae header, increase recv timeout to got an entire message.
#define SRS_MIN_RECV_TIMEOUT_US 3000
SrsProtocol
::
AckWindowSize
::
AckWindowSize
()
{
...
...
trunk/src/core/srs_core_protocol.hpp
查看文件 @
3dbb213
...
...
@@ -36,6 +36,37 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_log.hpp>
#include <srs_core_error.hpp>
// the following is the timeout for rtmp protocol,
// to avoid death connection.
// when got a messae header, there must be some data,
// increase recv timeout to got an entire message.
#define SRS_MIN_RECV_TIMEOUT_US 60*1000*1000L
// the timeout to wait for client control message,
// if timeout, we generally ignore and send the data to client,
// generally, it's the pulse time for data seding.
#define SRS_PULSE_TIMEOUT_US 200*1000L
// the timeout to wait client data,
// if timeout, close the connection.
#define SRS_SEND_TIMEOUT_US 30*1000*1000L
// the timeout to send data to client,
// if timeout, close the connection.
#define SRS_RECV_TIMEOUT_US 30*1000*1000L
// when stream is busy, for example, streaming is already
// publishing, when a new client to request to publish,
// sleep a while and close the connection.
#define SRS_STREAM_BUSY_SLEEP_US 3*1000*1000L
// when error, forwarder sleep for a while and retry.
#define SRS_FORWARDER_SLEEP_US 3*1000*1000L
// when error, encoder sleep for a while and retry.
#define SRS_ENCODER_SLEEP_US 3*1000*1000L
class
SrsSocket
;
class
SrsBuffer
;
class
SrsPacket
;
...
...
trunk/src/core/srs_core_thread.cpp
查看文件 @
3dbb213
...
...
@@ -54,10 +54,10 @@ void ISrsThreadHandler::on_leave_loop()
{
}
SrsThread
::
SrsThread
(
ISrsThreadHandler
*
thread_handler
,
int64_t
interval_
m
s
)
SrsThread
::
SrsThread
(
ISrsThreadHandler
*
thread_handler
,
int64_t
interval_
u
s
)
{
handler
=
thread_handler
;
cycle_interval_
milliseconds
=
interval_m
s
;
cycle_interval_
us
=
interval_u
s
;
tid
=
NULL
;
loop
=
false
;
...
...
@@ -143,7 +143,7 @@ failed:
break
;
}
st_usleep
(
cycle_interval_
milliseconds
*
1000
);
st_usleep
(
cycle_interval_
us
);
}
handler
->
on_leave_loop
();
...
...
trunk/src/core/srs_core_thread.hpp
查看文件 @
3dbb213
...
...
@@ -85,14 +85,14 @@ private:
bool
loop
;
private
:
ISrsThreadHandler
*
handler
;
int64_t
cycle_interval_
millisecond
s
;
int64_t
cycle_interval_
u
s
;
public
:
/**
* initialize the thread.
* @param thread_handler, the cycle handler for the thread.
* @param interval_
m
s, the sleep interval when cycle finished.
* @param interval_
u
s, the sleep interval when cycle finished.
*/
SrsThread
(
ISrsThreadHandler
*
thread_handler
,
int64_t
interval_
m
s
);
SrsThread
(
ISrsThreadHandler
*
thread_handler
,
int64_t
interval_
u
s
);
virtual
~
SrsThread
();
public
:
/**
...
...
请
注册
或
登录
后发表评论