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-11-13 12:46:44 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
3084ec49de39a47ee9eac4be28e813add7b8d6ed
3084ec49
2 parents
7c2576e5
4af2e78c
Merge branch 'srs.master'
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
34 行增加
和
8 行删除
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/app/srs_app_server.cpp
trunk/src/app/srs_app_source.cpp
trunk/src/kernel/srs_kernel_consts.hpp
trunk/src/rtmp/srs_protocol_rtmp.hpp
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
3084ec4
...
...
@@ -69,9 +69,6 @@ using namespace std;
// when edge timeout, retry next.
#define SRS_EDGE_TOKEN_TRAVERSE_TIMEOUT_US (int64_t)(3*1000*1000LL)
// to get msgs then totally send out.
#define SYS_MAX_PLAY_SEND_MSGS 128
SrsRtmpConn
::
SrsRtmpConn
(
SrsServer
*
srs_server
,
st_netfd_t
client_stfd
)
:
SrsConnection
(
srs_server
,
client_stfd
)
{
...
...
@@ -520,7 +517,7 @@ int SrsRtmpConn::playing(SrsSource* source)
// initialize other components
SrsPithyPrint
pithy_print
(
SRS_CONSTS_STAGE_PLAY_USER
);
SrsSharedPtrMessageArray
msgs
(
SYS_MAX_PLAY_SEND_MSGS
);
SrsSharedPtrMessageArray
msgs
(
SYS_
CONSTS_
MAX_PLAY_SEND_MSGS
);
bool
user_specified_duration_to_stop
=
(
req
->
duration
>
0
);
int64_t
starttime
=
-
1
;
...
...
trunk/src/app/srs_app_server.cpp
查看文件 @
3084ec4
...
...
@@ -50,12 +50,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define SERVER_LISTEN_BACKLOG 512
// system interval
// system interval
in ms,
// all resolution times should be times togother,
// for example, system-time is 3(300ms),
// then rusage can be 3*x, for instance, 3*10=30(3s),
// the meminfo canbe 30*x, for instance, 30*2=60(6s)
// for performance refine, @see: https://github.com/winlinvip/simple-rtmp-server/issues/194
// @remark, recomment to 1000ms.
#define SRS_SYS_CYCLE_INTERVAL 1000
// update time interval:
...
...
trunk/src/app/srs_app_source.cpp
查看文件 @
3084ec4
...
...
@@ -216,7 +216,7 @@ int SrsMessageQueue::dump_packets(int max_count, SrsSharedPtrMessage** pmsgs, in
}
else
{
// erase some vector elements may cause memory copy,
// maybe can use more efficient vector.swap to avoid copy.
// @remark for the pmsgs is big enough, for instance, SYS_MAX_PLAY_SEND_MSGS 128,
// @remark for the pmsgs is big enough, for instance, SYS_
CONSTS_
MAX_PLAY_SEND_MSGS 128,
// the rtmp play client will get 128msgs once, so this branch rarely execute.
msgs
.
erase
(
msgs
.
begin
(),
msgs
.
begin
()
+
count
);
}
...
...
trunk/src/kernel/srs_kernel_consts.hpp
查看文件 @
3084ec4
...
...
@@ -78,6 +78,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// 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.
// @remark, recomment to 500ms.
#define SRS_CONSTS_RTMP_PULSE_TIMEOUT_US (int64_t)(500*1000LL)
/**
...
...
@@ -98,17 +99,41 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//#define SRS_CONSTS_RTMP_MAX_FMT3_HEADER_SIZE 5
/**
* how many msgs can be send entirely.
* for play clients to get msgs then totally send out.
* for example, 25fps video, 40ms per video packet,
* while audio is 20ms per audio packet where 2/3 is audios,
* when SYS_CONSTS_MAX_PLAY_SEND_MSGS is 128, then
* we will send all 128*40ms/3=1706ms packets in a time,
* which should greater than the SRS_CONSTS_RTMP_PULSE_TIMEOUT_US
* (for example, 500ms), that is, we should:
* SYS_CONSTS_MAX_PLAY_SEND_MSGS * 40 / 3 >= SRS_CONSTS_RTMP_PULSE_TIMEOUT_US
* @remark, recomment to 128.
*/
#define SYS_CONSTS_MAX_PLAY_SEND_MSGS 128
/**
* for performance issue,
* the iovs cache, @see https://github.com/winlinvip/simple-rtmp-server/issues/194
* iovs cache for multiple messages for each connections.
* each iovc is 16bytes, sizeof(iovec)=16, suppose the chunk size is 64k,
* each message send in a chunk which needs only 2 iovec,
* so the iovs max should be (SYS_CONSTS_MAX_PLAY_SEND_MSGS * 16 * 2)
*
* @remark, SRS will realloc when the iovs not enough.
*/
#define SRS_CONSTS_IOVS_MAX
1024
#define SRS_CONSTS_IOVS_MAX
(SYS_CONSTS_MAX_PLAY_SEND_MSGS * 32)
/**
* for performance issue,
* the c0c3 cache, @see https://github.com/winlinvip/simple-rtmp-server/issues/194
* c0c3 cache for multiple messages for each connections.
* each c0 <= 16byes, suppose the chunk size is 64k,
* each message send in a chunk which needs only a c0 header,
* so the c0c3 cache should be (SYS_CONSTS_MAX_PLAY_SEND_MSGS * 16)
*
* @remark, SRS will try another loop when c0c3 cache dry, for we cannot realloc it.
* so we use larger c0c3 cache, that is (SYS_CONSTS_MAX_PLAY_SEND_MSGS * 32)
*/
#define SRS_CONSTS_C0C3_HEADERS_MAX
4096
#define SRS_CONSTS_C0C3_HEADERS_MAX
(SYS_CONSTS_MAX_PLAY_SEND_MSGS * 32)
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
...
...
trunk/src/rtmp/srs_protocol_rtmp.hpp
查看文件 @
3084ec4
...
...
@@ -374,6 +374,9 @@ public:
* @param msgs, the msgs to send out, never be NULL.
* @param nb_msgs, the size of msgs to send out.
* @param stream_id, the stream id of packet to send over, 0 for control message.
*
* @remark performance issue, to support 6k+ 250kbps client,
* @see https://github.com/winlinvip/simple-rtmp-server/issues/194
*/
virtual
int
send_and_free_messages
(
SrsSharedPtrMessage
**
msgs
,
int
nb_msgs
,
int
stream_id
);
/**
...
...
请
注册
或
登录
后发表评论