mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refactor code, use pithy print for RTC send.
This commit is contained in:
parent
94afe6c56e
commit
928d863e50
3 changed files with 13 additions and 5 deletions
|
@ -112,6 +112,8 @@ SrsPithyPrint::SrsPithyPrint(int _stage_id)
|
||||||
#define SRS_CONSTS_STAGE_EXEC 11
|
#define SRS_CONSTS_STAGE_EXEC 11
|
||||||
// for the rtc play
|
// for the rtc play
|
||||||
#define SRS_CONSTS_STAGE_RTC_PLAY 12
|
#define SRS_CONSTS_STAGE_RTC_PLAY 12
|
||||||
|
// for the rtc send
|
||||||
|
#define SRS_CONSTS_STAGE_RTC_SEND 13
|
||||||
|
|
||||||
SrsPithyPrint* SrsPithyPrint::create_rtmp_play()
|
SrsPithyPrint* SrsPithyPrint::create_rtmp_play()
|
||||||
{
|
{
|
||||||
|
@ -173,6 +175,11 @@ SrsPithyPrint* SrsPithyPrint::create_rtc_play()
|
||||||
return new SrsPithyPrint(SRS_CONSTS_STAGE_RTC_PLAY);
|
return new SrsPithyPrint(SRS_CONSTS_STAGE_RTC_PLAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SrsPithyPrint* SrsPithyPrint::create_rtc_send()
|
||||||
|
{
|
||||||
|
return new SrsPithyPrint(SRS_CONSTS_STAGE_RTC_SEND);
|
||||||
|
}
|
||||||
|
|
||||||
SrsPithyPrint::~SrsPithyPrint()
|
SrsPithyPrint::~SrsPithyPrint()
|
||||||
{
|
{
|
||||||
leave_stage();
|
leave_stage();
|
||||||
|
|
|
@ -88,6 +88,7 @@ public:
|
||||||
static SrsPithyPrint* create_http_stream();
|
static SrsPithyPrint* create_http_stream();
|
||||||
static SrsPithyPrint* create_http_stream_cache();
|
static SrsPithyPrint* create_http_stream_cache();
|
||||||
static SrsPithyPrint* create_rtc_play();
|
static SrsPithyPrint* create_rtc_play();
|
||||||
|
static SrsPithyPrint* create_rtc_send();
|
||||||
virtual ~SrsPithyPrint();
|
virtual ~SrsPithyPrint();
|
||||||
private:
|
private:
|
||||||
// Enter the specified stage, return the client id.
|
// Enter the specified stage, return the client id.
|
||||||
|
|
|
@ -1398,12 +1398,12 @@ srs_error_t SrsRtcServer::cycle()
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
// TODO: FIXME: Use pithy print.
|
|
||||||
uint32_t cnt = 1;
|
|
||||||
uint64_t nn_msgs = 0;
|
uint64_t nn_msgs = 0;
|
||||||
|
|
||||||
SrsStatistic* stat = SrsStatistic::instance();
|
SrsStatistic* stat = SrsStatistic::instance();
|
||||||
|
|
||||||
|
SrsPithyPrint* pprint = SrsPithyPrint::create_rtc_send();
|
||||||
|
SrsAutoFree(SrsPithyPrint, pprint);
|
||||||
|
|
||||||
// TODO: FIXME: Support reload.
|
// TODO: FIXME: Support reload.
|
||||||
int max_sendmmsg = _srs_config->get_rtc_server_sendmmsg();
|
int max_sendmmsg = _srs_config->get_rtc_server_sendmmsg();
|
||||||
|
|
||||||
|
@ -1439,8 +1439,8 @@ srs_error_t SrsRtcServer::cycle()
|
||||||
// Increase total messages.
|
// Increase total messages.
|
||||||
nn_msgs += pos;
|
nn_msgs += pos;
|
||||||
|
|
||||||
// TODO: FIXME: Use pithy print.
|
pprint->elapse();
|
||||||
if ((cnt++ % 100) == 0) {
|
if (pprint->can_print()) {
|
||||||
// TODO: FIXME: Support reload.
|
// TODO: FIXME: Support reload.
|
||||||
max_sendmmsg = _srs_config->get_rtc_server_sendmmsg();
|
max_sendmmsg = _srs_config->get_rtc_server_sendmmsg();
|
||||||
srs_trace("-> RTC SEND %d by sendmmsg %d, total %" PRId64 " msgs", pos, max_sendmmsg, nn_msgs);
|
srs_trace("-> RTC SEND %d by sendmmsg %d, total %" PRId64 " msgs", pos, max_sendmmsg, nn_msgs);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue